A reference agent architecture
Productionizing agents is notoriously difficult, because of their long-running, stateful nature.
This reference architecture shows how to build durable, stateful,
steerable, concurrent agents and agentic systems.
The architecture fully runs on Restate and your favorite container platform or
serverless provider. Restate is a durable runtime for agents that gives you
all the building blocks you need to build advanced, large-scale agentic systems without
managing a large infra stack.
https://github.com/user-attachments/assets/f2244c8f-5f4a-4a1f-87bd-39c0502f078f
Core idea
Each agent execution is a durable async process that is:
- STEERABLE: Each execution has a handle that is stable across process
restarts and can be used to steer it, interrupt it, or approve an action.
Interrupts automatically propagate through subagents.
- STATEFUL: Execution is isolated per agent session and stateful. Transcripts
and profile data (memories, instructions) are stored in Restate's
embedded KV store.
- RECOVERABLE: Restate automatically keeps a journal per agent execution,
to recover it automatically after a failure.
- CONCURRENT: Agents can spawn parallel subagents and tools. Tools execute
as durable concurrent tasks within the process and can share resources like
sandbox connections. Subagents run as separate durable invocations with their
own state and resources.
- SCALABLE: Agents can scale up to thousands of concurrent executions, with
protection against concurrency issues and race conditions.
- PAUSABLE: Restate can suspend an invocation waiting on a durable timer,
approval signal, or child invocation, then resume it when ready. Suspension
releases that invocation's execution on serverless platforms.
Implementing these characteristics in a production-grade manner is
challenging and usually requires a lot of infra and coordination logic. In this
reference architecture, the agent processes rely on Restate to handle this complexity:

What this reference includes
This is a runnable TypeScript implementation with an agent runtime, a typed
client, and an optional demo UI. You can use it as a starting point
for your own application or take individual patterns into an existing agent.
The reference focuses on agent execution and session management. User accounts,
OAuth flows, and evals are not included.
Features
| Feature | What you can do |
|---|
| Queueing, steering, and interruption | Queue a new request, add instructions to an ongoing execution, or interrupt it and optionally start a replacement. |
| Parallel tools | Run independent tool calls concurrently and return their results or errors to the model. |
| Background operations | Continue model steps while tool-requested timers or approvals are pending; wait for or cancel them later. |
| Subagents | Delegate work to persistent agents with their own history, memory, and sandbox, then send follow-up tasks to the same agents. |
| Guardrails | Define guardrails that guard against dangerous or unwanted tool behavior. |
| Human approval | Wait durably for a decision. The controller continues accepting steering and interruption; a guardrail wait holds its current proposal. |
| Programmatic tool calling | Let the model write JavaScript that combines tool calls and returns a result without putting all intermediate data in its context. |
| Tool search | Find tools from MCP servers and Restate services, loading their schemas into model context only when needed. |
| Memory | Store information across turns, search memory descriptions, and retrieve the entries relevant to the task. |
| Compaction | Summarize older conversation history in the background and compact long-running turns, while keeping recent context verbatim. |