Kubernetes · availability: high

High availability, in four ideas

Stateless services run twice. The database runs three times. Agents keep their memory in the database, so any process can die and another one picks up the work.

Two of everything statelessWeb services run 2 copies in different zones.
Database in three zonesEach write is copied to a second zone before it counts.
One owner per Agent shardA database lock makes sure only one process runs a shard.
Replace fast, resume from rowsA lost process comes back in ~90 s and continues where it stopped.

The layout

Three zones. Lose any one and the other two keep the platform running.

Load balancer · Gateway · DNS (customer) Zone A Zone B Zone C Web servicescopy 1 Web servicescopy 2 spare room for replacements Agent shard 1single owner Agent shard 2single owner Sandbox runnerone dedicated node Database · primarytakes writes Database · standbyconfirms each write Database · standbyready to take over Redis · Search Knowledge vectors File storage (or external S3)
2 copies 1 owner, fast takeover replicated database single copy

Four kinds of components

Each kind recovers differently.

2 copiesStateless services

Gateway, ControlTower, SecondGate, Chat, Agent web/worker/scheduler. One dies, the other serves.

3 instancesDatabase

A standby is promoted in ~20 s. No committed data is lost.

1 owner + lockAgent shard owners

Replaced after 30 s. The lock stops two owners at once.

1 copyEverything else

Sandbox runner, search, vectors, Redis, egress proxy. Waits for its node or zone.

How Agents stay available

Processes hold no memory. The database holds every turn, so a process is just a replaceable worker.

REPLACEABLE PROCESSES Agent web ×2accepts messages Agent workers ×2drive each turn Shard owner 1runs the model loop Shard owner 2runs the model loop lock lock DURABLE MEMORY Database (3 zones) Every message admitted to a turn Every step the turn has finished Conversation history and stream position Which process owns which shard Queue of turns waiting for capacity → a new process reads this and continues
Running turns pause, not fail

They resume from their last saved step.

No double answers

Each turn has one id; a retry can't start it twice.

Half stays up

Two shards in two zones: a zone loss pauses only one.

When a shard owner's node dies

About 90 seconds from failure to resumed turns, measured in zone-loss drills.

0 s Node diesturns on shard pause ~30 s after New owner startson a healthy nodewaits for the lock ≤ 60 s Old lock releaseddatabase drops thedead connection ~90 s Turns resumefrom saved steps If the old owner is only cut off (not dead), it notices within 1 s and stops itself.

What happens when…

A Pod crashes
no outage

The other copy serves. Restarts in seconds.

A node is lost
mostly fine

Agents on that node pause ~90 s.

A zone is lost
2–3 min

Worst case when the database primary is there. No data lost.

The sandbox node is lost
outage

Agent workspaces wait until the node returns.

Upgrade or backup
planned

Full downtime, by design.

Not covered yet

Sandbox runner — one node holds all workspaces
Search, vectors, Redis — one copy each
Egress proxy, Claude Code service — ~5 min on node loss
New chats — can be placed on a paused shard and wait