DEV Community

Agent Substrate Explained: A Beginner's Guide to Running Multiple AI Agents Efficiently

1. Introduction: Why Do We Need Agent Substrate?

Imagine you are building an AI chatbot application.

You have 1,000 users, and every user has a personal AI agent.

Each agent has its own:

  • Conversation history
  • Memory
  • Files
  • Running processes
  • Application state
  • Configuration

A straightforward approach would be to create one Kubernetes pod for every user.

For example:

User 1     → Agent Pod 1
User 2     → Agent Pod 2
User 3     → Agent Pod 3
...
User 1000  → Agent Pod 1000
Enter fullscreen mode Exit fullscreen mode

This approach works, but it creates a significant infrastructure problem.

Most users are not continuously interacting with their agents.

For example:

  • Alice sends a message and leaves.
  • Bob asks a question and returns after 30 minutes.
  • Charlie starts a coding task and comes back after an hour.

Even when users are inactive, their Kubernetes pods may continue consuming CPU and memory.

This results in:

  1. High infrastructure costs.
  2. Wasted CPU and memory resources.
  3. Difficulty managing thousands of pods.
  4. Complicated infrastructure scaling.

So, how can we run thousands of AI agent sessions without running thousands of pods continuously?

This is the problem that Agent Substrate aims to solve.

2. What Is Agent Substrate?

Agent Substrate is a Kubernetes-based infrastructure platform designed to run multiple stateful AI agent sessions using a smaller pool of worker pods.

Instead of keeping every agent active continuously, it supports a lifecycle where an agent can be:

  1. Started.
  2. Suspended.
  3. Saved as a snapshot.
  4. Restored when another request arrives.

Think of putting your laptop into sleep mode.

When you stop using your laptop, you don't need to keep performing active work. When you open it again, you can continue.

Agent Substrate applies a similar concept to AI agent sessions.

Its main objective is to separate an agent's state from the Kubernetes pod where the agent runs.

This allows many logical agent sessions to share a limited number of worker resources.

3. Understand the Four Fundamental Concepts

Before understanding the architecture, let's understand four important terms.

3.1 Actor – Your Individual AI Agent Session

An actor represents one individual stateful workload.

Imagine three users:

  • Alice has her own AI conversation.
  • Bob has his own AI conversation.
  • Charlie has his own AI conversation.

Each conversation can be represented by an individual actor.

An actor contains the state associated with its workload, such as:

  • Memory
  • Files
  • Root filesystem
  • Running processes

An important distinction:

An actor is a logical resource stored in PostgreSQL. It is not itself a Kubernetes pod or Kubernetes object.

3.2 Worker – The Place Where an Actor Runs

A worker is a Kubernetes pod that provides the environment in which actors execute. One Worker Pod can host multiple Actors, provided it has sufficient resources and the configured runtime supports the required concurrency.

Think of a worker as a computer capable of hosting isolated workloads.

For example:

Worker Pool
    |
    |--- Worker Pod 1
    |       |
    |       |--- Actor Alice
    |
    |--- Worker Pod 2
    |       |
    |       |--- Actor Bob
    |
    |--- Worker Pod 3
            |
            |--- Actor Charlie
Enter fullscreen mode Exit fullscreen mode

A WorkerPool is the Kubernetes resource that manages the worker pods.

The number of workers is configured through the pool.

How does it work?

Imagine Worker 1 has:

  • 8 GB RAM
  • 4 CPU cores

It might run multiple actors, depending on their individual resource requirements and sandbox configuration.


For example:

Actor   RAM usage
Alice   1 GB
Bob 2 GB
Charlie 1 GB
Total   4 GB
Enter fullscreen mode Exit fullscreen mode

The remaining 4 GB can be used by other workloads or actors, subject to overhead and resource limits.

What happens when Alice becomes inactive?

  1. Agent Substrate suspends Alice's actor.
  2. Alice's state is saved as a snapshot.
  3. Her sandbox stops.
  4. The resources she was consuming become available.
  5. Worker 1 can run another actor.

Actor ≠ Worker

  • One Actor represents an individual agent session.
  • One Worker is the compute environment that can host multiple actors. The exact number of actors per worker depends on resource capacity, sandbox configuration and runtime limits; it is not a fixed number.

3.3 Snapshot – A Saved Copy of the Actor's State

What happens when an actor stops running?

Will it lose all its memory and files?

Not necessarily.

Agent Substrate supports saving an actor's state as a snapshot.

A snapshot is a saved representation of an actor at a particular point in time.

When the actor needs to run again, the snapshot can be restored.

Think of saving a document before closing your computer.

