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.
π For a gentle intro, read the blog post "Durable Agents - Fault Tolerance across Frameworks and without Handcuffs"
| Use Case | What it solves |
|---|---|
| Durable Execution | Crash-safe LLM/tool calls & idempotent retriesβagents resume at the last successful step. |
| Detailed Observability | Auto-captured trace 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 agent execution with parallel tool calls
| Integration | Example | Description | Code | Docs |
|---|---|---|---|---|
| Vercel AI SDK | Template | A minimal example of how to use Restate with the Vercel AI SDK | π | |
| Tour of Agents | A step-by-step tutorial showing how to build resilient agents | π | ||
| Examples | More advanced examples that can be deployed as a Next.js app on Vercel | - | ||
| OpenAI Agents SDK | Template | A minimal example of how to use Restate with the OpenAI Agents SDK | π | |
| Tour of Agents | A step-by-step tutorial showing how to build resilient agents | π |
| Pattern | Description | Code | Docs |
|---|---|---|---|
| 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 | Deploy/scale agents separately and route requests with resilient communication | π | |
| Parallel agent processing | Run multiple, specialized agents in parallel and aggregate their results | π | |
| Racing agents | Race multiple agents against each other and use the fastest response | π | |
| 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 | π | |
| 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 | - |
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
- 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.
