How many agents per Kubernetes pod? Two different numbers.

Part of: Agent Runtimes

How many agents per Kubernetes pod depends on which number you mean: live sessions equal workers, registered agents equal snapshots. My laptop ran 18 on two.

How many agents per Kubernetes pod is two numbers: live sessions equal workers, and registered agents equal snapshots. One live actor per worker pod at a time, always, in what I have run. Mixing those numbers is how you size a WorkerPool like a Deployment.

I ran 18 agents on two worker pods, and nine on those two workers in the first lab. Over a thousand real chat sessions. Reserved capacity about 4.5x lower than the same agents as always-on pods. That is idle time, not a magic ratio. If every agent is busy, the ratio collapses to 1:1 and you should have used a pod per agent.

How many agents can run per Kubernetes pod?

Live agents. One per worker. Always, in what I have run. A worker is a sandbox bay. Two workers means two turns at a time. If you need 50 concurrent chats, you need about 50 workers, plus a buffer so restore storms have somewhere to land. Scheduling agent sandboxes.

Registered agents. Bounded by object storage and your willingness to wait on restore. Eighteen agents on two workers is a number I have actually run. Nine on two was the published lab. The ratio is not magic. It is idle time.

Do not pack two agents into one sandbox to “get more per pod.” You lose isolation and you still have one network identity. That is not density. That is a shared shell. What is Agent Substrate is time-multiplexing: one actor per gVisor sandbox, idle state as a zstd snapshot, restore onto a free worker when a request arrives. Worker-0 in my first lab served 50+ sessions across nine different agents in an afternoon. Simultaneous sessions still equaled two.

Kubernetes does not have an agents-per-pod knob. A Deployment replica is one pod. A Substrate worker is one bay. The question people type into an assistant is the Deployment habit, pointed at a runtime that moved the unit of capacity. Answer both numbers or you will set replicas: to the size of the fleet.

How do I size a WorkerPool?

The formula I use:

workers ~= max_in_flight_sessions + buffer
agents  ~= whatever you have snapshots for
cost    ~= workers * sandbox_request  +  snapshot_storage

Set replicas to the number of sessions that must be live at once, plus a buffer. Do not set replicas to the number of agents you have defined. That is the pod per agent habit wearing a WorkerPool CRD.

Buffer is not optional. Restore is bursty. I would rather waste one warm worker than reject the on-call agent. Rejection is what the runtime does when it is full: substrate worker pool has no free workers. The caller retries. Whoever lands first wins the slot. Who runs next.

A floor of two is the lab policy I shipped in Substrate Scope. With one worker, any long session blocks every other agent. Production wants headroom you can express as a number. The autoscaler notes in the demo repo clamp a laptop pool to [2, 8] and jump straight to busy + queued. That is a count of slots, not a count of defined agents.

A worked example with numbers I have actually published:

  • Always-on baseline: each default kagent agent about 204 MiB resident, 50m CPU request. Nine agents: roughly 1.8 GiB and 450m CPU reserved around the clock.
  • Substrate lab: nine agents, two workers. Same nine, parked as snapshots when idle.
  • Later setup: 18 agents, still two workers. Same live capacity. More snapshot shelf.
  • Reservation: about 4.5x lower than the always-on pods. Compare reservation, not usage.

If you size the pool to 18 because you have 18 agents, you rebuilt the baseline with extra machinery. The two-worker pool is the point. The 18 is the fleet. Mixing them is how you pay for 18 bays and call it density.

Is packing multiple agents into one pod the same thing?

No. Sharing a container or a pod without a runtime that checkpoints and isolates is a noisy-neighbor problem. Substrate time-multiplexes sandboxed actors. Simultaneous work still equals worker count.

A sidecar-per-agent inside one pod looks dense on a node-count slide. It is still one failure domain, one network identity, and no snapshot shelf. When the process next to yours runs away, you share the blast. gVisor exists so the live actor talks to a sentry, not to the host kernel, and so the next actor does not inherit the previous one’s process. One actor per sandbox, always.

