# Cloudflare Computer — Headless Browser Environment for AI Agents > A cloud-native headless browser runtime by Cloudflare that gives AI agents full computer-use capabilities including browsing, clicking, typing, and taking screenshots. ## Install Save in your project root: # Cloudflare Computer — Headless Browser Environment for AI Agents ## Quick Use ```bash npm install @cloudflare/computer # In your agent code: # import { Computer } from "@cloudflare/computer" # const computer = new Computer() # await computer.navigate("https://example.com") # const screenshot = await computer.screenshot() ``` ## Introduction Cloudflare Computer is an open-source TypeScript library that provisions a full headless browser environment for AI agents. It lets agents navigate websites, fill forms, click buttons, read page content, and take screenshots — all through a simple programmatic API. Built on Cloudflare's edge infrastructure, it provides fast, isolated browser sessions that agents can use as their eyes and hands on the web. ## What Cloudflare Computer Does - Provisions isolated headless browser sessions for each agent request - Supports navigation, clicking, typing, scrolling, and screenshot capture - Returns structured page content (text, links, form fields) alongside visual screenshots - Handles authentication flows including cookie persistence across page loads - Integrates with MCP and standard agent tool-use protocols ## Architecture Overview The library wraps a Chromium-based headless browser running on Cloudflare Workers. Each session gets its own isolated browser context with a fresh profile, preventing cross-session data leakage. The TypeScript SDK communicates with the browser backend over a WebSocket connection, streaming commands and receiving results with low latency. Sessions are ephemeral by default but can persist state across multiple interactions when configured. ## Self-Hosting & Configuration - Install the npm package and import it into your TypeScript or JavaScript agent - Configure the Cloudflare account credentials or run locally with a bundled Chromium instance - Set viewport dimensions, user-agent strings, and timeout values via the constructor - Enable cookie persistence for multi-step workflows that require login state - Use environment variables to control concurrency limits and session lifetimes ## Key Features - Full browser automation: navigate, click, type, scroll, screenshot, and extract content - Session isolation ensures agents never leak state between tasks - Works with any LLM agent framework that supports tool-use or function calling - Built-in content extraction returns clean text alongside raw HTML - Low-latency edge execution via Cloudflare's global network ## Comparison with Similar Tools - **Browser Use** — Python-based browser automation for agents; Cloudflare Computer is TypeScript-native and edge-hosted - **Stagehand** — focuses on natural-language browser instructions; Cloudflare Computer offers lower-level programmatic control - **Playwright** — general browser testing framework; Cloudflare Computer is purpose-built for agent computer-use - **E2B** — sandboxed code execution; Cloudflare Computer specializes in browser interactions ## FAQ **Q: Do I need a Cloudflare account?** A: For edge-hosted sessions, yes. For local development, the SDK can run against a local Chromium. **Q: Can agents interact with JavaScript-heavy single-page apps?** A: Yes. The headless browser fully renders JavaScript before returning page content. **Q: Is there a session time limit?** A: Default sessions expire after 5 minutes of inactivity but the timeout is configurable. **Q: Which agent frameworks are supported?** A: Any framework that can call TypeScript functions. Adapters exist for MCP, LangChain, and Vercel AI SDK. ## Sources - https://github.com/cloudflare/computer --- Source: https://tokrepo.com/en/workflows/asset-3243f2b9 Author: AI Open Source