Skip to main content
Restate is a durable execution platform that makes AI agents and workflows resilient and resumable. It handles retries, recovery, orchestration, agent-to-agent communication, human-in-the-loop approvals, and task control (cancel/kill/rollback) out of the box. Restate exports its execution traces (workflow steps, durable tool steps, human approvals, etc.) as OpenTelemetry spans. By wrapping your tracer with Restate’s RestateTracerProvider, AI-specific spans from your agent framework appear under Restate’s parent span, giving you a single unified trace in Phoenix that covers both agentic and workflow steps.

Install

This example uses the OpenAI Agents SDK with Restate. You can use any agent framework that has an OpenInference instrumentor.

Setup

Set your API keys as environment variables:
Initialize Phoenix and wrap the tracer with RestateTracerProvider to correlate AI spans with Restate’s execution journal:
The RestateTracerProvider nests the agent framework spans under Restate’s parent span, so the trace hierarchy in Phoenix mirrors the actual execution flow. Both agentic steps (LLM calls, tool invocations) and durable workflow steps (e.g. side effects, state updates, retries) appear in the same trace.

Run Restate Agent

Define an agent service with durable tool execution using Restate’s OpenAI Agents SDK integration:
You can find the instructions to run the agent in the Restate Phoenix documentation.

Observe

Now that you have tracing set up, all agent invocations, including LLM calls, tool executions, and durable workflow steps, will be streamed to Phoenix for observability and evaluation. You can inspect inputs, outputs, model configuration, and token usage for each LLM call, alongside Restate’s execution journal entries.

Other Agent Frameworks

This example uses the OpenAI Agents SDK, but Restate supports multiple agent frameworks (Pydantic AI, Google ADK, and more). Swap out the OpenInference instrumentor for your framework. The RestateTracerProvider setup stays the same. See the Restate AI documentation for the full list of supported frameworks.

Resources