## Article: Building Scalable Agent Systems with Cloudflare’s @cloudflare/computer
The landscape of AI agents is rapidly evolving, and a key trend is the shift toward autonomous, capable agents that can execute complex tasks with minimal human intervention. At the heart of this evolution is the need for a robust, scalable, and efficient runtime environment—one that empowers agents to interact with the world using familiar tools like a filesystem, shell, and code execution. At Cloudflare, we’ve been pioneering solutions to these challenges, and today we’re excited to introduce the **early preview of @cloudflare/computer**, a new agent runtime designed to redefine how agents are built and scaled.
### What is @cloudflare/computer?
@cloudflare/computer is an open-source package that provides an agent runtime where the intricacies of code execution—whether in an isolate, container sandbox, or web browser—are abstracted away by the platform. Each agent gets its own “computer,” an environment optimized for efficiency, scalability, and cost-effectiveness.
The package enables agents to:
– Manipulate files and execute bash commands in a controlled environment.
– Choose between multiple execution backends (isolates or containers) based on task requirements.
– Operate within a durable, virtual filesystem that can be synced with source control or cloud storage.
This approach moves beyond traditional containerized models, which are resource-intensive and difficult to scale, toward a more flexible and sustainable architecture.
### The Evolution of Agent Architectures
Over the past year, the industry has seen a shift from single-container agent architectures to hybrid models that separate the “brain” (agent logic) from the “hands” (execution environment). This separation, while functional, introduces new challenges:
– **Scalability Issues**: Providing each agent with its own container is unsustainable, especially with the prospect of millions of concurrent agents.
– **Cost and Complexity**: Developers must manually combine different compute primitives, leading to higher costs and increased complexity.
At Cloudflare, our answer to these challenges is **isolates**—lightweight, horizontally scalable execution environments that spin up and tear down in milliseconds. Isolates support hibernation, state storage, and even the ability to spawn additional isolates for untrusted tasks. They are the foundation of Cloudflare’s serverless architecture and are uniquely suited for agent workloads.
Introducing @cloudflare/computer is the next step in this journey: to provide a unified abstraction that combines the best of isolates and containers without the developer overhead.
### A Shared Filesystem Across Environments
At the core of @cloudflare/computer is the concept of a shared, durable filesystem. This filesystem is:
– **Declarative**: Pre-populated with all the files and tools an agent needs for a specific task.
– **Environment-Agnostic**: Accessible from both isolates and containers, allowing agents to choose the optimal runtime for each operation.
– **Syncable**: Files can be pulled from or pushed to source control, cloud storage, or other backends.
Agents today demonstrate an impressive ability to select the right environment for the job:
– Tasks like file manipulation, data processing, or Git operations can run efficiently in isolates.
– Commands requiring Linux, npm, or native binaries can seamlessly execute in containers.
This flexibility is illustrated in the following diagram:

### Key Features and Tools
The @cloudflare/computer package provides:
1. **Durable Filesystem**: A virtual filesystem that supports persistent storage, Git repositories, and cloud storage integrations.
2. **Multi-Backend Execution**:
– **Isolate Runtime**: A lightweight, cost-effective option for most file and shell operations.
– **Container Runtime**: A full Linux environment for tasks requiring specific binaries or libraries.
3. **AI SDK Compatible Tools**: A rich set of tools for agents, including:
– File manipulation (read, write, edit).
– Shell execution.
– Git operations.
– Integration with external APIs and services.
Here’s an example of how to set up an agent with access to these tools:
“`javascript
import { Workspace, WorkspaceProxy } from “@cloudflare/computer”;
import { createWorkersAI } from “workers-ai-provider”;
import { Think } from “@cloudflare/think”;
export class Agent extends Think {
override workspaceBash = false;
override workspace = new Workspace({
storage: this.ctx.storage,
useThink: true,
});
override getModel() {
return createWorkersAI({ binding: this.env.AI })(“@cf/zai-org/glm-5.2”);
}
override getSystemPrompt() {
return `
You are a bug triage agent.
Use the project in /workspace/repo to reproduce the bug, inspect the code,
make a focused fix, and run verification. Include details about the changes
and commands executed in your final answer.
`;
}
override getTools() {
return {
…createAITools({
workspace: this.workspace,
shell: {
defaultBackend: “container”,
backends: {
container: {
description:
“Cloudflare Container with a full Linux userland: npm, node, package managers, test runners, and real binaries on $PATH. Use it when a task needs more than file manipulation.”,
},
},
},
}),
};
}
}
“`
### How It Works Under the Hood
The central piece of @cloudflare/computer is the **Workspace**, a virtual filesystem backed by SQLite. Workspaces can be populated from various sources, such as:
– Cloud storage (e.g., S3, Cloudflare R2).
– Git repositories.
– Local files or APIs.
The Workspace supports two execution runtimes:
1. **Isolate-Based Runtime**: Executes shell commands in a secure, sandboxed isolate using a WebAssembly-based Bash interpreter.
2. **Container Runtime**: Leverages Cloudflare Containers for full Linux environments through a FUSE filesystem mount.
The Workspace API also provides a `node:fs`-compatible interface, making it easy to integrate with existing libraries and tools.
### What’s Next?
At Cloudflare, we’ve already begun using @cloudflare/computer to:
– Build, test, and deploy JavaScript applications.
– Generate tailored documentation for customers.
– Use web browsers for complex, multi-step tasks.
Our goal is to ensure that containers are required for less than 10% of an agent’s workload. With @cloudflare/computer, coding, audio/video manipulation, and document creation can all be handled efficiently by isolates.
—
### FAQ
#### What is @cloudflare/computer?
@cloudflare/computer is an agent runtime that provides a virtual filesystem and execution environments (isolates or containers) without requiring developers to manage the underlying infrastructure.
#### How does it improve scalability?
By leveraging isolates, which are lightweight and horizontally scalable, @cloudflare/computer reduces the cost and complexity of running millions of agents concurrently.
#### What execution environments are available?
The package supports:
– **Isolate Runtime**: Fast and cost-efficient for file and shell operations.
– **Container Runtime**: A full Linux environment for tasks requiring specific dependencies.
#### Can I use my own runtime?
Yes, the architecture allows developers to plug in custom runtimes as needed.
#### What tools are included?
The AI SDK-compatible toolkit includes file manipulation, shell execution, Git operations, and more.
—
### Conclusion
@cloudflare/computer represents a significant step forward in agent runtime design. By unifying isolates and containers under a single, developer-friendly abstraction, it addresses the scalability and cost challenges that have long plagued agent-based systems. Whether you’re building autonomous agents for internal workflows or customer-facing applications, @cloudflare/computer provides the tools and flexibility you need to succeed.
Try out the early preview today and join us in shaping the future of agent computing.



