<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://www.astrabox.ai/blog</id>
    <title>AstraBox Blog</title>
    <updated>2026-10-06T00:00:00.000Z</updated>
    <generator>https://github.com/jpmonette/feed</generator>
    <link rel="alternate" href="https://www.astrabox.ai/blog"/>
    <subtitle>AstraBox Blog</subtitle>
    <icon>https://www.astrabox.ai/img/favicon.svg</icon>
    <entry>
        <title type="html"><![CDATA[Starting an agent conversation in under a second]]></title>
        <id>https://www.astrabox.ai/blog/sub-second-conversation-start</id>
        <link href="https://www.astrabox.ai/blog/sub-second-conversation-start"/>
        <updated>2026-10-06T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[A cold start of a sandboxed coding agent takes 8 to 15 seconds. AstraBox does most of that work before the conversation exists, and a new conversation is ready in under a second.]]></summary>
        <content type="html"><![CDATA[<p>AstraBox runs the agent programs people already use (Claude Code, Codex, Pi,
DeepSeek Harness) as cloud Agents. A conversation runs in a sandbox, and the
vendor's own program runs inside it. Starting that from nothing takes 8 to 15
seconds: create a container, wait for its command daemon, mount a workspace,
install Skills and Plugins, clone a repository, start the agent program and let
it initialize.</p>
<p>With prewarming on, a new conversation is ready in under a second: 0.40 to
0.50 seconds on an idle 8-vCPU cloud instance, measured from the create request
to the conversation's READY event. We got there by doing most of a start
before anyone asks for it.</p>
<!-- -->

























<table><thead><tr><th>Engine</th><th>Create request to READY</th></tr></thead><tbody><tr><td>Claude Code</td><td>0.41–0.46 s</td></tr><tr><td>Pi</td><td>0.41 s</td></tr><tr><td>Codex</td><td>0.45–0.46 s</td></tr><tr><td>DeepSeek Harness</td><td>0.49–0.50 s</td></tr></tbody></table>
<p><em>Four runs per engine on 2026-10-06, timed inside the server, on one idle
c6a.2xlarge (8 vCPU, 16 GiB) running the Docker Compose deployment: Docker
29.1.3 with its default containerd image store, OpenSandbox server 0.2.3,
execd v1.1.0. The changes described here shipped in AstraBox 0.1.4. Codex's
first claim after a server restart took 0.92 s. The cold-start range is from a
separate measurement on 2026-09-23 (8.2 to 14.6 s across the four engines).
Sandboxes ran on Docker; Kubernetes was not measured.</em></p>
<p>Older, busier hardware is slower. On a 2016-era VM (12 vCPU Xeon E5-2680 v4)
that was running other workloads, the published 0.1.14 release, installed with
the quickstart command, stayed under a second for Claude Code (0.64 to 0.82 s)
and Pi (0.68 to 0.95 s). Codex took 1.03 to 2.26 s and DeepSeek Harness 1.00
to 3.05 s there. That was five runs each on 2026-11-10, timed from sending the
create request to the Session being recorded READY.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="split-startup-by-what-it-depends-on">Split startup by what it depends on<a href="https://www.astrabox.ai/blog/sub-second-conversation-start#split-startup-by-what-it-depends-on" class="hash-link" aria-label="Direct link to Split startup by what it depends on" title="Direct link to Split startup by what it depends on" translate="no">​</a></h2>
<p>Almost nothing in a cold start depends on the conversation. The container
image, the model and gateway, the system prompt, the MCP servers, the Skills
and Plugins, the default repository and the agent program's own launch are all
properties of the Agent. Only a handful of things belong to the
conversation: who it is for, which credentials it may use, where its files and
transcript go.</p>
<p>So we build prepared sandboxes from the full Agent recipe before anyone asks,
one per Agent by default:</p>





























<table><thead><tr><th>Prepared ahead, per Agent</th><th>Bound at claim, per conversation</th></tr></thead><tbody><tr><td>The sandbox, created from the Agent's image, network policy and resources</td><td>The conversation's identity and owner</td></tr><tr><td>Credential placeholders in the sandbox's egress vault</td><td>A conversation-scoped model gateway key behind those placeholders</td></tr><tr><td>Skills, Plugins, the default repository, and (with a workspace volume) a workspace view</td><td>The conversation's persistent workspace, routed into that view; its transcript destination</td></tr><tr><td>The agent program, started up to the point where it waits for a conversation</td><td>The platform MCP route for this user</td></tr><tr><td>Engine-specific work: Codex's app server, Pi's parked child process, DeepSeek Harness's native conversation and its model route</td><td>Activation over the program's own channel</td></tr></tbody></table>
<p>A user waits only for the right-hand column.</p>
<p>The prepared sandboxes come from OpenSandbox's client-side sandbox pool, which
keeps its state in Redis. Acquiring from it is one atomic operation that either
returns a sandbox or reports an empty pool immediately. An empty pool sends the
conversation down the cold path, and the miss is logged with its reason.</p>
<p>Preparing ahead raises three problems. A conversation's files have to appear
in a sandbox that was created before the conversation existed. A prepared
sandbox must never serve an Agent that has changed since. And a sandbox nobody
owns yet must not hold anybody's keys.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="routing-a-persistent-workspace-into-a-sandbox-that-already-exists">Routing a persistent workspace into a sandbox that already exists<a href="https://www.astrabox.ai/blog/sub-second-conversation-start#routing-a-persistent-workspace-into-a-sandbox-that-already-exists" class="hash-link" aria-label="Direct link to Routing a persistent workspace into a sandbox that already exists" title="Direct link to Routing a persistent workspace into a sandbox that already exists" translate="no">​</a></h2>
<p>Conversations outlive sandboxes. A sandbox can be recycled while idle, lost
with its node, or replaced after a crash; the next message borrows another
one. When a deployment configures a workspace volume, a conversation's files
live on that volume under a platform-minted workspace id, and every sandbox
that serves the conversation has to show those same files at <code>/workspace</code>.</p>
<p>That collides with prewarming. When a prepared sandbox is created, nobody knows
whose workspace it will serve, and a container's mounts are fixed at creation:
neither Docker nor Kubernetes adds a volume to a running container. Creating
the sandbox after the claim gives back the seconds prewarming saved. Copying
the files in turns every start into a transfer and leaves two copies to
reconcile.</p>
<p>AstraBox gives every prepared sandbox a workspace view instead of a
workspace. A view is a single-branch <a href="https://github.com/trapexit/mergerfs" target="_blank" rel="noopener noreferrer" class="">mergerfs</a>
FUSE mount, run by a small privileged helper outside the sandbox: a container
on Docker, a Pod on Kubernetes. We use mergerfs for one property, and it has
nothing to do with merging: its branch can be changed at runtime, without
unmounting, by writing the <code>user.mergerfs.branches</code> extended attribute on the
mount's control entry.</p>
<p>The sandbox mounts a child directory of the view, never the view's root. When
the pool creates a sandbox, the view points at a fresh, empty workspace, and a
new conversation adopts that workspace at claim. A conversation that
already has one, because its previous sandbox was recycled or lost, gets the
view switched: AstraBox asks the helper to point the view at the
conversation's workspace, the helper writes the new branch and reads it back,
and the sandbox's next <code>open()</code> under <code>/workspace</code> lands in the conversation's
files. The sandbox, its mount and the prepared agent program are untouched.</p>
<p>The view runs with its entry, attribute and negative-lookup caches at zero,
directory caching and write-back caching off, and passthrough I/O for file
contents, so the next lookup after a switch sees the new files.</p>
<p>A file descriptor opened before a switch keeps the file it opened, so a view
never switches while a conversation uses it. A view binds to exactly one
conversation, at claim, and refuses a second binding.</p>
<p>The sandbox cannot repoint itself. The control entry lives at the root of the
FUSE mount and the sandbox only ever sees a child directory, so even root
inside the sandbox has no path to the entry that chooses its files.</p>
<p>A crash halfway through a bind is recoverable. The helper records the binding,
with the mapping it is replacing, before it touches the mount. When it resumes
it accepts only the old or the new mapping, and repeating the bind completes
it.</p>
<p>Before the agent program runs, AstraBox checks that <code>/workspace</code> is a mount
and that it is the mergerfs view. A sandbox whose workspace mount did not
arrive would write to a disk that disappears with it, so such a candidate is
destroyed.</p>
<p>The backing volume can be a local directory or a shared filesystem such as
Amazon EFS or NFS. With shared storage, a conversation can continue in a
sandbox on a different node. The end-to-end suite claims a prepared sandbox for
a conversation, writes files, replaces the sandbox, and checks that the next
prepared sandbox serves the same workspace id with byte-exact contents, that
the control entry is invisible from inside the sandbox as root and as the
agent's user, and, in a cross-host variant, that the replacement ran on a
different node.</p>
<p>Workspace volumes are optional. Without one, none of this runs: each agent
program's native session is kept in the platform database and restored into
the next sandbox, so a conversation still survives the loss of its sandbox,
though the files in its workspace are lost with it.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="a-prepared-sandbox-is-only-valid-for-the-agent-it-was-built-from">A prepared sandbox is only valid for the Agent it was built from<a href="https://www.astrabox.ai/blog/sub-second-conversation-start#a-prepared-sandbox-is-only-valid-for-the-agent-it-was-built-from" class="hash-link" aria-label="Direct link to A prepared sandbox is only valid for the Agent it was built from" title="Direct link to A prepared sandbox is only valid for the Agent it was built from" translate="no">​</a></h2>
<p>A sandbox prepared for yesterday's system prompt starts fast and then answers
as the wrong agent, which is worse than a slow start.</p>
<p>Every prepared unit carries a runtime generation: a hash over everything
that went into building it. That covers the image, the engine, the sandbox
tenancy and permission level, the network policy, the model with its gateway
and credential shape, the system prompt, MCP servers, Skills, Plugins, engine
options and Vault bindings. A claim compares the Agent's current generation
with the unit's and refuses a mismatch. Editing an Agent rotates its pool, so
the next prepared sandbox is built from the new recipe. Codex, Pi and DeepSeek
Harness also compare a fingerprint of the exact process launch when they
activate.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="keys-stay-out-of-the-prepared-sandbox">Keys stay out of the prepared sandbox<a href="https://www.astrabox.ai/blog/sub-second-conversation-start#keys-stay-out-of-the-prepared-sandbox" class="hash-link" aria-label="Direct link to Keys stay out of the prepared sandbox" title="Direct link to Keys stay out of the prepared sandbox" translate="no">​</a></h2>
<p>A prepared sandbox exists before any conversation does, so it cannot hold a
conversation's credentials. The agent program only ever sees placeholder
values. The real credentials live in an egress vault in front of the sandbox,
which replaces the placeholders in outbound requests to allowed hosts.</p>
<p>At claim, when the model endpoint issues per-conversation credentials (the
bundled LiteLLM gateway does), AstraBox mints one for the conversation and
points the sandbox's placeholder at it. The prepared process keeps running and
nothing inside the sandbox restarts. Model usage is then attributed to the
conversation, not to the Agent's shared preparation key.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="a-claim-either-activates-the-prepared-unit-or-fails">A claim either activates the prepared unit or fails<a href="https://www.astrabox.ai/blog/sub-second-conversation-start#a-claim-either-activates-the-prepared-unit-or-fails" class="hash-link" aria-label="Direct link to A claim either activates the prepared unit or fails" title="Direct link to A claim either activates the prepared unit or fails" translate="no">​</a></h2>
<p>A prepared unit that fails to activate is discarded, and the conversation's
start fails with the reason. It does not fall back to a cold start in the
same request. A silent fallback turns a broken prepared sandbox into a
start that is mysteriously ten seconds slow, every time, with nothing in the
logs pointing at it. Replenishing the pool is a separate job that runs after
the failure.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="keep-the-critical-path-to-what-the-conversation-needs">Keep the critical path to what the conversation needs<a href="https://www.astrabox.ai/blog/sub-second-conversation-start#keep-the-critical-path-to-what-the-conversation-needs" class="hash-link" aria-label="Direct link to Keep the critical path to what the conversation needs" title="Direct link to Keep the critical path to what the conversation needs" translate="no">​</a></h2>
<p>What remains is mostly bookkeeping. No single step is large, but before this
work they added up to about 1.2 seconds for Claude Code and 1.65 for DeepSeek
Harness. Most of the saving came from three changes.</p>
<p>Recovery work now runs only when there is something to recover. A startup
command can die after creating or claiming a sandbox and before recording it.
The next execution of the same command has to find that sandbox, and finding it
means listing every sandbox on the backend. But only a re-execution can find
anything, because every startup command has a fresh id. So the first execution
records itself on the Session with one compare-and-set before it touches the
sandbox provider, and skips the listing. A re-execution sees the record and
runs the lookup.</p>
<p>Housekeeping runs after the user is served. Claiming a sandbox appends the
conversation to the Agent's gateway-key ledger. Pruning that ledger (reading
every ended conversation and deleting its gateway key) runs as a background
task after the claim instead of in front of it.</p>
<p>The claim path runs no commands inside the sandbox. Each command executed in
a sandbox costs about 235 ms here, because the command daemon holds the
output stream open for a short drain after the command ends. A private file
written through the sandbox's file API takes about 5 ms. DeepSeek Harness
needed a per-conversation state file at claim; writing it with four commands
cost 941 ms, and writing it with one file call costs a few milliseconds. The
prepared sandbox has never held that file, and the program reads it only on
request, so the atomic-replace dance is unnecessary on this path.</p>
<p>Measuring every round trip also turned up one surprise worth knowing if you
run Docker yourself. Under Docker 29's default containerd image store, an
image inspect takes about 100 ms regardless of API version, while a container
inspect takes about 1 ms. OpenSandbox's Docker runtime inspects the image on
every sandbox description to report its first tag. AstraBox's embedded
OpenSandbox server reports the reference the container was created from
instead, which is the image the create request named.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="where-the-remaining-time-goes">Where the remaining time goes<a href="https://www.astrabox.ai/blog/sub-second-conversation-start#where-the-remaining-time-goes" class="hash-link" aria-label="Direct link to Where the remaining time goes" title="Direct link to Where the remaining time goes" translate="no">​</a></h2>
<p>For a Claude Code claim at about 0.42 s, in the 2026-10-06 measurement:</p>









































<table><thead><tr><th>Step</th><th>Time</th></tr></thead><tbody><tr><td>Create the Session and its startup command (durable writes)</td><td>~80 ms</td></tr><tr><td>Startup bookkeeping, generation check, first-execution record</td><td>~45 ms</td></tr><tr><td>Acquire from the pool, including the lease renewal</td><td>~40 ms</td></tr><tr><td>Adopt the sandbox: read its claim receipt, connect, retag it for the Session</td><td>~60 ms</td></tr><tr><td>Conversation credentials: ledger entry, gateway key, vault update</td><td>~40 ms</td></tr><tr><td>Platform MCP route for this user</td><td>~20 ms</td></tr><tr><td>Activate the prepared program</td><td>~5 ms</td></tr><tr><td>Record READY and notify subscribers</td><td>~40 ms</td></tr></tbody></table>
<p>Activation varies by engine: about 5 ms for Claude Code and up to about 90 ms
for DeepSeek Harness, which rejoins its prepared native conversation and
selects the Agent's model on it.</p>
<p>Two directions remain. The claim can become a single step: everything left in
the table that does not depend on the conversation moves into preparation, and
the independent steps run concurrently. And the first message does not have to
wait at all: the platform already keeps a durable input queue per
conversation, and accepting input while the conversation starts would hide the
remaining startup behind the time a user spends typing.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="what-prewarming-costs">What prewarming costs<a href="https://www.astrabox.ai/blog/sub-second-conversation-start#what-prewarming-costs" class="hash-link" aria-label="Direct link to What prewarming costs" title="Direct link to What prewarming costs" translate="no">​</a></h2>
<p>Each Agent keeps as many idle prepared sandboxes as its prepared capacity,
which is 1 by default and 0 to turn prewarming off. On a Docker host an idle
prepared sandbox uses about 0.5 GiB for Claude Code and 0.45 GiB for Pi, plus
about 60 MiB for its egress sidecar, and 2 to 5% of one CPU. On Kubernetes the scheduler reserves a
conversation sandbox's requests, 250m CPU and 1 GiB. After a conversation
claims a sandbox the pool prepares a replacement, and an idle one is recycled
at the end of the sandbox lease. See
<a class="" href="https://www.astrabox.ai/docs/deploy#plan-capacity-for-prepared-sandboxes">capacity planning</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="try-it">Try it<a href="https://www.astrabox.ai/blog/sub-second-conversation-start#try-it" class="hash-link" aria-label="Direct link to Try it" title="Direct link to Try it" translate="no">​</a></h2>
<p>The <a href="https://demo.astrabox.ai/" target="_blank" rel="noopener noreferrer" class="">live demo</a> needs no signup. To run it yourself,
the <a class="" href="https://www.astrabox.ai/docs/quickstart">Quickstart</a> installs AstraBox on a Linux host with one
command, and the source is on <a href="https://github.com/Colton-z/AstraBox" target="_blank" rel="noopener noreferrer" class="">GitHub</a>.</p>]]></content>
        <author>
            <name>Colton Qi</name>
            <uri>https://github.com/Colton-z</uri>
        </author>
        <category label="engineering" term="engineering"/>
        <category label="sandboxes" term="sandboxes"/>
        <category label="prewarming" term="prewarming"/>
    </entry>
</feed>