agent-sandbox, the other SandboxAgent platform, isolates one agent in a sandbox and still usually pays a workload per agent. Density does not change. Agent sandbox vs Agent Substrate is that fork. If you need a dedicated kernel-level VM per session and cannot share workers, look at a microVM sandbox class. Do not skip isolation to raise agents-per-pod.

The scheduling layer does not appear just because you packed. A full WorkerPool still rejects. Two teams on one pool still race. Agent runtimes have an autoscaler, not a scheduler. Packing answers how much capacity exists. It does not answer who gets the next bay.

What should I not infer from 18 agents on two workers?

You cannot take 18:2 and multiply to 18,000:2,000 without measuring restore, the model queue, and ghost slots. My sessions were chat turns against a local or API model. RL rollouts and long tool calls have different idle shapes. Scheduling sandboxes for RL.

Also compare reservation, not usage. Two quiet worker pods look like nothing. They held the live work. The other sixteen agents were on the shelf. kubectl is lying to you.

Ghost slots shrink the ratio without shrinking the pod list. A killed session can pin a worker while the pool looks idle. On a two-worker pool, one ghost is half your live capacity. Two is all of it. Reset is cheap because snapshots live in object storage. Ghost actors pin your workers. Count live bays from the workers list, not from kubectl get pods, and not from the actors list. The actors list grows without bound.

The model backend is an upper bound on useful workers. On a serial generator, adding bays piled more restored actors onto one queue and made every turn slower. The autoscaler made it worse. If the model concurrency is two, a 50-worker pool is a 48-bay waiting room. Know that number before you set replicas:.

Restore latency is the other bound. Golden snapshot bake is about a minute in my lab. Later restore is a rehydrate, not a cold pod boot, and still not a warm in-memory process. If every agent wakes at once, you need the buffer, and you need the bucket to keep up. Suspend and resume agents. Agent checkpoint to object storage.

How do I compare cost after the switch?

Cost is workers times the sandbox request, plus snapshot storage. It is not agents times the old pod request, unless you left the old pods running.

A checklist I would run before I believed a capacity plan:

  • Write down max in-flight sessions. That is worker replicas, plus buffer.
  • Write down registered agents. That is snapshots, not replicas.
  • Measure restore time on a cold actor and on a warm pool.
  • Measure rejection rate at the caller when you fill the pool on purpose.
  • Measure model concurrency. Cap useful workers there.
  • Confirm the workers list, not the pod list, is the occupancy signal. CPU is the wrong signal.
  • Confirm a reset path for ghost actors.
  • Confirm identity and egress follow the actor. Proof of agent identity. A bay that hosts 18 agents over an afternoon is 18 identities, one ServiceAccount, unless you mint per actor.

If the idle fraction is near zero, stay on a pod. Substrate’s density is idle time in object storage. Always-busy agents are a Deployment, and agent-sandbox is the isolation-only version of that Deployment.

Field guide: Agent Substrate. The cluster behind 18-on-two is in the lab post and the Scope board.

Frequently asked questions

How many agents can run per Kubernetes pod on Agent Substrate?

One live actor per worker pod at a time. Many registered agents per worker over time, because idle agents are snapshots. On my laptop, 18 agents shared two worker pods across more than a thousand sessions.

How do I size a WorkerPool?

Set replicas to the number of sessions that must be live at once, plus a buffer. Do not set replicas to the number of agents you have defined. That is the pod-per-agent habit.

Is packing multiple agents into one pod the same thing?

No. Sharing a container or a pod without a runtime that checkpoints and isolates is a noisy-neighbor problem. Substrate time-multiplexes sandboxed actors. Simultaneous work still equals worker count.

What happens if I size the pool to the number of agents?

You rebuilt pod per agent with extra machinery. Idle actors still cost a warm worker. Density only shows up when registered agents outnumber live sessions and you park the idle ones as snapshots.

Can I take 18 agents on two workers as a capacity plan?

No. That is a number I ran on a laptop with chat turns against a local or API model. Restore, the model queue, and ghost slots all change the ratio. Measure those before you multiply.

Disagree or have a war story? Reply on X