Pod per agent is the default that starts costing real money

Part of: Agent Runtimes

Pod per agent is how Kubernetes wants you to run AI agents, and it reserves CPU and memory for processes that are mostly idle. When I stop doing that.

Pod per agent is how Kubernetes wants you to run AI agents: one Deployment or Job per agent, with CPU and memory reserved for as long as the pod exists. Agents spend most of their life waiting, so you pay that reservation whether or not a turn is running. I keep the pod for a handful of long-lived agents, and I stop when agent count tracks users or sessions.

The lie is utilization. Those pods look cheap on a CPU graph. They are not cheap on the request. What is Agent Substrate exists because of that line item. This page is when I keep the pod, and when I stop.

Why is pod per agent a problem?

A Pod is a reservation. Kubernetes schedules it, probes it, and holds CPU and memory for it until you delete it. That is the right contract for a web server that should be ready. It is the wrong contract for a process that spends most of its life waiting on a human, a tool, or a model.

Agents are idle most of the time. An always-on pod still requests 50m CPU while it waits. Mine did: about 204 MiB resident and 50m CPU sitting still, per default kagent agent. Nine agents, 450m CPU reserved for nothing, roughly 1.8 GiB resident around the clock. Scale that to one agent per user and you are paying replica-shaped rent for a snapshot-shaped workload.

Hiding the fleet behind an HPA does not fix it. Scale-to-zero is a cold pod boot, not a snapshot restore, and you still needed the reservation for every replica you left running. Scale-up on CPU is the other trap once you move off pods: Substrate workers hosting live turns idle at single-digit mCPU. CPU is the wrong signal to autoscale agents. On pods, CPU looks quiet too. You still pay the request.

NetworkPolicy, Service, PDB, and kubectl logs all assume the workload is the pod. That convenience is why teams stay here. It is also why kubectl is lying to you the moment the workload stops being a pod. Ease of operations is a real cost. Idle reservation is also a real cost. I want both numbers in the design review, not only the one that shows up in a dashboard I already have.

How much does an idle agent pod actually reserve?

A worked example from the cluster I actually ran, not from a vendor slide.

Nine always-on kagent defaults:

  • about 204 MiB resident each
  • 50m CPU request each
  • nine times that is roughly 1.8 GiB resident and 450m CPU reserved, whether anyone is talking to them or not

The same nine agents as Agent Substrate actors shared two worker pods in the first lab. Later I ran 18 agents on those same two workers. Over a thousand real chat sessions. Reserved capacity about 4.5x lower than the same agents as always-on pods. Idle agents were zstd snapshots in object storage. Live turns occupied a worker slot. One actor per worker.

Compare reservation, not usage. The always-on pods barely used CPU. They still reserved it. The two Substrate workers looked like nothing on kubectl get pods. They held the live work. The other agents were on the shelf. Substrate Scope is how I watch that shelf. The lab post has the commands.

If someone else’s abstract claims a different efficiency ratio, treat it as their benchmark. Do not multiply 18:2 out to a fleet you have not measured. Restore, the model queue, and ghost slots all change the shape. How many agents per Kubernetes pod is the sizing post after you switch.

When is one pod per agent still the right design?

When I would keep the pod:

  • Count is in the single digits and will stay there.
  • The process holds a GPU or a session socket. GPUs for agents, suspend-safe networking.
  • I need a Service, a PDB, and a standard HPA, and I do not want a second control plane.
  • Restore latency is unacceptable. Golden snapshot bake is about a minute in my lab. A later restore is faster and still not a warm in-memory process.
  • The team already operates Deployments well, and on-call is pod-native.

That is also the agent-sandbox case: isolate the pod, do not multiplex it. Untrusted tools, one session at a time, no density pressure. You still pay a pod (or a sandbox VM) for each live agent. Isolation gets better. The reservation does not go away.

Keep the pod for three agents that run all day. Introducing snapshot storage, a WorkerPool, ateapi, and a restore path to save two reservations is a worse platform than the idle CPU those two pods waste. I am loyal to not reserving 50m CPU for an agent that is asleep. I am not loyal to multiplexed actors as a religion.

