substrate README

The project's README from github.com/agent-substrate/substrate. As one markdown file: README.md.

Agent Substrate

License

NOTE: This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.

What is Agent Substrate?

Agent Substrate is a secure-by-default agent execution runtime engineered to run millions of sandboxes with 10x higher density than standard container runtimes. Purpose-built for the era of autonomous agents, Substrate delivers sub-500ms resume operations at over 500 suspend/resume activations per second with native zero-trust kernel and network isolation. It supports multiple sandbox technologies including microVMs and gVisor, enabling consistent lifecycle operations for all sandbox types.

At its core, Agent Substrate maps a larger set of “actors” (applications such as agents) onto a smaller set of ready “workers”, relying on the fact that agent-like applications tend to be idle most of the time to achieve heavy multiplexing. It provides functionality to manage an actor’s lifecycle (e.g. create/destroy, suspend/resume), to assign actors to workers in real time, and to route incoming traffic to them.

Agent Substrate is intended to be a low-opinion system. The workloads it manages don't have to be literal AI agents, but those are the best example of the kind of applications it is designed for. It is not an SDK for building agents, but rather a system for running them at scale.

Agent Substrate leverages Kubernetes for the infrastructure provisioning and worker lifecycle management (Kubernetes Pods). It builds on top of Kubernetes features like Pods and Pod autoscaling, while Agent Substrate provides agent-specific scheduling and control to achieve lower latency. Using Kubernetes as the underlying system enables consistent infrastructure management across all workloads types that are required for end to end agentic deployments and allows holistic infrastructure optimizations for RL scenarios that span agentic, inference and training cycles.

Demo

Agent Substrate Demo

Watch the Agent Substrate cluster multiplex ~250 stateful actors across just 8 physical pods.

This demo highlights the core developer experience and "Agentic Infrastructure" capabilities of Substrate:

  1. Actor Teleport: High-performance suspend and resume of actors onto any available worker in the pool with sub-second activation.
  2. State Persistence: Persistent working memory (volatile RAM) and filesystem state preserved perfectly across hibernation cycles via full-state snapshots.
  3. Agent Multiplexing: Demonstrates 30x+ oversubscription by "juggling" a large registry of stateful actors onto a small pool of shared physical pods.

To reproduce this demo in your own cluster, please refer to the detailed walkthrough in the Counter Demo.

For more videos and walkthroughs, visit our YouTube channel: agent-substrate.

Framework Agnostic & Compatibility

Agent Substrate is designed to be framework and agent harness agnostic. Because it manages standard OCI containers at the kernel level (via gVisor), it can host agents built on any stack.

Ecosystem & Examples

Status and compatibility

Agent Substrate is currently in early development. It is not ready for production use, and the APIs are almost guaranteed to change. We are not making any guarantees about backward compatibility at this stage, and everything in this project may be changed.

Supported Kubernetes Releases

Currently we aim to support the latest stable release of Kubernetes, and the previous minor release.

Community

For announcements, technical discussions, and community support, please join the ate-dev Google Group.

We host a weekly community meeting every Thursday from 10:00am - 11:00am PST.

We also have channels in the CNCF slack; request an invite here if you don't have access.

Developing

Please see CONTRIBUTING.md for guidelines on contributing to the project. We welcome contributions of all kinds, but the project is VERY young. Our immediate focus is on building out the core system and demos, so we may not be able to review or merge contributions that don't align with those goals in the near term.

Quickstart (Development)

To quickly set up the complete environment:

  1. Make sure you have Go, kubectl, and docker installed and configured on your dev machine. We will automatically manage other dependencies via Go, including kind.

  2. Run the following steps:

# create cluster and local registry (IPv4; IP_FAMILY=dual|ipv6 overrides)
hack/create-kind-cluster.sh

# install ate, PostgreSQL, rustfs
hack/install-ate-kind.sh --deploy-ate-system

# install counter demo
hack/install-ate-kind.sh --deploy-demo-counter

# install kubectl-ate
go install ./cmd/kubectl-ate

# create a counter actor in the demo's atespace (--template names the
# actor template, resolved in the actor's atespace)
kubectl ate create actor my-counter-1 -a ate-demo-counter --template counter

# port-forward the network router to bind to local port `8000`
kubectl port-forward -n ate-system svc/atenet-router 8000:80
  1. In a separate terminal, send an HTTP request to increment the counter:
curl -X POST \
   -H "ate-target-actor: ate-demo-counter/my-counter-1" \
   -i http://localhost:8000/

Worker capacity is versioned: the dataplane (the atelet DaemonSet and the worker pods) schedules only on nodes that carry the ate.dev/substrate-version label, and the install stamps it on every node that exists when it runs. A node added later hosts no workers until you label it with the installed version (kubectl label node <node> ate.dev/substrate-version=<build version>). kubectl get ds -n ate-system -l app=atelet -L ate.dev/substrate-version prints the installed version, off the atelet DaemonSet the install created.

