Skip to main content
The Restate runtime executes agent runs as durable Restate invocations. Tool calls, LLM rounds, and approvals survive process crashes and deploys — Restate records durable steps and resumes from the last completed step. Enable it by importing pkg/agent/runtime/restate and passing restate.WithRestateConfig to NewAgent. A running Restate server is required.

Prerequisites

Local development — pick one: Ingress is at http://localhost:8080; Admin / UI at http://localhost:9070. Full local and production notes: restate-setup.md in the repository. Production — use Restate Cloud or a self-hosted cluster. Pass Ingress.AuthKey and optional Endpoint.IdentityPublicKeys as required by your deployment.

Enable

WithRestateConfig

IngressConfig fields

EndpointConfig fields

EventLogConfig fields

Controls post-run cleanup of the per-run AgentEventLog virtual object. After a root Run/Stream finishes, the runtime schedules a delayed Clear so readers can drain first.
NewAgent starts an embedded SDK endpoint in your process. Restate calls into that endpoint to run the agent loop.
Provide either Temporal options (pkg/agent/runtime/temporal) or restate.WithRestateConfig, not both. Mixing durable backends is a configuration error.

Architecture

Restate splits agent execution into an ingress plane and an embedded endpoint:
Restate topology is ingress + embedded SDK endpoint: the agent loop runs in your process when Restate invokes the registered deployment. Scale by registering multiple deployments; Restate routes invocations to them. For Temporal’s task-queue + worker model, see Temporal runtime and Distributed Execution.

Durable execution

Because every agent run is a Restate durable invocation:
  • Process crashes do not lose progress — completed steps are not re-executed; given approvals are not re-requested
  • Deploys are safe — restart the process; Restate resumes from recorded journal entries
  • Runs outlive the client attach — the invocation continues in Restate even if your subscriber disconnects
  • Close does not terminate invocations — calling Agent.Close() shuts down the local SDK endpoint and owned connections; in-flight invocations keep running and resume when an endpoint is available again
See Durable Execution for the shared GetAgentRun / GetAgentStream reconnect protocol.

Topology

Production topology is:
  1. Run Restate (Cloud or self-hosted)
  2. Run one or more agent processes with restate.WithRestateConfig (each embeds an SDK endpoint)
  3. Register deployments (automatic when AdminURL is set, or via the Restate admin/CLI)
Streaming and approvals work with no extra configuration — the agent attaches through Restate ingress, independent of which registered endpoint executes the invocation.

Streaming and approvals

Events are delivered through a Restate PubSub virtual object (AgentEventLog) — a durable, ordered event log. Every published event is appended with a monotonic offset; subscribers receive the same events in the same order. Delivery model: After a disconnect — stream reconnect with GetAgentStream:
Always persist the runID and offset before processing each event. If your process crashes between reading an event and saving its offset, you will replay only that event on reconnect, never lose progress beyond it.
After a disconnect — run reconnect with GetAgentRun:
See Durable Execution for run + stream recovery, and Approvals for approval events on stream.

Agent mode

WithAgentMode tells the runtime how to treat the run. AgentModeInteractive (default) is for user-facing apps with short, bounded sessions. AgentModeAutonomous is for background jobs and long-running pipelines. See Timeouts & Modes.

Sub-agents on Restate

Each specialist is a normal Restate agent: its own AgentLoop_<name>, AgentEventLog_<name>, and listen port (unique when co-located). The parent invokes the child’s AgentLoop service; when delegated, the child publishes stream events to the parent’s AgentEventLog (same idea as Temporal’s RootWorkflowID). Give each agent a distinct Endpoint.ListenAddress / DeploymentURL. See Sub-agents.

Examples

Durable Agent (Restate)

Single-process crash lab and reconnect

Durable Execution

Crash recovery and GetAgentRun / GetAgentStream

Running Examples

Set AGENT_RUNTIME=restate and start Restate infra