>_ DevTrendsen

Language

Home

Languages

Sections

Frontend Backend Mobile DevOps AI / ML GameDev Blockchain Embedded Security
TypeScript

Cloudflare Gives AI Agents a Virtual PC in the Cloud

AI agent developers constantly run into the same problem. Models are good at generating code, but they need an environment for actual work. They need a disk to save files, a console to run tests, the ability to install a package via npm or compile a document. Granting an agent access to a local machine is dangerous. Spinning up a separate virtual server for every short task is expensive and slow.

Cloudflare solved this problem in a project with the concise name computer. The developers created a virtual execution environment designed specifically for autonomous agents and network agents.

What's Inside

The architecture is built on a virtual file system. Essentially it's a SQLite database embedded inside a Cloudflare Durable Object. This solution preserves file state between calls and keeps data close to the code.

To work with this file system, the team proposed three different execution environments.

The first environment runs a full Linux container. Inside the container, a daemon computerd runs. It mounts the database as a regular disk via FUSE and sends changes back via the capnweb RPC protocol. In this mode, the agent has a real user Linux, network access, and the ability to run any binary files.

The second environment executes commands through a lightweight interpreter just-bash directly in an isolated Worker. No container is spun up. Commands execute quickly, and communication with the file system goes directly.

The third environment runs JavaScript code. Each command executes in a separate Dynamic Worker. The script gets access to the file system through the standard node:fs/promises module, as well as ready-made utilities for working with Git and publishing artifacts.

Features and Benchmarks

An interesting detail emerged when testing the virtual disk. The developers ran benchmarks comparing FUSE mounting computerd with a physical NVMe drive.

It turned out that for metadata operations, the virtual disk is faster than a real drive. Creating thousands of small files, reading directories, and checking permissions happen instantly due to storing the structure in RAM and SQLite. However, for sequential reading and writing of gigabyte-sized files, FUSE falls short of a physical disk.

For AI agent tasks, this setup works great. Agents more often create small scripts, edit configs, and read source code than pump heavy video through themselves.

Usage Examples from the Repository

The repository has ready-made examples showing how the system works.

In one demo, the agent receives a task to generate a PDF document. First, it creates a Markdown file in the virtual directory. Then the agent invokes a utility pandoc through the container, which converts the text into a ready PDF.

Another example shows integration with neural networks. The agent generates an image through Workers AI, writes the resulting file to the virtual disk, and provides a public link to the user.

There's also a more advanced case: the agent deploys a Cloudflare Worker project, builds it in the virtual environment, and publishes it to the artifact registry.

Project Status

The Cloudflare team specifically notes that the repository is in preview status. The code is suitable for experiments, hackathons, and prototypes, but it's a bit early to run critical services on it. The architecture and API may change at any moment.

Open pull requests are not yet being accepted. You can participate in development through discussions in Issues.

Who Should Try It

The project is useful for those writing complex agents in TypeScript and choosing infrastructure to run generated code. The combination of SQLite, FUSE, and Cloudflare Workers provides a lightweight and isolated environment that spins up in milliseconds.

Related projects