In-depth · XiaoHu explains

camelAI moves its AI agent from VMs to Cloudflare's edge

According to the team, costs fell by several orders of magnitude, responses got faster, and cheaper models became viable. All the code was open-sourced on July 24.
One-minute overview
  • Most teams run AI agents inside full Linux virtual machines. camelAI did too—until the numbers convinced it to dismantle the machine entirely.
  • The overhaul came in three steps: move the AI agent out, move the files into a database, then remove the command line. Nothing changed for users.
  • Removing the command line was the most radical step. But in the code, "removed" still leaves a narrow escape hatch.
⚑ This article is based on camelAI's own engineering blog. Its performance, cost, and model-quality claims are self-reported and have not been independently verified. Anything marked "Verified" below was checked against the open-source repository and Cloudflare's official documentation.
The starting point

An always-on machine and high-speed disk for every user could not support camelAI's planned scale

This is camelAI CTO Miguel Salinas's account of an architectural overhaul. The team completely rebuilt its AI agent, moving it from dedicated virtual machines to a lightweight architecture running on Cloudflare Durable Objects. According to camelAI, both cost and latency fell sharply. The migration happened in three stages, and all the code was open-sourced on July 24, making every mechanism verifiable in the repository.

New to camelAI? Here's the short version

camelAI is an AI coding assistant built by a three-person team: Illiana Reed leads product, Miguel Salinas leads engineering, and Isabella runs operations.

You tell it what you want in a chat box. It writes the code, installs dependencies, runs the project, and deploys it to a working URL. It can also connect to your databases and dozens of external services, run Python notebooks, and build dashboards.

The company's own description is "an AI software engineer that lives in its own computer." That "computer" was a Linux virtual machine assigned to each user—and it is exactly what this overhaul removes.

Most teams run AI agents in full Linux virtual machines or container sandboxes. camelAI started the same way.

The problem was the cost structure. Every user needed an always-on machine plus high-speed disk storage for project files. As the user base grew, scaling meant adding real machines and real disks. At camelAI's planned scale, the economics did not work.

When the user is active When the machine is running and billable One day Twice the users, twice the cost
Illustration only; the source gives no exact durations. The virtual-machine architecture bills for the gap between these timelines.

The hard part is that AI agents naturally assume they are running on Linux. They have been trained to reach for bash whenever they hit a problem. camelAI also started with the Claude Code harness, which itself requires a full virtual machine. A harness is the software layer around the model that runs the conversation loop and manages tools and state.

What a harness actually does
To make AI self-improving, start with the shell around the model: Lilian Weng explains harness engineering
That article explores the same idea—leave the model alone and change the software around it—and shows what a harness controls and how much difference redesigning it can make.

Instead of trying to schedule virtual machines more efficiently, the team redesigned the system around a more fundamental premise: it did not need virtual machines at all.

Just over four months earlier, camelAI CEO Illiana Reed had published a post beginning, "Every camelAI user has a persistent computer, a real Linux environment," calling it a core product promise. The post explained that Modal, Cloudflare Containers, and Fly.io's Sprites had all proved unsuitable, so the team spent a week building its own container service. Miguel notes that the old post remains online, although camelAI no longer runs any machines on that infrastructure.

The virtual machine contained three things: the AI agent itself, the project files, and the command line. The three-stage overhaul moved them out one by one. Each time, the team had to answer the same question: who would take over the work that component used to do?

BEFORE REPLACED WITH One Linux VM · always on AI agent Project files bash shell STEP 1 STEP 2 STEP 3 Cloudflare's edge Database + object storage 64 fixed methods Move all three, and the machine is no longer needed
The three-stage migration. Each of the next three sections removes one component and measures what that step actually solved. Diagram based on the original post and repository source.
Step 1

First, move the AI agent: faster responses, but the machine remains

The Claude Code harness could not be separated from its virtual machine, so the first job was to write a new one.

The foundation was pi, Mario Zechner's open-source AI agent toolkit, released under the MIT license and holding 81,000 GitHub stars. pi is a stack of libraries, not a single program. Its top layer is a command-line tool that assumes an operating system underneath it. The lower layers provide the raw components an AI agent needs—conversation loops and state management—without caring where they run. camelAI did not modify a single line of pi. It simply used the bottom two layers.

Verified

camelAI's package.json includes only @earendil-works/pi-agent-core and @earendil-works/pi-ai, both at version 0.80.6. It does not include pi-coding-agent, the command-line layer that assumes an operating system is present.

The new harness runs inside a Durable Object. This is a small Cloudflare compute instance with its own dedicated storage, activated in a data center close to the user. camelAI assigns one to each chat session.

Think of it this way

A conventional cloud service is like taking a number at a bank. A different teller may handle you each time, so you have to explain everything again. A Durable Object is more like a dedicated receptionist with a private drawer: you return to the same person, and the drawer still contains whatever you left there last time.