This repo contains a set of runnable examples of AI workflows and agents, using Durable Execution and Orchestration via Restate (Github)
The goal is to show how you can easily add production-grade resilience, state persistence, retries, suspend/resume, human-in-the-loop, and observability to agentic workflows. So you can ship agents that stay alive and consistent without sprinkling retry-code everywhere and without building heavyweight infra yourself.
The Restate approach works independent of specific SDKs but integrates easily with popular SDKs, like the Vercel AI SDK or the OpenAI Agent SDK. You can also use without and Agent SDK (roll your own loop) or for more traditional workflows.
📄 A gentle intro is in the blog post "Durable Agents - Fault Tolerance across Frameworks and without Handcuffs"
Template
- Tour of Agents: Restate + Vercel AI SDK: A step-by-step tutorial showing how to build resilient agents with Restate and the Vercel AI SDK.
- More examples (including Next.js, multi-agent, etc.).
Template
- Tour of Agents: Restate + OpenAI Agents SDK: A step-by-step tutorial showing how to build resilient agents with Restate and the Vercel AI SDK.
Restate is a flexible general-purpose runtime for what we call innately resilient application. It is not limited to agentic workflow use cases and is being used for a variety of other use cases as well, including financial transactions or order processing. These examples show how to build agents directly on Restate's durable execution and state management:
Python Patterns for hardening custom LLM orchestration logic.
| Use Case | What it solves |
|---|---|
| Durable Execution | Crash-safe LLM/tool calls & idempotent retries—agents resume at the last successful step. |
| Journal Observability | Auto-captured journal of every step, retry, and message for easy debugging and auditing. |
| Human-in-the-loop & long waits | Suspend while waiting for user approval or slow jobs; pay for compute, not wall-clock time. |
| Stateful sessions / memory | Virtual Objects keep multi-turn conversations and other state isolated and consistent. |
| Multi-agent orchestration | Reliable RPC, queuing, and scheduling between agents running in separate processes. |

Restate UI showing an ongoing agent execution
- Restate + Vercel AI:
Template: A minimal example of how to use Restate with the Vercel AI SDK.
Tour of Agents: Restate + Vercel AI SDK: A step-by-step tutorial showing how to build resilient agents with Restate and the Vercel AI SDK.
Examples: A more advanced example of how to use Restate with the Vercel AI SDK that can be deployed as a Next.js app on Vercel.
- Restate + OpenAI Agents Python SDK:
Template: A minimal example of how to use Restate with the OpenAI Agents SDK.
Tour of Agents: Restate + OpenAI Agents SDK.: A step-by-step tutorial showing how to build resilient agents with Restate and the OpenAI Agents SDK.
- Restate + any AI SDK: patterns for hardening custom LLM orchestration logic.
Chaining LLM calls: Build fault-tolerant processing pipelines where each step transforms the previous step's output.
Tool routing: Automatically route requests to tools based on LLM outputs.
Parallel tool execution: Execute multiple tools in parallel with durable results that persist across failures.
Multi-agent routing: Route requests to specialized agents based on LLM outputs.
Remote agent routing: Route requests to remote agents with resilient communication.
Parallel agent processing: Run multiple, specialized agents in parallel and aggregate their results.
Orchestrator-worker pattern: Break down complex tasks into specialized subtasks and execute them in parallel.
Evaluator-optimizer pattern: Generate → Evaluate → Improve loop until quality criteria are met.
Human-in-the-loop pattern: Implement resilient human approval steps that suspend execution until feedback is received.
Chat sessions: Long-lived, stateful chat sessions that maintain conversation state across multiple requests.
- 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.
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.
- Documentation
- Quickstart
- Tour of Agents: a tutorial including the most important features: Vercel AI SDK, OpenAI Agents SDK
- Examples on workflows, microservice orchestration, async tasks, event processing
- Restate Cloud
- Discord / Slack
- The DIY patterns are largely based on Anthropic's agents cookbook.
- Some of the A2A examples in this repo are based on the examples included in the Google A2A repo.