Facebook File Instagram LinkedIn
← Journal

Terms & Containers

In 2026, Crosby's infrastructure team migrated our core platform systems from a mix of AWS ECS and various platform-as-a-service (PaaS) providers to Kubernetes (AWS EKS) and Temporal Cloud.

Kubernetes gave us a portable platform with controls for deploying and scaling our core workloads, plus the ability to self-host a variety of vendored systems. Temporal gave us durable execution for any workload that requires it. We use Temporal Cloud today, and we like knowing we can self-host if we ever need to.

This stack has served us well. Monitoring, integrations, and scaling have kept pace as our team has grown. Then came our biggest challenge yet: client-facing agents.

These agents do real work for Crosby's clients, which sometimes entails writing never-before-seen code and running it in an isolated environment, in unpredictable bursts, with real-world data fed into context.

None of Crosby's existing workloads looked quite like that. So we went back to the drawing board.

This post is about the sandbox runtime we built for our client-facing agents, the runtimes we tested, and why we picked the runtime you might not expect.

What we needed

Picture a single agent run. It reads a contract, writes a short script to compare clauses against a playbook, runs it, returns the result, and throws the environment away. Now picture a client sending over an entire deal's worth of documents at once.

Scenarios like this gave us our requirements:

  1. Isolation. Agent code cannot reach other executions, the host, cloud credentials, or our trusted services.
  2. A fresh environment every time. Nothing carries over from one execution to the next.
  3. Speed during bursts. Starting an execution can't be the bottleneck on the deal.
  4. Portability. It runs wherever Kubernetes runs, on nodes that support virtualization. No specialized hardware required.
  5. Cost. Spiky demand shouldn't mean paying a premium at scale.

On paper, Kubernetes and Temporal covered most of this. Temporal could queue and dispatch the work, while Kubernetes could schedule and run it.

What was missing

First, containers alone are not a strong enough security boundary. Standard Open Container Initiative (OCI) containers on EKS share the host kernel, and our trusted workloads hold credentials we weren’t going to put next to unreviewed code.

Second, sandbox workloads behave very differently from the rest of our traffic. Every execution creates and deletes short-lived resources. That churn puts pressure on the Kubernetes control plane at scale (the scheduler, the API server, etcd) even when nodes have plenty of spare resources. Separate node groups don't fix this, because they still share the control plane. We also didn't want to tune our primary cluster's scheduler around a workload with such a different shape.

Third, we had no sandbox lifecycle manager: nothing to keep sandboxes warm, hand each one to exactly one execution, and tear it down afterward. We briefly considered Agent Substrate, but before it went general availability (GA) it felt like too much, too soon. Agent Sandbox, a Kubernetes special interest group (SIG) project, was the right fit. It models sandboxes, warm pools, and claims as plain Kubernetes resources, and has healthy community adoption and engagement.

Why we built it ourselves

The same reasons that took us to Kubernetes earlier in the year applied here: portability, control, and cost. Client-facing agents added one more reason to build: owning the trust boundary.

Client-facing agents run with client data in context. Building our own sandbox platform keeps that data in our own cloud accounts, or in a client’s account if they prefer. It also lets us decide what exactly a guest can reach: no credentials, no persistent storage, and model access through a gateway that we control.

Sandboxing vendors make their own tradeoffs: you get their isolation model, their regions, their lifecycles, and their pricing. Crosby’s business looks very different from an inference provider’s, so we wanted to build with our own tradeoffs in mind.

We wanted strong isolation, predictable performance, and the ability to run anywhere Kubernetes can with nodes that have virtualization enabled. That leaves the most doors open, and we’re less likely to rebuild from scratch or end up in a split-brain system that uses different providers for different clients.

Cost wasn’t the deciding factor, but it couldn’t be a dealbreaker. At low volume, we pay a modest premium over vendors. At scale, we land in striking distance..

Executions per month

Cost per 1,000, on demand

Cost per 1,000, with our savings plan

10M

~$0.85

~$0.63

25M (tested fleet, 80% busy)

~$0.77

~$0.57

60M (2M/day, as modeled)

~$0.74

~$0.54

These figures cover infrastructure only (compute, EKS, networking, and disks), and the savings-plan column assumes the plan covers our sandbox nodes.

For comparison, the per-second sandbox providers we reviewed list between about 17 and 71 cents per 1,000 executions. At our 2027 target of millions of executions per day, our savings-plan pricing lands inside that range without giving up portability or control. Cost made building viable. It wasn't the only reason to do it.

Cost per 1,000 sandbox executions

Executions per month

  • On demand
  • Savings plan
  • Vendor list prices ($0.17–$0.71)
Estimated cost per 1,000 executions. Vendor list prices ($0.17–$0.71).
Monthly executionsOn demandSavings plan
10M$0.85$0.63
25M$0.77$0.57
60M$0.74$0.54

Beyond those costs, there’s maintenance, patching, upgrades, and on-call, which often encourage teams to buy. We decided it’s a fair trade to own those in exchange for control over the boundary that keeps our agentic workloads safe.

Our design

We started by giving sandboxes their own Kubernetes cluster, then connected it to our primary cluster.

Ordinary Temporal workers on the primary cluster keep orchestrating workflows, and when a workflow needs to run a client-facing agent workload, it schedules an activity on a dedicated sandbox task queue. Trusted workers in the new sandbox cluster pick up that activity and run it in a fresh, disposable, isolated VM.

Schedule activity

A workflow on the primary cluster schedules an activity on the sandbox task queue.