GPU is a hard keep. Substrate checkpoints process memory and files the sandbox owns. GPU memory lives on the device. If the actor held the GPU, suspend would drop that state or pin the device. Both are the opposite of multiplexing. Keep inference outside. The same veto applies to a session socket the sandbox does not own. Suspend cuts TCP in the versions I have run. An agent waiting on a long call cannot be parked.

When should I stop using pod per agent?

Agent count tracks people, tickets, or other agents. Idle time dominates. Snapshot restore is acceptable. Then a kubernetes sandbox platform is the right primitive, and Substrate is the one I have run.

Stop when the ReplicaSet factory shows up in the design doc. One agent per user is not a Deployment. It is a pool plus a snapshot shelf. Size the pool to simultaneous sessions, not to headcount. If you need 50 concurrent chats, you need about 50 workers, plus a buffer so restore storms have somewhere to land. You do not need one always-on pod per registered agent if most of them are waiting.

Stop when the reservation line item is the thing you cannot pay, and you can operate object storage. My kind lab used an in-cluster store. Production is a real bucket, real integrity, real restore latency. Suspend and resume agents is the lifecycle. Running Agent Substrate in production is the ops list. If that list is not boring, you are not ready, and the pod is still honest.

Stop when you are about to “fix” idle cost by packing two agents into one pod. That is a shared shell. You lose isolation and you still have one network identity. Substrate time-multiplexes sandboxed actors. Simultaneous work still equals worker count. Packing without a checkpoint runtime is a noisy-neighbor problem, not density.

What replaces pod per agent?

A worker pool and snapshot-backed actors, which is Agent Substrate. Or a Job-per-turn if you can throw state away. Do not hide a fleet of idle Deployments behind an autoscaler and call it solved.

Substrate’s contract, from the cluster I ran:

  1. A WorkerPool of pre-warmed gVisor sandboxes.
  2. An ActorTemplate for the agent.
  3. On invoke, restore the actor from a snapshot onto a free worker. One actor per worker.
  4. When the session ends, checkpoint back to object storage. Slot frees.
  5. When the pool is full, reject. The caller retries. That is packing, not scheduling. Agent runtimes have an autoscaler, not a scheduler.

You give up a Service per agent, a pod-shaped NetworkPolicy, and kubectl get pods as the fleet view. You keep isolation if you keep one actor per sandbox. You still need proof of agent identity: the worker’s ServiceAccount is the pool, not the agent. You still need sandboxed networking for agents. A multiplexed bay with a broad token is still a broad token.

A checklist I use before I switch:

  • Count agents and idle fraction. Single digits, always busy: keep the pod.
  • Name what the process holds. GPU, host socket, stable IP: keep the pod, or isolate it with agent-sandbox.
  • Confirm object storage is a bucket you already operate.
  • Size workers to max in-flight sessions plus a buffer, not to registered agents.
  • Confirm you have a workers-list view, a rejection counter, and a reset runbook for ghost actors.
  • Confirm identity and egress follow the actor, not the Deployment.

If you are still on one pod per agent because kubectl is easier, read kubectl is lying to you and decide whether ease is worth the reservation. Agent sandbox vs Agent Substrate is the three-way choice. Field guide: Agent Substrate.

Frequently asked questions

Why is pod per agent a problem?

A pod reserves CPU and memory for as long as it exists. Agents spend most of their life waiting. You pay the reservation whether or not a turn is running. Multiplexed actors pay for snapshots plus a small worker pool instead.

When is one pod per agent still the right design?

A handful of long-lived agents, a team that already operates Deployments well, and no plan to scale agent count with users. Also when the process holds a GPU or a socket you cannot park.

What replaces pod per agent?

A worker pool and snapshot-backed actors, which is Agent Substrate, or a Job-per-turn if you can throw state away. Do not hide a fleet of idle Deployments behind an autoscaler and call it solved.

How much does an idle agent pod actually reserve?

On my cluster, each of kagent’s default always-on agents held about 204 MiB resident and requested 50m CPU while doing nothing. Nine of those is roughly 1.8 GiB resident and 450m CPU reserved around the clock.

Is packing multiple agents into one pod the same fix?

No. Sharing a container or a pod without checkpoint and isolation is a noisy-neighbor problem. Substrate time-multiplexes sandboxed actors, one per worker. Simultaneous work still equals worker count.

Disagree or have a war story? Reply on X