When you open it again, you can continue from where you stopped.

3.4 Atespace – A Logical Group of Actors

An atespace is a named group that contains related actors, templates and access policies. An Atespace is required to group related actors and manage them as one logical unit.

Think of it like a project folder or workspace for AI agents.

For example:

Atespace: customer-support
    |
    |--- Actor Alice
    |--- Actor Bob
    |--- Actor Charlie

Atespace: coding-assistant
    |
    |--- Actor Developer-1
    |--- Actor Developer-2
Enter fullscreen mode Exit fullscreen mode

Imagine your infrastructure runs three applications:

Atespace: Customer Support
Actor 101
Actor 102
Actor 103

Atespace: Research Assistant
Actor 201
Actor 202

Atespace: Coding Assistant
Actor 301
Actor 302
Enter fullscreen mode Exit fullscreen mode

Atespaces also provide an important access-control boundary. Each application has its own logical grouping, permissions, and policies.

How permissions and policies work together
Let's take a real example.

Bob wants to create a new customer-support actor.

Request: Create actor
User
Bob

Atespace
customer-support

Requested memory
2 GB

Requested CPU
1 CPU

Step 1 — Permission check

Bob has the Editor role in customer-support, so the request is authorized, assuming Editor includes actor creation.

Step 2 — Policy check

The Atespace permits up to 2 GB memory and 1 CPU per actor. The request meets those limits.

Request can proceed
The platform can now attempt to create the actor, subject to available infrastructure resources.
Enter fullscreen mode Exit fullscreen mode

Now imagine Bob requests 16 GB of memory.

His permission is still valid, but the resource policy rejects the request because it exceeds the configured limit.

This is the key distinction: permissions authorize the user; policies constrain the operation.

4. How Do Actors, Workers and Snapshots Work Together?

Let's assume you have:

  • 1,000 users.
  • 1,000 individual actors.
  • 10 worker pods.

At a particular moment:

  • 10 actors are running.
  • 990 actors are suspended.

The 10 active actors use the available worker capacity.

The remaining 990 actors are represented by their saved snapshots and metadata records.

When Alice sends another request:

  1. Agent Substrate identifies Alice's actor.
  2. It checks the actor's current state.
  3. It finds an available worker.
  4. It restores the actor's snapshot.
  5. The actor starts running.
  6. The request reaches the actor.
  7. The actor processes the request and returns the response.

When Alice finishes, the application can request suspension.

The worker resources are then released.

This is the fundamental architecture of Agent Substrate.

Important: Agent Substrate does not automatically suspend every idle actor in version 1.0.0. Your application or agent framework must call the suspend operation.

5. What Does Agent Substrate Actually Manage?

Agent Substrate standardizes several infrastructure responsibilities.

5.1 API Management

It provides APIs to manage:

  • Actors
  • Actor templates
  • Worker pools
  • Snapshots
  • Atespaces
  • Access policies

The main control-plane API is ate-api-server.

Developers can interact with it using the kubectl ate command-line tool.

5.2 Actor Lifecycle Management

An actor has different lifecycle states.

The important operations include:

Operation Purpose
CreateActor Create a new actor
ResumeActor Start or restore an actor
SuspendActor Save the actor and stop its sandbox
RevertActor Restore an actor from its saved state after a failure
DeleteActor Remove an actor

5.3 Request Routing

When a user sends a request, Agent Substrate routes it to the appropriate actor.

The router is called atenet-router.

It identifies the target actor and communicates with the control plane to ensure that the actor is running before forwarding the request.

5.4 Execution Isolation

Actors execute inside supported sandbox environments.

Agent Substrate 1.0.0 supports:

  • gVisor
  • microVM

These provide isolation between workloads.

5.5 Network Access Control

Agent Substrate supports egress policies.

These policies determine which external destinations an actor can access.

For example, you can allow an actor to access an approved LLM API while blocking other external destinations.


PART 2: HOW AGENT SUBSTRATE SAVES STATE

6. Where Does Agent Substrate Store an Actor's State?

This is one of the most important architectural concepts.

Agent Substrate uses two primary storage systems:

  1. PostgreSQL
  2. Object storage

They have different responsibilities.

6.1 PostgreSQL – Stores Actor Metadata

PostgreSQL stores information about actors.

For example:

Actor ID: 12345
Actor Name: alice-agent
Atespace: customer-support
Status: SUSPENDED

Snapshot:
    Generation: 3
    Fidelity: MEMORY
    Storage State: COMPLETED

Snapshot URI:
    gs://ate-snapshots/...
Enter fullscreen mode Exit fullscreen mode

