
vedant
on August 27, 2026
8 min read
so eva is the ai agent we built at work. you give it a job and it writes the code and opens a pull request, a proposed change for a person to review. eve is vercel's open source take on the same idea. same job, but the main part of the agent runs somewhere else, and this post is about why.
an agent has a loop. it asks the ai model what to do, does it, asks again, and keeps going until the job's done. it also needs a sandbox, a throwaway computer just for that job, so it can run commands and edit files without touching your real servers.
i used to say our loop lives in the sandbox cos our backend stops long tasks after about 10 minutes. that's wrong, cos you can split long work into small steps, and we both do.
eve wrote its loop itself, so it runs on the trusted side next to your passwords and keys, and the sandbox only gets the risky work. if a tool needs to charge a card, that happens outside the sandbox and the ai just sees that it worked, so the key never goes near it. and cos every step is theirs, a crash picks up from the last finished step instead of starting over.
eva runs coding agents other companies already built, like claude code, cursor and codex. their loop is their program. it can run forty tools in a row on its own, with no gap for us to step in. so we put that program inside the sandbox and have our side wait for it to finish. the upside is we keep those agents, and your next message is quick if the program is still running.
if the program dies inside the sandbox, the whole turn dies with it. that happened in 39 of 1071 runs, most likely from running out of memory, even though the error said network. keys also sit closer to the ai than eve allows, so we have to be careful on purpose.
if you own the loop, eve's way is the right default. i'd move eva over if we were ready to write our own loop instead of using claude code, or if we wanted words streaming onto the screen a lot faster. until then it stays in the sandbox, cos we can't put our steps inside someone else's program.
Eva is the cloud agent we built at work. you give it a job, it writes code, it clicks through the app, it opens a PR. Eve is Vercel's version of the same idea, open source. same job. different place the loop runs, and not for the reason I used to quote.
the cheap explanation is Convex. a Convex action dies after about 10 minutes, agent turns last longer, so the loop has to live in the sandbox. that's wrong. Convex has workflows. you split work into steps, each step is its own action, the workflow waits between them. Eve does exactly that. we do too. the 10 minute cap is why we use steps. it is not why the loop is in the VM.
the loop is the software that talks to the model, picks a tool, runs it, talks to the model again, until the job's done. people call that the harness. the sandbox is a throwaway computer for that job, a small VM, so the agent can run shell and edit files without sitting on your real servers.
Eve's loop is Eve's code. it runs in the app runtime. on Vercel that's a Function. model calls, your tool code, secrets, session state, all on that trusted side. each model call and the tools it fires is a durable step. crash or redeploy mid-turn and it resumes from the last finished step, not from scratch.
the sandbox is only for untrusted work. bash, files, a /workspace folder. no env vars, no path back into the app. even the built-in bash and file tools live in the app runtime and proxy into the VM. a tool that charges a card runs on the host, reads the Stripe key there, and the model only sees { ok: true }. the key never enters the sandbox.
the loop and the VM have separate lifetimes. the workflow can pause without keeping a sandbox warm. when the model needs a computer, the host opens one, runs the command, and can let it go. Eve can do that cos they own every tick of the loop. a tool call is a function they wrote. they can put a workflow step around it.
Eva doesn't talk to the model itself. we run Claude Code, Cursor, Codex, OpenCode. those are coding agents with their own loops, their own tool names, their own SDKs. we upload a Node process into the sandbox and that process drives the vendor SDK. Claude and Codex keep a warm daemon across turns. Cursor and OpenCode run one shot. OpenCode even wants its own HTTP server in the VM, which we keep detached and reuse.
that process is the loop. Claude's query() is an opaque session. it will call Read, then Bash, then Edit, forty times, on its own clock. there is no Convex hook between the 40th tool and the 41st. you cannot step.runAction inside someone else's SDK.
so the tempting copy of Eve doesn't exist for us unless we throw the vendor harness away and write our own. that's a real product. Eve is that product. we picked the other side: keep Claude Code, put the process in the VM, and make our workflow wait on it.
the host still uses workflows. sandbox start, thawing an archived VM (that restore can take longer than one action, so it polls across steps, ceiling about 20 minutes), claiming the next user message, waiting for the sandbox to say it's done, opening a PR, cleanup. awaitEvent is the join. the VM posts a completion mutation. the workflow wakes up.
host to VM is short. exec, write a file, claim the next turn (the daemon polls that every 50 ms), answer a question the agent asked (poll every 300 ms). no live socket. if we held a WebSocket from a Convex action for the whole Claude turn, that action would still die at 10 minutes, steps or not, cos that would be one step that never returns.
the only way to host-drive Claude Code without parking the loop in the VM is a long-lived Node process on our side that holds the stream. new infra, new way it can break, reconnects every deploy. we spent a year not having that. workflows do not replace it. workflows replace long Convex actions for work we own. they do not wrap a vendor session.
it's an esbuild bundle we upload, then run detached. it drives the SDK, parses tool events into the shape the Eva UI already understands, and pushes them to Convex over HTTP. signed heartbeats every 150 ms so the page can stream, plus a 10 second keep-alive ping when a tool is quiet so the watchdog doesn't think it died.
it also does things that only work next to the SDK. mid-turn, Claude can ask the user a question. we gate every other tool until that returns, post the question, poll for the answer, feed it back into the same query(). subagent tool steps nest under the parent so the UI can drill in. usage comes off the raw SDK event for billing. MCP config is injected in memory, then we strip the env vars and unlink the launch script so creds aren't sitting in a file on disk. background sub-agents get turned off cos they can't report completion in a single turn and their output vanishes.
the daemon stays warm across turns, then idle-exits after 45 minutes. opening the session page starts it early, cos the first boot is about 20 seconds if you don't. waking a stopped Vercel VM is about 0.3s. next message is cheap if the process is still there. that's the latency story you get when the loop is a process, not a stack of steps.
the loop can die in the VM and take the turn with it. we had 39 of 1071 runs end watchdog_killed. raising the stale threshold did nothing. heartbeats had stopped for good. best fit was the OOM killer taking out the Node process during npx tsc --noEmit on a big repo. the watchdog message said network. it wasn't. if the loop had been our steps on the host, tsc dying would be one failed tool, not a dead harness.
Vercel will lazily resume a stopped VM on any exec. opening a closed session page used to wake the box in the background. archived restores can blow past one action, which is why thaw is a workflow, not a single call. those are sandbox-lifecycle problems you only get once the loop lives there.
secrets are also closer to the model than Eve wants. Eve never puts process.env in the VM. we have to be careful on purpose, in-memory MCP, delete the launch script, don't write a config file. that's the trade for driving the vendor SDK from inside.
Eve's split is the right default if you own the loop. secrets stay out. the session can park without burning a VM. each tool is a step you can retry. that's the software factory as a framework.
I'd move Eva that way if we were ready to throw away Claude Code as the harness and write our own. or if we wanted tokens on screen in under 150 ms, which wants a host stream. direct sandbox to browser would still be smaller than moving the loop out while still wrapping their SDK. that second thing is a long-lived process. Convex workflows do not become that process.
until we write the loop ourselves, it stays in the sandbox. not cos Convex lacks steps. cos the steps we have cannot run inside Claude.
Sign in to join the conversation