This split gave us three benefits:

  • It protects the primary cluster. Sandbox churn stays off our main control plane.
  • Callers don't care where the sandbox lives. A sandboxed activity looks like any other Temporal activity: same names, same arguments, same typed results.
  • We can add capacity and functionality with a new queue. If we ever need more capacity or another runtime, that's a new queue and runtime.

The sandbox itself holds no secrets. Guests get no Temporal, Kubernetes, model-provider, or observability credentials, and no persistent storage. When agent code needs to call a model, it goes through a trusted gateway with a short-lived capability scoped to that one execution. This gateway checks identity, tenant, model policy, and budget before forwarding anything.

Choosing a runtime

We tested three runtimes on Agent Sandbox under the same profile, guest resources, time budget, and isolation checks:

  • Kata Containers with QEMU, a standard VM-based baseline
  • Kata Containers with Cloud Hypervisor (CLH), a smaller, modern virtual machine monitor (VMM) built for cloud workloads
  • gVisor, a userspace kernel between the guest and the host

We left out Firecracker and vendor-specific runtimes such as AWS Nitro Sandboxes. Kata's Firecracker integration needs a block-device snapshotter on every node instead of a shared guest filesystem, which is more to operate. CLH gives us the same small-VMM footprint without that complexity.

All three passed every check in our isolation suite: network, credential, filesystem, cross-execution, and resource-limit boundaries, plus rejection of forged or out-of-policy calls to our model gateway. We confirmed boundary enforcement from the host and kubelet sides too. This wasn’t a full runtime-escape audit, which is part of why the strength of a hardware VM boundary mattered.

We picked the second-fastest runtime on purpose:

Runtime

Early median completion

Completed (of 1,200 executions)

QEMU

7.51s

1,184 / 1,200

CLH

5.87s

1,200 / 1,200

gVisor

3.83s

1,200 / 1,200

These are end-to-end workflow completion times on our experiment runs, including queueing, cleanup, and sandbox start times.

gVisor was the fastest and met our isolation checks, but we picked CLH anyway.

gVisor reimplements Linux system calls in a userspace kernel, but that kernel still runs on the shared host kernel through a filtered set of calls. Kata gives every sandbox a hardware-virtualized VM with its own guest kernel, so a guest exploit still has to get through the hypervisor. For code we've never seen, running next to real-world data, we wanted that extra wall.

CLH also keeps doors open. It's a small Rust VMM with a minimal device model, Virtual Function I/O (VFIO) device passthrough, and CPU and memory hotplug. CLH gave us the appropriate boundary and features for our workloads with performance we can live with.

QEMU gave us the same boundary, but it was the slowest, and it was the only runtime that didn't complete all 1,200 executions in our sustained test. QEMU’s larger feature set was more than we needed.

Learning as we go

Benchmarking surfaced a few lessons and some design considerations.

Our first 10,000-run experiment looked fine until we noticed that routine configuration reconciliation had shrunk our worker pool in the middle of the test. We don’t trust a benchmark until every result reconciles independently against Temporal, so we rebuilt the benchmark in isolation, with pinned images, dedicated queues, and continuous capacity checks to make sure each benchmarking run had a clean slate.

We also found, and reported, a race in the upstream Agent Sandbox controller. It can hand an unused sandbox to a claim, then delete that sandbox from a stale list. A direct delete like that bypasses Kubernetes' disruption protection, so shrinking warm pools on the fly could kill a running execution. For now, we handle it like this:

  • Warm pools never shrink. Each release holds a fixed reserve of unused sandboxes, and consumed sandboxes are replenished automatically.
  • Claimed sandboxes are protected first. Before any input is delivered, each execution gets a disruption budget pinned to its exact sandbox, so node scale-down can't evict it.
  • Everything else still autoscales. Workers and nodes scale up and down around the fixed reserve.

Outlook for scale

Our final experiment run offered 10,000 executions at 12 per second, each in a fresh, single-use microVM:

  • 10,000 of 10,000 succeeded in about 14 minutes, with an average of 11.74 per second including startup and drain
  • Only 36 needed a second attempt (0.36%)
  • Every cleanup was confirmed
  • 12.01 completions per second across an 11-minute steady window; 7,928 completions, with no full minute below 11.82 per second
  • Every result reconciled against Temporal independently

That experiment ran on dozens of runtime nodes with hundreds of concurrent execution slots. Next up: scale-from-idle bursts, a full day of sustained load, and twice the rate. Adding capacity for scale means more nodes and another queue behind the same Temporal activity, so our architecture doesn’t change. Our target for 2027 is to support millions of sandbox executions per day.

Tradeoffs we made

  • We gave up gVisor's speed for a VM boundary and some forward-looking features.
  • We run a second cluster and pay for its idle baseline, so sandbox spikes never touch our main control plane.
  • Warm pools stay fixed until the upstream deletion race is addressed.
  • Executions are at-least-once. A failed attempt reruns in a fresh sandbox.
  • We own the maintenance. Upgrades, patching, and on-call for sandboxing is ours.

What's next

It's an exciting time at Crosby. Client-facing agents are doing real work in isolated environments on a platform we can take anywhere our clients need us, and we’re about to reach new levels of scale. Our next big win will be scaling delightful agentic experiences.

This is just one of the areas the infrastructure team focuses on at Crosby. If running a sandboxing platform, agentic CI/CD, and an internal hosting platform sounds fun, we'd love to hear from you: we're hiring at crosby.ai/careers.

Acknowledgements

Thanks to Steven Lai, Emily Zhang and Alice Li, who built some of the first client-facing agent workflows that run in these sandboxes, and to Zach Krall, who led design and built the client-facing agent experience on top of them.