camelAI moves its AI agent from VMs to Cloudflare's edge
- 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.
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.
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.
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?
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.
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.
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.