PostgreSQL stores information such as:

  • Actor identity
  • Actor status
  • Actor configuration references
  • Snapshot metadata
  • Snapshot location
  • Worker assignments
  • Actor templates
  • Access policies

Think of PostgreSQL as the index or catalogue of your actors.

It tells Agent Substrate where an actor's snapshot is stored.

6.2 Object Storage – Stores Actual Snapshots

Object storage contains the actual snapshot data.

For example:

Object Storage
    |
    |--- atespaces/
            |
            |--- customer-support/
                    |
                    |--- actors/
                            |
                            |--- actor-uid/
                                    |
                                    |--- snapshots/
                                            |
                                            |--- snapshot-uuid/
Enter fullscreen mode Exit fullscreen mode

A snapshot can contain files representing:

  • Durable volumes
  • Filesystem changes
  • Memory checkpoint data
  • Process state

The exact contents depend on the selected snapshot fidelity.

In the manual's local Kubernetes setup, RustFS provides S3-compatible object storage.

The snapshot URI uses a gs:// scheme in the example, but that does not mean the local installation is necessarily using Google Cloud Storage.

6.3 Local Worker Disk – Temporary Snapshot Storage

There is also a third location.

The worker node can hold a local copy of the snapshot.

Why?

Because uploading a large snapshot to remote object storage takes time.

Agent Substrate can first save the snapshot locally and upload it later.

This makes the asynchronous suspend operation faster.

Therefore, remember these three storage locations:

Storage What it contains
PostgreSQL Actor metadata and snapshot references
Object storage Durable snapshot data
Worker node disk Temporary local snapshot and cache

7. How Does Agent Substrate Create a Snapshot?

Let's understand with a practical example.

Suppose Alice is using an AI coding assistant.

Her agent has:

/agent/
    project/
        app.py
        requirements.txt

Memory:
    Current conversation
    Python variables
    Running processes
Enter fullscreen mode Exit fullscreen mode

Alice asks:

"Create a Python application."

The agent creates files and performs some operations.

Now Alice closes the application.

Your application decides to suspend the actor.

Here is what happens.

Step 1: SuspendActor Is Called

Your application calls:

SuspendActor
Enter fullscreen mode Exit fullscreen mode

This tells Agent Substrate to save the actor's state and stop its sandbox.

Step 2: The Sandbox Captures Its State

The selected runtime captures the requested state.

Depending on the fidelity, this can include:

  • Files in configured durable volumes.
  • Changes to the container filesystem.
  • Process memory and running processes.

Step 3: Snapshot Files Are Created

The sandbox runtime generates checkpoint data.

For example, in the gVisor memory-snapshot implementation, files include:

pages.img
checkpoint.img
pages_meta.img
Enter fullscreen mode Exit fullscreen mode

The exact files depend on the runtime and snapshot implementation.

pages.img is particularly important because it contains memory-page data.

Think of it as a saved representation of the memory used by the running application.

Step 4: Snapshot Is Stored Locally

The snapshot is written to the worker node's local snapshot directory.

An example path is:

/var/lib/ate/snapshots/<actor-uid>/
Enter fullscreen mode Exit fullscreen mode

Step 5: Snapshot Is Uploaded to Object Storage

Agent Substrate uploads the snapshot to the configured object store.

The snapshot receives a unique identifier.

For example:

gs://ate-snapshots/
    atespaces/
        customer-support/
            actors/
                <actor-uid>/
                    snapshots/
                        <snapshot-uuid>
Enter fullscreen mode Exit fullscreen mode

Step 6: PostgreSQL Is Updated

Agent Substrate updates the actor record with information about the new snapshot.

For example:

state: ACTOR_STATE_SUSPENDED

snapshots:
  - generation: 3
    fidelity: SNAPSHOT_FIDELITY_MEMORY

    durableSnapshot:
      state: SNAPSHOT_STORAGE_STATE_COMPLETED

      object:
        snapshotUri: gs://ate-snapshots/...
Enter fullscreen mode Exit fullscreen mode

Now Agent Substrate knows:

  • Which actor is suspended.
  • Which snapshot belongs to that actor.
  • Where the snapshot is stored.
  • Whether the snapshot is durably uploaded.

The worker resources can then be released.


8. What Exactly Does a Snapshot Save?

Agent Substrate supports three snapshot fidelity levels.

Snapshot fidelity means how much of an actor's state should be preserved.

8.1 VOLUMES Snapshot

This saves files from configured durable volumes.

For example:

/agent-data/
    project/
        app.py
        requirements.txt
Enter fullscreen mode Exit fullscreen mode