GKE Quickstart (Development)

  1. Create and configure your environment file:

    cp hack/ate-dev-env.sh.example .ate-dev-env.sh
    
    # Edit .ate-dev-env.sh to match your project and preferences, then source it:
    source .ate-dev-env.sh
    
  2. Enable application-default credentials for gcloud:

    gcloud auth application-default login --project=${PROJECT_ID}
    
  3. Provision the required GCP resources (GKE cluster, GCS, and IAM bindings):

    go run ./tools/setup-gcp bootstrap
    

    On a fresh project this step also creates the atelet Workload Identity IAM grants that snapshots depend on — see what create iam actually grants to audit them or apply them manually. If you bring your own cluster instead, note the required Kubernetes beta APIs can only be enabled at cluster creation — see the Create Cluster warning.

  4. Deploy the Agent Substrate system to your cluster:

    ./hack/install-ate.sh --deploy-ate-system
    

    Nodes that GKE adds later (autoscaling, auto-repair, node upgrades) are born with the node pool's labels, so the pool needs ate.dev/substrate-version too; see Node version labels.

  5. You can then deploy the sample applications. See demos/counter/README.md or demos/sandbox/README.md for detailed walkthroughs.

    ./hack/install-ate.sh --deploy-demo-counter
    

Custom Setup and Deployment

You can run individual setup steps to create GCP resources as needed. See go run ./tools/setup-gcp --help for available options. For example:

go run ./tools/setup-gcp create cluster
go run ./tools/setup-gcp create bucket

To run the PostgreSQL store backend on Cloud SQL — with IAM database authentication and no passwords — see tools/setup-gcp/cloud-sql.md.

Similarly, you can deploy or cleanup specific Agent Substrate components using the installation script. See ./hack/install-ate.sh --help for all options.

# Re-deploy only ate-apiserver of the ATE system
./hack/install-ate.sh --deploy-ate-apiserver

# Delete everything (core system and all demos)
./hack/install-ate.sh --delete-all

Tearing down resources (GCP)

If you need to delete the resources created by the setup script, you can use the provided script hack/teardown.sh. This script will delete resources in the reverse order of creation and handles partial failures gracefully.

./hack/teardown.sh --all

Or run individual teardown steps as needed (see ./hack/teardown.sh for available options).

Tearing down local kind resources

If you need to delete the local kind cluster and its registry (if it was created by hack/create-kind-cluster.sh):

./hack/delete-kind-cluster.sh

Demos

We provide several sample applications demonstrating Agent Substrate's capabilities:

  1. Counter Demo: A stateful Go HTTP server demonstrating state preservation across suspends/resumes, and on-demand actor resumption and routing via the Substrate router.
  2. Sandbox Demo (Antigravity): A secure, sandboxed execution environment (running Alpine Linux) that allows arbitrary shell execution while preserving filesystem state across sessions.
  3. Claude Code Multiplex: Demonstrates oversubscribing physical hardware by multiplexing multiple Claude Code agents onto a limited pool of workers.
  4. Multi-Template: Two ActorTemplates running different binaries share one WorkerPool, even though the templates live in different atespaces.
  5. Request Parking: An oversubscribed pool where the router holds inbound requests until a worker frees up, instead of returning 503.
  6. Autoscaled WorkerPool: Scales a WorkerPool on its assigned-worker count with an HPA fed by prometheus-adapter.

Documentation & Guides

Tour

Commands

substrate (agent-substrate/substrate)

Searching Database…

这是什么?一个默认安全的运行时,用于在隔离的沙箱中托管 AI 智能体——可以是 microVM 或 gVisor 容器——并在共享基础设施上同时运行数百万个这样的沙箱,密度远高于普通容器运行时。
它是用来构建智能体的框架或 SDK 吗?都不是——它是用于大规模运行智能体的基础设施层,而不是构建智能体的工具。它构建在 Kubernetes 之上,复用 Pod 和自动伸缩能力,并在其上增加了面向智能体的调度和流量路由。
我该怎么把它跑起来?安装 Go、kubectl 和 Docker——kind 会自动帮你管理——然后按照开发快速入门搭建一个本地集群。如果要部署到 GKE,tools/setup-gcp 会自动创建集群、GCS 和 IAM 配置,再用 hack/install-ate.sh 部署整个系统。
它能实际运行哪些智能体技术栈?几乎都能运行:它管理的是标准 OCI 容器,所以可以托管用 Google ADK、LangChain、Claude Code、CodeX 和 Antigravity 构建的智能体,还能把 MCP 服务器作为带持久状态的沙箱化 actor 来部署。
我现在能把它用到生产环境吗?不能——它还处于早期开发阶段,明确不适合生产环境,API 几乎肯定会变动,而且不保证向后兼容。目前只支持最新稳定版的 Kubernetes 及其前一个版本。
它是怎么在有限的硬件上塞下这么多沙箱的?智能体类应用大部分时间都处于空闲状态,所以 Substrate 把大量 actor 映射到一小组随时待命的 worker 上——挂起和恢复耗时不到 500 毫秒,每秒可完成 500 多次激活。演示中只用 8 个物理 Pod 就同时运行了约 250 个有状态 actor,超卖比例超过 30 倍。
智能体被挂起后会丢失记忆或文件吗?不会——挂起时会做一次完整状态的快照,同时保留运行中的内存和文件系统,所以 actor 恢复后能精确地从上次中断的地方继续,即使它被迁移到资源池中另一台 worker 上也一样。
它只适合用来跑 AI 智能体吗?不是——它的设计刻意保持中立:运行的工作负载不一定非得是真正的 AI 智能体。任何大部分时间空闲、又需要快速唤醒和强隔离的应用都适用;智能体只是它最典型的示例,文档也是最完善的。
What are similar projects?ax, OpenSandbox, encore, dapr, CubeSandbox, skills, opensre, agents-cli
Size
45.5 MB
Stars
5.6K
Age
5mo
Commits · 90 Days