Operating, Isolating, and Scaling Agent Workloads on Kubernetes w/ Agent Substrate - Open Source

One agent is a deployment. A platform full of them is a different problem. Run as ordinary pods, every agent holds its memory while it waits for the next message, carries a provider key it can read, calls the provider directly, and shares the node's kernel with every other team's agents.

This open source solution shows you how to run agents on kagent and Agent Substrate, so that each session is its own sandbox that holds no memory between turns, no agent ever holds a key, and every model and tool call goes through agentgateway. Every component is open source, and the whole stack installs with one command.

‍

Eight agents either way: eight pods, or two workers and an object store.

‍

‍

Common challenges
‍

• Idle agents that still hold a pod

An agent waits for a person, thinks for thirty seconds, calls a few tools, and goes quiet again. Run as a pod per session it holds its memory the whole time, whether or not anything is happening inside it.

‍

• The key in the agent's environment

A provider key in an environment variable is readable by anything that can read the process, including the code the model asks the agent to run. Every agent that holds one is a place for it to leak from.

‍

• One kernel, every team

Pods on a node share its kernel. An agent that runs code it was handed by a model is one container escape away from every other team's agents on that node.

‍

• No place to stand

Each agent calls its provider directly, so there is no single place to authenticate agents, stop a runaway job, decide where an agent may send data, or say which team spent what.

‍

‍

‍

What you build
Diagram of Kubernetes agent deploying actors in worker pods, interacting with LLM providers, MCP servers, and other agents.
Solution Architecture – Scaling Agent Workloads on Kubernetes (Coming Soon)

‍

‍

  • One command to a running stack. kagent install brings up kagent, Agent Substrate and PostgreSQL together, and the guide then shows what it built and what to harden.
  • One sandbox per session. Each session is an Agent Substrate actor in its own gVisor sandbox. It is restored from a snapshot when a message arrives and suspended when the turn ends.
    ‍
  • Memory follows turns, not sessions. A suspended session holds no memory, only a snapshot of its volumes. Workers are sized for the turns in flight at your busiest moment, not for every session open.
    ‍
  • No agent holds a key. The agent is given a placeholder. Substrate's egress gateway puts the real credential on the request after it leaves the sandbox, and the provider key itself is stored once, in the gateway.
    ‍
  • One way out, with a cap. Every model and tool call goes through agentgateway, each agent may reach only the destinations its egress policy allows, and each team's tokens are capped per hour.
    ‍
  • Sign-in and session ownership. The UI and API sit behind single sign-on with your identity provider, and a session belongs to the user who started it.
    ‍
  • A trace for every turn. Each turn is traced from the controller to the provider and kept in your cluster, with the session, the user and the tokens on it, and access to traces governed like everything else.

‍

‍

What you can answer afterwards

  • What does an idle agent cost us while nobody is talking to it?
  • Can an agent read its own provider key?
  • Where is each agent allowed to send data?
  • How many tokens can a team spend in an hour?
  • How many workers do we need for our busiest hour?

‍

‍

Capability Open source Solo Enterprise
Run and scale
Sandboxed execution by default, with gVisor and microVM support✓✓
Idle sessions suspended to snapshots and restored on demand✓✓
High-density shared worker pools, autoscaled through Kubernetes HPA✓✓
Claude Code and Codex harnesses alongside declarative agents✓✓
Checkpoints, session forking and scheduled runs✓✓
Isolate
Credentials injected at egress: no provider key in the agent✓✓
Inbound and outbound agent traffic through agentgateway, under policy✓✓
Actor identity, with mTLS on ingress and egress✓✓
Govern
Single sign-on through OIDC (Keycloak, Entra ID, Okta), verified by kagent✗✓
Catalog access control by user and group✗✓
Daily token budgets per team✗✓
Operate
Agent trace integration✓✓
Telemetry storage, analytics and health dashboards✗✓
Per-agent analytics: wake-up latency, cold starts, request volume✗✓
Live view of Substrate and agent lifecycle, with checkpoint browsing✗✓
Deploy and support
Runs on older Kubernetes, without the beta certificate APIs✗✓
Specialty builds for security patches and compliance, including FIPS✗✓
Enterprise production support✗✓

‍

‍

Common questions

Q. How do I run many agents on Kubernetes without a pod per agent?

Run them as actors on a shared worker pool. With Agent Substrate each session is restored onto a warm worker when a message arrives and suspended to an object store when the turn ends, so only sessions that are working occupy memory. A suspended session holds no memory, only a snapshot of its volumes.

‍

Q. Does Agent Substrate use less memory than a pod per agent?

No, and the guide says so. A pod per agent uses less memory, but it shares the node's kernel and keeps every session of that agent in one process. Against a pod per session, which isolates sessions the way Substrate does, Substrate holds memory only for the sessions that are working.

‍

Q. How do I keep provider API keys out of agent containers?

Give the agent a placeholder and inject the credential outside it. kagent hands the agent a placeholder value, Substrate's egress gateway swaps it for the agent's gateway key on the way out, and the gateway holds the provider key. In the validated deployment the agent's environment held only the placeholder, and a search of its sandbox and of its suspended snapshot found neither key.

‍

‍

‍

‍

‍