When the actor resumes:

  • Durable volume files are restored.
  • The container starts again.
  • Running processes are not preserved.
  • RAM state is not preserved.

Imagine saving only your important documents before restarting your computer.

8.2 ROOTFS Snapshot

This includes:

  • Durable volumes.
  • Changes made to the container's writable root filesystem.

For example:

/app/
    app.py
    config.json

/agent-data/
    project/
        requirements.txt
Enter fullscreen mode Exit fullscreen mode

When the actor resumes, the filesystem changes are restored.

However, running processes and RAM state are not preserved.

The application starts again.

8.3 MEMORY Snapshot

<badge color="success">Most complete snapshot</badge>

This includes:

  • Durable volume data.
  • Root filesystem changes.
  • Process memory.
  • Running process state.

For example:

Actor State
    |
    |--- Files
    |
    |--- Filesystem Changes
    |
    |--- RAM
    |
    |--- Running Processes
Enter fullscreen mode Exit fullscreen mode

When restored successfully, the same processes can continue with their saved memory state.

This is closer to restoring a running computer from a checkpoint.

Snapshot Comparison

Feature VOLUMES ROOTFS MEMORY
Durable files Yes Yes Yes
Filesystem changes No, except durable volumes Yes Yes
RAM state No No Yes
Running processes No No Yes
Application restart Yes Yes No, same processes are restored

The choice depends on the requirements of your AI agent.

For example:

  • A chatbot that can reload its conversation from durable storage may need VOLUMES.
  • A coding agent that needs its working directory preserved may need ROOTFS.
  • An agent that needs to continue the same running process may need MEMORY.

9. Asynchronous vs. Synchronous Snapshot

Agent Substrate supports two suspend modes.

9.1 Asynchronous Suspend

This is the default mode.

The process is:

Actor Running
      |
      v
SuspendActor
      |
      v
Create Snapshot Locally
      |
      v
Mark Actor Suspended
      |
      v
Return to Caller
      |
      v
Upload Snapshot Later
      |
      v
Object Storage
Enter fullscreen mode Exit fullscreen mode

The API returns after the snapshot is saved locally.

The upload happens later.

The snapshot may temporarily have:

SNAPSHOT_STORAGE_STATE_PENDING
Enter fullscreen mode Exit fullscreen mode

This means it has not yet reached durable object storage.

9.2 Synchronous Suspend

The process is:

Actor Running
      |
      v
SuspendActor --mode sync
      |
      v
Create Snapshot
      |
      v
Upload Snapshot
      |
      v
Object Storage Confirms Completion
      |
      v
Mark Snapshot COMPLETED
      |
      v
Return to Caller
Enter fullscreen mode Exit fullscreen mode

The API returns only after the snapshot is stored in the object store.

This is useful when your application must know that the latest snapshot has reached durable storage before proceeding.

Comparison

Feature Asynchronous Synchronous
Local snapshot Yes Yes
Object-store upload Later Before return
API response Faster Waits for upload
Latest snapshot immediately durable No Yes

An important detail from the manual:

The default asynchronous upload delay is five minutes, and the default local snapshot detach delay is 30 minutes.

These timers are configurable.


PART 3: HOW AGENT SUBSTRATE RESTORES AN ACTOR

10. What Happens When a User Returns?

Suppose Alice returns after 30 minutes.

She sends:

"Continue working on my Python project."

Her actor is currently suspended.

The restoration process looks like this:

Alice Sends Request
        |
        v
atenet-router
        |
        v
Identify Alice's Actor
        |
        v
Check Actor State
        |
        v
Actor Is SUSPENDED
        |
        v
ResumeActor
        |
        v
Find Available Worker
        |
        v
Read Snapshot from Object Storage
        |
        v
Restore Snapshot
        |
        v
Actor Becomes RUNNING
        |
        v
Forward Request
        |
        v
Return Response to Alice
Enter fullscreen mode Exit fullscreen mode

For a MEMORY snapshot, the runtime restores the saved memory and process state.

For VOLUMES and ROOTFS snapshots, the container starts again with the saved files.

The actor continues its work according to the selected fidelity.

Why Is This Useful?

Without Agent Substrate, you might have to keep Alice's pod running continuously.

With Agent Substrate, the actor can be suspended and its worker resources can be reused.

This makes it possible to support many more logical sessions than continuously running worker environments.


PART 4: DATABASE AND STORAGE ARCHITECTURE

11. Does Agent Substrate Use a Database?

Yes. Agent Substrate uses PostgreSQL.

This is a very important part of its architecture.

It does not store everything inside Kubernetes resources.

The main PostgreSQL schema is called:

substrate
Enter fullscreen mode Exit fullscreen mode

