Skip to content

restatedev/ai-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Documentation Discord Slack Twitter

Restate: a next-gen runtime for robust, stateful, production-grade agents

Restate lets you easily build reliable applications that work consistently in production. Restate's capabilities and programming model work very well for implementing agentic workflows. Move beyond fragile demos by giving your agents innate resilience—persistent memory, fault-tolerant tool/LLM calls, and robust handling of long-running tasks. Focus on your agent's intelligence, not the infrastructure complexity tax.

Why Restate?

Restate provides the following capabilities:

  • 🚀 Move fast and far - Innate resiliency and control from your first LLM-SDK-based app to low-level, customized multi-agent applications.
  • Resilience where it matters most – Automatically recover from failures in your agentic workflows and tools.
  • 🎮 Task control - Cancel tasks, query status, re-subscribe to ongoing tasks, and track progress across failures, time, and processes.
  • 🤖 Reliable multi-agent - Flexible and reliable communication patterns including RPC, scheduled tasks, events, human-in-the-loop and parallel execution.
  • 👀 Full observability – Line-by-line execution tracking with a built-in audit trail and UI. Seamless integration with OpenTelemetry.
  • 🔁 Orchestrate long-running processes – Coordinate durable and stateful agentic processes for millis or months.
  • 🔧 Rich primitives – Leverage workflows, durable promises, communication, and persistent state.
  • 🧠 Exactly-once execution - Automatic deduplication of hand-offs and tool executions via idempotency keys.
  • 💾 Persistent memory - Maintain consistent agent memory across infrastructure events.
  • 🌍 Deploy anywhere – Whether it's AWS Lambda, CloudRun, Fly.io, Cloudflare, Kubernetes, Deno Deploy,...
  • ☁️ Easy to self-host – Single-binary self-hosted deployments or connect to Restate Cloud.

Restate can also be used for other use cases, such as: workflows, microservice orchestration, async tasks, and event processing. Or check out the Restate examples repository.

This repository contains examples of how to use Restate for AI / Agent use cases.

Example catalog

  1. DIY patterns: Patterns for hardening custom LLM orchestration logic.

  2. Agents: Using Restate (optionally with Agent SDKs) for resilient agentic workflows.

  3. MCP: Using Restate for exposing tools and resilient orchestration of tool calls.

  4. A2A: Implement Google's Agent-to-Agent protocol with Restate as resilient, scalable task orchestrator.

  5. End-to-end applications:

    • Interruptible agents: A customized agent with different operational modes to process new inputs: interrupting, incorporating, queueing.
    • Insurance claims: Filing insurance claims by parsing PDF receipts with LLMs.

Restate supports 6 languages:

TypeScript Python Java Kotlin Go Rust

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.

Running the examples

Clone the repository and consult the README of the example you want to run for further instructions.

git clone git@github.com:restatedev/restate-ai-examples.git

How Restate Compares (vs. Alternatives for Agents):

  • vs. DIY (Basic Loops + DB/Queue): Eliminates vast amounts of boilerplate code for retries, state management, consistency checks, and failure recovery that developers would otherwise need to build manually.
  • vs. Basic Agent Frameworks (focused on prompts/reasoning): Provides the crucial missing layer of execution reliability, state persistence, and robust async operation management needed for production. Restate complements these frameworks by providing a reliable runtime beneath the agent's reasoning logic.
  • vs. Heavy Workflow Engines: Offers similar strong execution guarantees but with a lighter footprint, lower latency, simpler programming model, native serverless integration, and easier self-hosting/operational story—often a better fit for the potentially high-volume, interactive nature of agent applications.

Learn more

Disclaimers and acknowledgements

Disclaimer 1: The implementations of the agent loops in this repo are heavily inspired by the OpenAI Agents SDK. We therefore want to give credit to the developers of this SDK for the great work they have done. This repo builds further on their work to make it benefit from Restate's programming model and capabilities.

Disclaimer 2: Many of the DIY patterns have been based on Anthropic's agents cookbook.

Disclaimer 3: Some of the A2A examples in this repo are based on the examples included in the Google A2A repo.

About

A collection of Restate examples for AI use cases: agents, A2A, MCP, ...

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published