What is agent substrate and why did Google build it?
- Posted
- Tags
- ai, agents, kubernetes
An AI agent spends most of its session waiting, so giving each agent its own pod pays for a lot of idle capacity. Agent substrate puts many sandboxed agents on a smaller pool of pods and saves an idle agent's memory and files to storage, so it can wake up on any free worker. Google says that wake up takes under half a second.
I was scrolling through YouTube shorts when I tumbled onto a KodeKloud short about agent substrate. I had never heard the term, and the problem it solves is one I had not thought about at all.
The question I had
What is agent substrate, and why did Google build it? Why isn't one pod per agent good enough?
What I found
Why every agent needs a sandbox
Say a company gives an AI coding agent to 10,000 developers. Each agent runs code that nobody reviewed. So each one needs its own isolated sandbox, so it can't wander outside it and do whatever it wants on the server.
On Kubernetes, the simple way is one pod per agent.
Why one pod per agent gets wasteful
An agent waits most of the time. It sends a prompt to the model and waits for the answer. It asks a teammate to approve a change, and the teammate might not be around. Google says an agent spends 90 to 95% of a session just waiting. With one pod per agent, I pay for 10,000 pods and most of them are doing nothing.
The obvious fix is to delete the pod while the agent waits and make a new one later. But the agent has files it edited, commands that were still running, and things it was holding in memory about what it was doing. Saving the files alone doesn't bring that all back. Starting from scratch can take more than 20 seconds, according to Google.
The idea: separate the agent from the pod
Agent substrate runs on top of Kubernetes and keeps a smaller pool of pods already running. These pods are called workers, and each worker can run many agents in separate sandboxes. Kubernetes only sees the pod. Substrate keeps track of the agents inside it.
Each agent session is called an actor. When an actor is idle, substrate saves its memory and files to storage and frees the space. When the agent has work again, substrate brings it back on a free worker.
| One pod per agent | Agent substrate | |
|---|---|---|
| Pods running | One per agent, even when idle | A smaller pool of workers |
| While an agent waits | The pod stays up, mostly idle | State saved to storage, space freed |
| Isolation | The pod boundary | A sandbox per agent inside a shared pod |
| Coming back | Start from scratch, 20+ seconds | Restore state, under 500 ms |
(Both timings are Google's numbers.)
How a sleeping agent wakes up
Say a teammate comes back and approves the agent's action:
- The message reaches the substrate router. The agent's actor is asleep.
- The router holds the message and tells the substrate controller.
- The controller finds space on a worker that is already running.
- The agent's memory and files are restored from storage onto that worker.
- The agent continues exactly where it stopped.
What keeps two agents apart in the same pod
Each actor runs in its own sandbox, using technology like gVisor. Normally containers share the machine's Linux kernel. gVisor sits between the agent's code and the real kernel, so the code can't reach the host kernel directly. Substrate also controls network access, so one agent can't just connect to another.
The savings
Google says substrate can run about 10 times as many agents on the same hardware compared to normal containers. In one demo, around 250 agent sessions ran on just eight pods.
Every number here comes from the short and is Google's claim. I didn't check any of them against something Google published.
What if an agent needs a lot of CPU?
The savings rest on agents waiting 90 to 95% of the time. But some moments aren't waiting. Say an agent is running the full test suite on the code it just changed, or building a big project. That can use a lot of CPU for minutes. If ten agents on the same worker do that at once, they compete for the same pod's CPU and memory and everyone slows down. This is the classic noisy neighbor problem.
So would a dedicated pod help? I think so, for those moments. A few ways I can imagine handling it:
- Cap the CPU and memory each sandbox can use, so one agent can't starve the others.
- Put heavy agents on their own workers, away from the light ones.
- Run the heavy job somewhere else. The agent goes to sleep, a separate short-lived pod runs the tests, and the result wakes the agent back up. From the agent's point of view, waiting on a test run is just more waiting.
The third one fits the idea best, since it keeps the agent itself cheap and gives the heavy work the resources it needs.
The short didn't cover any of this. I don't know which of these substrate supports, so this is my own reasoning, not what Google says. I'd also guess the 10x figure assumes agents that mostly wait, and a CPU heavy workload would pack less tightly.
Takeaway
Agents are idle most of the time, so tying one to a running pod wastes it. The trick is to tie an agent to its saved state instead and let any free worker pick it up. Sandboxing keeps that safe enough to share, though it reduces the risk and doesn't remove it. Packing only pays off while agents mostly wait, so heavy jobs like a big test run may still deserve a pod of their own. It is another example of the harness around the model doing the real work, and of the runtime question I touched on in should you run everything on Kubernetes.