It contains tables such as:

Table Purpose
atespaces Stores atespace information
actors Stores actor records and snapshot references
actor_templates Stores actor templates
tags Stores named snapshot copies
workers Stores worker information
worker_assignments Tracks actor-to-worker assignments
leases Coordinates lifecycle operations
actor_egress_policies Stores network egress policies
atespace_access_policies Stores access-control policies

The system also has tables for worker event tracking and the embedded OpenFGA authorization engine.

Why Not Store Actors in Kubernetes?

Kubernetes normally manages objects such as:

  • Pods
  • Deployments
  • Services
  • ConfigMaps
  • Secrets

Agent Substrate adds Kubernetes custom resources for infrastructure configuration, particularly:

  • WorkerPool
  • SandboxConfig
  • CSIDriverConfig

But actors, atespaces and templates are stored in PostgreSQL.

That is why:

kubectl get pods
Enter fullscreen mode Exit fullscreen mode

will not show all your actors.

Instead, you use:

kubectl ate get actors
Enter fullscreen mode Exit fullscreen mode

Why Is PostgreSQL Important?

Imagine PostgreSQL is unavailable.

Agent Substrate may no longer be able to reliably:

  • Identify actors.
  • Read actor state.
  • Find snapshot locations.
  • Perform lifecycle operations.
  • Route new requests through the normal control-plane path.

This means PostgreSQL is a critical infrastructure dependency.

For production, you should use an appropriately backed-up and highly available PostgreSQL deployment.

The bundled single-replica PostgreSQL installation is intended as a convenient starting point, not a complete production high-availability solution.

12. Why Does Agent Substrate Need Both PostgreSQL and Object Storage?

Let's understand with a simple example.

Suppose Alice has an actor.

PostgreSQL contains:

Actor ID: 12345
Actor Name: alice-agent
Status: SUSPENDED

Snapshot URI:
gs://ate-snapshots/.../snapshot-abc
Enter fullscreen mode Exit fullscreen mode

Object storage contains:

snapshot-abc/
    pages.img
    checkpoint.img
    pages_meta.img
    rootfs/
Enter fullscreen mode Exit fullscreen mode

Now imagine you lose PostgreSQL.

The snapshot may still exist in object storage, but the metadata connecting it to Alice's actor is missing.

Now imagine you lose object storage.

PostgreSQL may still contain Alice's actor record, but the actual snapshot needed to restore it is missing.

Therefore:

You must protect both PostgreSQL and object storage.

Backing up only Kubernetes etcd is not enough.

Backing up only PostgreSQL is not enough either.

A production backup strategy must coordinate both systems and account for snapshots that are still pending upload.


PART 5: HOW AGENT SUBSTRATE PROTECTS DATA

13. What Does Data Tampering Mean?

Before discussing security, let's understand the problem.

Imagine a malicious person tries to:

  1. Read Alice's snapshot.
  2. Modify Alice's saved memory.
  3. Replace Alice's snapshot with a malicious snapshot.
  4. Restore Bob's snapshot as Alice.
  5. Steal credentials stored inside an agent.
  6. Access another team's actors.

These are different security threats.

Agent Substrate uses multiple security mechanisms to protect its infrastructure and isolate workloads.

However, it is important to distinguish API security from the integrity of the actual snapshot files.

14. Authentication – Who Are You?

Authentication answers:

"Who is making this request?"

Agent Substrate checks client credentials at two important places.

A. API Authentication

The ate-api-server accepts:

  • Client certificates.
  • Bearer JWT tokens from trusted issuers.

For example:

Alice's application sends a valid identity token.

The API checks the credential and identifies the principal.

If the credential is invalid, the request is rejected.

B. Router Authentication

The atenet-router checks the client certificate.

It uses an allowed SPIFFE ID list to decide which clients can reach actors.

A valid identity for the API does not automatically guarantee access through the router.

The two access checks are separate.

15. Authorization – What Are You Allowed to Do?

Authentication identifies the caller.

Authorization determines what that caller can do.

Agent Substrate uses an embedded OpenFGA authorization engine.

It supports role-based permissions at the global and atespace levels.

For example:

Company
  |
  |--- Team A
  |       |
  |       |--- Alice
  |       |--- Bob
  |       |
  |       |--- Alice's Actor
  |       |--- Bob's Actor
  |
  |--- Team B
          |
          |--- Charlie
          |
          |--- Charlie's Actor
Enter fullscreen mode Exit fullscreen mode

Team A should not automatically have access to Team B's actors.

Atespace access policies help enforce these boundaries.

Typical roles include:

