跪拜 Guibai
← All articles
Cloud Native

Google's Agent Substrate Packs 250 Stateful Agents onto 8 Pods by Treating Sandboxes Like Event Loops

By 瀛川 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Running one Kubernetes pod per AI agent is economically unworkable at scale because idle agents still consume CPU and memory. Agent Substrate proposes a concrete architecture to oversubscribe resources by snapshotting idle agents to disk, a pattern that could slash infrastructure costs for any platform hosting millions of stateful, bursty sandboxes.

Summary

Agent Substrate tackles the cost of idle, stateful AI agents in Kubernetes by treating each sandboxed agent like a promise in an event loop. When an agent goes idle, its full memory, filesystem, and kernel state is snapshotted to cheap object storage and the pod resources are freed. An inbound request triggers a restore onto any available worker pod in under a second, bypassing the standard Kubernetes control plane entirely.

The architecture draws a direct line from Microsoft Orleans virtual actors and Knative scale-to-zero, but pushes the concept down to the gVisor sandbox level. A lightweight proxy intercepts traffic, and a Redis-backed control plane handles the high-frequency state churn that would crush etcd. The design targets 1 billion actors per cluster, 100ms P95 activation latency, and 1,000 wake-ups per second, though no benchmarks yet exist.

This is a research-stage project with unstable APIs and a hard dependency on GCP/GKE. It does not replace Kubernetes but sits on top as a specialized orchestration layer for agent-like workloads, much like Knative does for serverless containers.

Takeaways
Idle agents are snapshotted at the gVisor sandbox level—memory, filesystem, and kernel state—and stored in object storage, freeing the worker pod entirely.
A lightweight proxy called atenet intercepts inbound requests and triggers a restore onto any available worker, not necessarily the original one.
The control plane bypasses the Kubernetes API server and etcd, using Redis/Valkey to handle high-frequency actor state changes at much higher throughput.
Design targets are 1 billion actors per cluster, 100ms P95 activation latency, and 1,000 wake-ups per second, but no public benchmarks confirm these numbers yet.
The project is in very early development, with unstable APIs and a current hard dependency on GCP/GKE for snapshot storage.
Agent Substrate is positioned as an upper-layer orchestration add-on for Kubernetes, not a replacement for the core control plane, similar to Knative's role for serverless workloads.
Conclusions

Treating a VM sandbox like a stack frame in an event loop is a useful mental model, but the millisecond-level context-switch cost means snapshots only make economic sense for agents with long idle periods, not for rapid back-and-forth interactions.

The decision to use Redis instead of etcd is a deliberate trade of strong consistency for raw throughput. This shifts the burden of correctness—conflict resolution, failure recovery, state reconciliation—onto the application layer, which is a significant engineering risk for a system targeting 1 billion actors.

By offloading suspended state to object storage, the system's capacity ceiling moves from RAM to storage bandwidth and restore throughput. This is the same insight behind serverless cold starts, but applied to stateful, long-running agents rather than stateless functions.

The project's deep coupling to GCP/GKE via GCS for snapshots limits its immediate relevance for multi-cloud or on-premise deployments, but the architectural pattern—a Redis-backed control plane plus sandbox snapshotting—is portable in principle.

Concepts & terms
gVisor Checkpoint/Restore
A mechanism to freeze a running sandbox's full state—memory, file system, and kernel data structures—into a file, and later restore it to resume execution, potentially on a different machine.
Virtual Actor Model
A concurrency pattern, popularized by Microsoft Orleans, where a logical actor's lifetime is decoupled from any physical process. The runtime automatically activates and deactivates actors, persisting their state between activations.
Scale-to-Zero
A serverless pattern where an application instance is completely de-provisioned during idle periods and re-created when a request arrives, reducing resource costs to near zero when not in use.
atenet
A lightweight network proxy in Agent Substrate that intercepts inbound requests for suspended actors and triggers the snapshot restore process before forwarding traffic.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