This repo contains a set of runnable examples of AI agents and workflows, using Durable Execution, state, and orchestration via Restate (Github)
Restate is a durable runtime for agents and backends. It gives you:
- β Durable Execution: Retry and recover from failures without repeating completed steps.
- β Durable Coroutines: Run multiple tools, subagents, and sandbox commands in parallel with recovery and coordination.
- β State & session coordination: Built-in multi-turn, persistent sessions. Scale out to thousands of concurrent sessions with built-in concurrency control
- β Communication & flow control: Resiliently route tasks between distributed agents, humans, and MCP servers, and shape traffic with concurrency control
- β Observability & control: Inspect detailed execution journals, and pause, cancel, kill, or roll back stuck agents
- β Production safety: Approvals, timeouts, rollbacks, and escalation without callback plumbing
Restate UI showing an agent execution with parallel tool calls
There are three ways to build durable agents with Restate. We recommend the first two:
- agentlib: Start here for initial proofs of concept, simple agents, or any agent whose logic fits agentlib's abstractions.
- Custom / DIY: Build directly on Restate when you need custom agent logic or more control. Use the agent reference architecture as a starting point.
- An agent SDK integration: Use Restate with frameworks such as Vercel AI, OpenAI Agents, Google ADK, Pydantic AI, or LangChain. See the templates and examples below.
The reference architecture is also useful for agents built with agentlib: its patterns for session management, queuing, steering, interruption, and approvals can help you build the surrounding application.
The Restate plugin provides coding skills and the Restate docs MCP server. The repository root, all standalone templates, and the agentlib examples include configuration for Claude Code and Codex. The shared marketplace catalog points to the published plugin.
Codex enables the plugin after you trust the project. See the plugin installation instructions for details.
Restate integrates with popular Agent SDKs and with all LLM SDKs (only abstracting away the LLM API).
| Integration | Quickstart | Template |
|---|---|---|
| Restate agentlib | Setup | |
| TS DIY agents | π | |
| Python DIY agents | π | |
| Vercel AI SDK | π | |
| OpenAI Agents SDK | π | |
| Google ADK | π | |
| Pydantic AI | π | |
| LangChain | π |
| Pattern | Docs | Restate agentlib | TS DIY agents | Python DIY agents | Vercel AI | OpenAI | ADK | Pydantic AI | LangChain |
|---|---|---|---|---|---|---|---|---|---|
| Durable agents: Build AI agents that survive crashes and recover automatically | π | ||||||||
| Durable Sessions: Persistent, isolated agent sessions | π | ||||||||
| Human approvals with pause/resume: Human approval steps that suspend execution | π | ||||||||
| Multi-agent orchestration: Route requests to specialized agents | π |
| Pattern | Docs | Restate agentlib | TS DIY agents | Python DIY agents | Vercel AI | OpenAI | ADK | Pydantic AI | LangChain |
|---|---|---|---|---|---|---|---|---|---|
| Parallel tool calls: Run multiple tools in parallel with recovery and coordination | π | ||||||||
| Sequential LLM calls: Chain agents in multi-step pipelines | π | ||||||||
| Parallel agents: Executing multiple agents in parallel | π | ||||||||
| Orchestrator-worker: Break tasks into specialized subtasks | π | ||||||||
| Evaluator-optimizer: Generate, evaluate, improve loop | π | ||||||||
| Workflows as tools: Complex tool logic as separate durable services | π | ||||||||
| Remote agents: Deploy/scale agents separately with resilient RPC and queuing | π | ||||||||
| Competitive racing agents: Run parallel agents, use the fastest response, cancel others | π | - | - | - | - | - | |||
| Interrupt & regenerate: Interrupt a running agent with new context; cancel in-flight task and restart | - | - | - | - | - | - | - |
| Pattern | Docs | Restate agentlib | TS DIY agents | Python DIY agents | Vercel AI | OpenAI | ADK | Pydantic AI | LangChain |
|---|---|---|---|---|---|---|---|---|---|
| Error handling: Retries and error handling for agents | π | - | - | ||||||
| Rollback: Saga pattern for compensating failed operations | π | - | - | - | - | - | - |
| Pattern | Docs | Restate agentlib | TS DIY agents | Python DIY agents | Vercel AI | OpenAI | ADK | Pydantic AI | LangChain |
|---|---|---|---|---|---|---|---|---|---|
| Chat UI integration: Integrate agents with chat UIs | π | - | - | - | - | - | - | - | |
| Streaming responses: Stream agent responses to clients | π | - | - | - | - | - | - | - | |
| Notify when ready: Callback when agent completes | π | - | - | - | - | - | - | - |
| Example | Code |
|---|---|
| MCP: Using Restate for exposing tools and resilient orchestration of tool calls | |
| A2A: Implement Google's Agent-to-Agent protocol with Restate as resilient, scalable task orchestrator |
| Integration | Restate agentlib | TS DIY agents | Python DIY agents | OpenAI Agents | Google ADK | Pydantic AI |
|---|---|---|---|---|---|---|
| Langfuse | - | - | ||||
| Arize Phoenix | - | - | - | - | - | |
| Pydantic LogFire | - | - | - | - | - | |
| Braintrust | - | - | - | - | - |
| Example | Code |
|---|---|
| NextJS Template: Minimal example of Restate + AI SDK + NextJS | |
| NextJS Example App: Example app of Restate + AI SDK + NextJS with tools, chat, pubsub,... |
Larger, end-to-end applications (in separate repos) showing how Restate holds up in real-world agentic systems.
Restate currently supports 6 languages:
The examples can be translated to any of the supported languages. Join our Discord/Slack to get help with translating an examples to your language of choice.
