pkg/agent/runtime/temporal or pkg/agent/runtime/restate and add the matching config option when you need multi-process/horizontally-scaled execution.
Your agent code (NewAgent, tools, prompts, streaming) stays the same. Only the configuration changes.
Comparison
When to use in-process
- Any single-process deployment that still wants crash recovery — this is the default, not a tradeoff
- Zero-infrastructure deployments (serverless, scripts, single binary)
- Skip it only if you need horizontal scaling or a client/worker split — that’s what Temporal/Restate add
When to use Temporal
- You need horizontal scaling by adding workers on a task queue
- You want to split the agent client and worker across separate processes (
NewAgentWorker) - Reconnect needs token-level fidelity (original AG-UI events replay, not coalesced steps)
- You want mature, battle-tested workflow orchestration tooling (Temporal Web UI, etc.)
When to use Restate
- You want durable orchestration with Restate’s ingress + embedded endpoint model
- You need multiple registered endpoint deployments for scale
- Reconnect needs token-level fidelity (original AG-UI events replay, not coalesced steps)
How runtime selection works
The SDK selects a backend from yourNewAgent options. You never instantiate a runtime directly.
Switching runtimes
- Start in-process with no Temporal or Restate options — durable by default
- Add
temporal.WithTemporalConfig(orWithTemporalClient) orrestate.WithRestateConfigwhen you need multi-process/horizontal scale - If you use conversation with a Temporal split-process deployment (agent + separate worker), switch from in-memory to Redis. See Conversation
Related pages
In-Process
Default runtime — zero infrastructure
Temporal
Durable workflows, workers, and production deployment
Restate
Durable invocations with an embedded SDK endpoint