Role Responsibility
Viewer Read permitted resources
Editor Create and manage permitted resources
Owner Manage the atespace and its access policies

Important Production Warning

The default installation uses a shared bootstrap owner identity for the CLI.

This means multiple people using the default CLI identity can effectively have broad administrative access.

For a shared or production environment, configure individual identities and appropriate access policies.

Never assume that a default development installation already provides proper multi-user isolation.

16. Unique Actor IDs – Preventing Accidental Snapshot Mixing

Suppose Alice creates an actor:

Actor Name: my-agent
Actor UID: 12345
Enter fullscreen mode Exit fullscreen mode

Later, Alice deletes the actor.

Bob creates another actor with the same name:

Actor Name: my-agent
Actor UID: 67890
Enter fullscreen mode Exit fullscreen mode

Although both actors have the same name, they have different unique IDs.

Snapshot paths use the actor UID.

For example:

actors/12345/snapshots/snapshot-abc
Enter fullscreen mode Exit fullscreen mode

and:

actors/67890/snapshots/snapshot-xyz
Enter fullscreen mode Exit fullscreen mode

This prevents the newly created actor from automatically using the previous actor's snapshot just because the names match.

This is an important identity and data-association safeguard.

17. Version Checking – Preventing Conflicting Updates

Agent Substrate uses a version field on API resources.

Imagine two applications read an actor record.

Both see:

Actor Version: 10
Enter fullscreen mode Exit fullscreen mode

Application A updates the actor.

The version becomes:

Actor Version: 11
Enter fullscreen mode Exit fullscreen mode

Application B now tries to update the actor using its old version 10.

The update is rejected because the version is outdated.

This prevents stale updates from silently overwriting newer changes.

Think of it as optimistic concurrency control.

18. Leases – Preventing Conflicting Lifecycle Operations

Imagine two requests arrive at almost the same time.

Request A wants to suspend Alice's actor.

Request B wants to resume Alice's actor.

Both operations could create conflicting changes if they execute without coordination.

Agent Substrate uses leases to coordinate operations.

A lease provides temporary ownership of a resource while a workflow is running.

For example:

Actor: alice-agent

Request A:
    Acquire Lease
    Suspend Actor
    Update Metadata
    Release Lease

Request B:
    Wait for Lease
    Perform Next Operation
Enter fullscreen mode Exit fullscreen mode

This helps prevent competing workflows from making conflicting changes.

The manual describes leases stored in PostgreSQL and renewed while workflows execute.

19. Sandbox Isolation – Protecting One Agent From Another

AI agents can execute generated code.

For example, an AI coding agent might run:

import os

print(os.environ)
Enter fullscreen mode Exit fullscreen mode

You do not want one actor to freely access another actor's environment or resources.

Agent Substrate supports isolated sandbox environments:

  • gVisor
  • microVM

These provide different isolation models.

They help prevent an actor from freely accessing resources outside its permitted environment.

Network egress policies provide another layer of protection.

For example:

AI Agent
    |
    |--- Allowed: api.openai.com
    |
    |--- Allowed: internal-api.example.com
    |
    |--- Blocked: unapproved-host.com
Enter fullscreen mode Exit fullscreen mode

By default, the egress policy model is restrictive: an actor cannot freely reach arbitrary hosts.

20. How Are API Keys and Secrets Protected?

This is particularly important for AI agents.

Suppose an agent needs an API key to call an external LLM.

A simple approach would be:

Agent Environment:

OPENAI_API_KEY=secret-value
Enter fullscreen mode Exit fullscreen mode

But this creates a problem.

If the agent's memory or filesystem is included in a snapshot, the API key could also be included.

A more controlled approach is credential injection through the network gateway.

The flow is:

  1. The agent sends an HTTP request.
  2. The gateway identifies the approved destination.
  3. The gateway injects or replaces the authorization header.
  4. The external API receives the real credential.
  5. The agent does not need to hold the real API key.

This reduces the need to place long-lived secrets inside the actor.

However, injected credentials still need protection against accidental leakage through logs, responses or other channels.

21. Does Agent Substrate Encrypt Snapshots?

This is a very important security question.

The manual documents snapshot creation, local storage, object-store upload and restoration.

It also documents TLS for supported communication paths and database connections.

However, we should not assume that these automatically guarantee complete snapshot encryption and integrity protection.

The manual does not establish a complete built-in guarantee for all of the following:

  • Encryption at rest for every snapshot.
  • Customer-managed encryption keys.
  • Cryptographic signatures for snapshots.
  • Hash verification before restoring snapshots.
  • Protection against a privileged object-store administrator modifying objects directly.

These are separate security properties.

