pkg/agent/runtime/temporal or pkg/agent/runtime/restate and add the matching config option when you need durable, production-grade execution.
Your agent code (NewAgent, tools, prompts, streaming) stays the same. Only the configuration changes.
Comparison
When to use in-process
- Short-lived runs where crash recovery is not needed
- Zero-infrastructure deployments (serverless, scripts, single binary)
When to use Temporal
- Agent runs must survive process crashes, deploys, and restarts
- You need horizontal scaling by adding workers on a task queue
- You want to split the agent client and worker across separate processes (
NewAgentWorker) - Long-running agent sessions require durable orchestration on Temporal
When to use Restate
- Agent runs must survive process crashes, deploys, and restarts
- You prefer Restate’s ingress + embedded endpoint model
- You want durable streaming and approvals with the same public
Run/Stream/ reconnect APIs - Long-running agent sessions require durable orchestration on Restate
How runtime selection works
The SDK selects a backend from yourNewAgent options. You never instantiate a runtime directly.
Switching runtimes
- Develop with no Temporal or Restate options
- Add
temporal.WithTemporalConfig(orWithTemporalClient) orrestate.WithRestateConfigfor production - 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