Skip to main content
Temporal runtime. NewAgentWorker and DisableLocalWorker apply to the Temporal runtime. For Restate’s ingress + embedded endpoint topology, see Restate runtime.
The problem: Your API or UI process needs to submit agent runs and stream results to users — but you don’t want it to also host the worker that executes LLM calls and tools. Mixing both in one process couples your UI latency to compute load, limits independent scaling, and makes deploys riskier. The solution: Split the agent client (submits runs, handles streaming and approvals in your API) and the worker (polls the task queue and executes everything else) into separate processes. Workers are stateless — all state is held by the runtime — so you can scale them independently, deploy them separately, and restart them without losing in-flight runs.

Architecture

See Temporal runtime for the full architecture diagram.

Setup

Worker process — polls the task queue and executes runs:
Agent process — starts runs without polling:
NewAgentWorker is a Temporal API — use it with the Temporal runtime.

Configuration alignment

Both processes must share identical agent configuration: The SDK uses a fingerprint check to detect config drift between the client that started a run and the worker that executes it. Mismatches fail the run with a clear error. WithDisableFingerprintCheck bypasses the check on the agent process only — not allowed on NewAgentWorker. Use as break-glass only.

Streaming and approvals across processes

DisableLocalWorker works with streaming and approvals with no extra configuration:
The agent process subscribes to the run’s event stream directly through the Temporal client — it does not need to run a worker itself, so this works the same whether the workflow task lands on a local or remote worker. See Streaming and approvals. Streaming guarantees in split-process mode:
  • Events are durable. Each event is published to the workflow’s Temporal Workflow Stream — a durable ordered log. The workflow and event log survive worker crashes and restarts.
  • Live delivery is not automatic backfill. Tokens and events are forwarded to your subscriber process as they are published. If the subscriber disconnects mid-stream, it misses the gap. Call GetAgentStream with the last saved runID and offset to resume from exactly where you left off.
  • Approvals degrade gracefully. If an approval event cannot be delivered, the run continues rather than hanging — the tool is skipped with a clear message. This is intentional for autonomous agents; for interactive scenarios, design your UX so users are not silently blocked.

Distributed conversation and memory

In-memory conversation fails at build time with remote workers. Use Redis or another distributed backend on both processes:
See Conversation and Memory.

Crash and restart behavior

Because every agent run is a Temporal workflow, the worker process can crash and restart without losing a single step. Tool calls already made are not replayed, approvals already given are not re-requested — the run resumes exactly where it left off from Temporal’s recorded history. This means:
  • You do not need a single process alive for the entire run duration
  • Workers can be deployed, updated, or horizontally scaled while runs are in-flight
  • Kubernetes restarts and process crashes are safe — keep workers supervised and restarting
If the agent process serving Stream crashes, the run continues on the server but your subscriber loses the connection. Use GetAgentStream to resubscribe from the last saved offset — the durable event log retains all events from that offset onward. Persist runID (stream.ID()) and the last event offset before processing each event; on restart:

Sub-agents

Each sub-agent typically has its own worker. Pair NewAgentWorker with the same options (including WithName) as the NewAgent that runs that sub-agent. Example: Agent Worker · Durable Agent (Temporal).

Example

Agent Worker

Minimal split client and worker

Durable Agent (Temporal)

Crash and restart walkthrough with split processes

Durable Execution

Server-side durability and client-side stream recovery

Temporal Runtime

Durable execution architecture and fingerprint alignment

Multiple Agents

Several agents in one process