For a production deployment, I would recommend implementing or verifying the following.

A. Encryption at Rest

Enable encryption for the object-storage bucket.

For example:

Snapshot
    |
    v
Object Storage
    |
    v
Encryption at Rest
    |
    v
Encrypted Object
Enter fullscreen mode Exit fullscreen mode

For sensitive workloads, consider a managed key service such as KMS.

B. Restrict Bucket Permissions

Only the required Substrate service identities should be able to read or write snapshot objects.

Do not give ordinary users direct write access to snapshot storage.

C. Enable Object Versioning

Object versioning helps recover previous versions if someone accidentally replaces or deletes a snapshot.

Where supported, object-lock or retention policies can provide stronger protection against deletion.

D. Verify Snapshot Integrity

Before restoring a snapshot, a robust implementation should verify that the snapshot has not changed unexpectedly.

One possible approach:

Snapshot Created
      |
      v
Calculate SHA-256 Hash
      |
      v
Store Trusted Hash
      |
      v
Upload Snapshot
      |
      v
Download Snapshot
      |
      v
Calculate SHA-256 Again
      |
      v
Compare Hashes
      |
      v
Restore Only If Valid
Enter fullscreen mode Exit fullscreen mode

A digital signature can additionally establish that the snapshot was produced by a trusted component.

These are recommended additional safeguards, not features confirmed as automatic defaults in Agent Substrate 1.0.0.

E. Protect Worker Node Disks

Remember that asynchronous snapshots may temporarily exist on worker node disks.

Therefore, protect:

  • Node disks.
  • Snapshot directories.
  • Worker service accounts.
  • Local caches.
  • Kubernetes node access.

Security should cover the entire snapshot lifecycle, not just the final object-storage bucket.


PART 6: WHAT HAPPENS WHEN SOMETHING FAILS?

22. What If the Worker Crashes?

Imagine Alice's actor is running on Worker 1.

Suddenly, Worker 1 crashes.

Agent Substrate can detect the failure and mark the actor as:

ACTOR_STATE_CRASHED
Enter fullscreen mode Exit fullscreen mode

If a valid saved snapshot exists, an application can use:

RevertActor
Enter fullscreen mode Exit fullscreen mode

to recover the actor to a suspended state from its saved snapshot.

The actor can then be resumed.

This is useful for recovering from certain runtime failures.

However, recovery depends on the availability and validity of the saved snapshot.

23. What If PostgreSQL Goes Down?

PostgreSQL is on the normal control-plane path.

If PostgreSQL is unavailable:

  • Actor metadata cannot be reliably accessed.
  • Lifecycle operations can fail.
  • New resumes can fail.
  • Requests can experience timeouts or errors.

Therefore, production installations should use a properly backed-up database with high availability.

24. What If Object Storage Goes Down?

Suppose the actor is suspended and its snapshot is in object storage.

Now the object store becomes unavailable.

Agent Substrate may be unable to retrieve the snapshot for restoration.

Even if PostgreSQL is working perfectly, the actor cannot be restored normally without the required snapshot data.

This is why object storage is just as important as PostgreSQL.

25. Why Should We Back Up Both Systems Together?

Imagine:

PostgreSQL Backup:
    Actor Alice
    Snapshot URI: snapshot-abc

Object Storage:
    snapshot-abc
Enter fullscreen mode Exit fullscreen mode

Now suppose you take a database backup and later delete snapshot-abc from the bucket.

The database backup still refers to a snapshot that no longer exists.

This is an inconsistent backup.

The opposite problem can also happen: the bucket contains snapshots, but the database backup does not contain the matching actor metadata.

Therefore, backup and recovery procedures must coordinate PostgreSQL and object storage.

The manual specifically warns that two backups taken at the same clock time are not necessarily a consistent backup if a suspend or delete happens between them.


PART 7: WHAT AGENT SUBSTRATE DOES NOT DO

26. Responsibilities That Remain With Developers

Agent Substrate is infrastructure for running agents. It is not a complete AI agent development framework.

Here is the division of responsibility.

Responsibility Who handles it?
Actor creation and lifecycle Agent Substrate
Snapshot creation and restoration Agent Substrate
Actor request routing Agent Substrate
PostgreSQL metadata management Agent Substrate
Worker pool management Agent Substrate and Kubernetes
LLM selection Developer
Agent intelligence Developer
Prompt engineering Developer
Conversation management Developer
Deciding when to suspend Developer or agent framework
Worker pool sizing Developer or platform operator
GPU inference External model-serving system
Production backup strategy Platform operator
Additional snapshot encryption and integrity controls Platform operator

Important Limitations in Version 1.0.0

  1. Agent Substrate does not automatically suspend idle actors.
  2. It does not include its own worker-pool autoscaler.
  3. It does not directly provide GPU access to actors.
  4. It does not automatically solve every application-level failure.
  5. It does not replace an AI agent framework.

PART 8: A COMPLETE END-TO-END EXAMPLE

27. Alice Uses a Personal AI Assistant

Let's put everything together.

Alice logs into an AI assistant application.

The application creates an actor for her.

Initial Creation

Alice
  |
  v
AI Application
  |
  v
Agent Substrate API
  |
  v
Create Actor
  |
  v
PostgreSQL
  |
  v
Actor Record Created
Enter fullscreen mode Exit fullscreen mode

The actor starts from its template's initial state.

Alice Sends a Request

Alice:
"Create a Python application"
Enter fullscreen mode Exit fullscreen mode

The router identifies her actor and resumes it if necessary.

The actor executes on a worker.

It creates:

/project/
    app.py
    requirements.txt
Enter fullscreen mode Exit fullscreen mode

Alice Leaves

The application decides that the actor is no longer needed.

It calls:

SuspendActor
Enter fullscreen mode Exit fullscreen mode

Agent Substrate:

  1. Captures the configured snapshot fidelity.
  2. Creates the snapshot.
  3. Stores it locally.
  4. Uploads it to object storage.
  5. Updates PostgreSQL.
  6. Releases worker resources.

Alice Returns After 30 Minutes

Alice asks:

"Continue my Python project."

Agent Substrate:

  1. Identifies her actor.
  2. Reads the actor metadata from PostgreSQL.
  3. Finds the snapshot URI.
  4. Finds a suitable worker.
  5. Retrieves the snapshot.
  6. Restores the actor.
  7. Routes her request.

Alice can continue working with her saved project.

The worker resources were available for other actors while Alice was inactive.


PART 9: FINAL ARCHITECTURE

28. Complete Agent Substrate Architecture

                    USERS
                      |
                      v
               AI APPLICATION
                      |
                      v
              API / AUTHENTICATION
                      |
                      v
               AGENT SUBSTRATE
                      |
          +-----------+-----------+
          |                       |
          v                       v
     PostgreSQL              Router
     Metadata                   |
          |                     v
          |               Worker Pool
          |                     |
          |             +-------+-------+
          |             |               |
          |             v               v
          |          Worker 1        Worker 2
          |             |               |
          |             v               v
          |          Actor A         Actor B
          |             |               |
          +-------------+---------------+
                        |
                        v
                  SNAPSHOT SYSTEM
                        |
              +---------+---------+
              |                   |
              v                   v
         Local Disk          Object Storage
         Temporary           Durable Snapshot
              |                   |
              +---------+---------+
                        |
                        v
                RESTORE WHEN NEEDED
Enter fullscreen mode Exit fullscreen mode

The architecture separates three important concerns:

  1. Execution: Workers run actors.
  2. Metadata: PostgreSQL manages actor records and references.
  3. Persistence: Object storage keeps durable snapshots.

Security mechanisms protect access to these components and isolate workloads.


29. Final Takeaways

Let's summarize the complete concept in 12 simple points.

  1. Agent Substrate: Infrastructure for running many stateful AI agent sessions.
  2. Actor: An individual AI agent workload.
  3. Worker: A Kubernetes pod that runs actors.
  4. Snapshot: A saved representation of an actor's state.
  5. SuspendActor: Captures the selected state and releases worker resources.
  6. ResumeActor: Restores the actor when a new request arrives.
  7. PostgreSQL: Stores actor metadata, lifecycle state and snapshot references.
  8. Object Storage: Stores the actual durable snapshot data.
  9. Snapshot Fidelity: Determines whether files, filesystem changes or memory and processes are preserved.
  10. Authentication and Authorization: Control who can access and manage actors.
  11. Sandbox and Network Policies: Help isolate workloads and control external access.
  12. Backup and Security: Require protection of PostgreSQL, object storage, worker nodes and credentials.

One-Line Definition

Agent Substrate is a Kubernetes-based infrastructure platform that enables developers to run many stateful AI agent sessions on a smaller pool of workers by saving inactive actors as snapshots and restoring them when needed.

The Most Important Thing to Remember

Agent Substrate separates an AI agent's state from the compute resources used to run it.

That is its biggest architectural advantage.

Instead of continuously running a separate pod for every AI agent session, it saves the session's state and reuses worker resources.

PostgreSQL remembers where the actor's state is, object storage keeps the saved snapshot, and workers provide the computing environment when the actor needs to run again.

Top comments (0)