NewAgent. The same options apply to NewAgentWorker when running a separate worker process.
Key defaults: in-process runtime (no Temporal or Restate options), 5 max iterations, parallel tool execution, 5-minute timeout on interactive mode. All options can be overridden at construction time; per-run overrides use AgentRunOptions.
pkg/agent/runtime/temporal or pkg/agent/runtime/restate and add the matching config option for durable execution. All other options work identically across runtimes.
Core options
Runtime options
See Runtimes, Temporal runtime, and Restate runtime for connection details.
TemporalConfig fields
RestateConfig fields
Restate embeds the SDK endpoint in
NewAgent. When Restate runs in Docker and the agent on the host, set DeploymentURL to something Restate can reach (e.g. http://host.docker.internal:9080). See Restate runtime and restate-setup.md.Execution options
Context deadlines always take precedence over
WithTimeout. See Timeouts & Modes.
Tools and approval
Use the same
WithAgentToolExecutionMode on NewAgent, NewAgentWorker, and all sub-agents in a deployment.
Features
Observability
See Tracing and Observability example.
Per-run options
PassAgentRunOptions as the third argument to Run. For Stream, use AgentStreamOptions (same conversation fields):
ID on every call in a session to share history across turns.
Runtime registries
AfterNewAgent, mutate registered capabilities without restarting. Each run picks up the current registry state:
See Dynamic capabilities.
Agent and worker alignment
When splitting client and worker across processes,NewAgent and NewAgentWorker must share identical configuration — the SDK validates this with a fingerprint check at activity entry. See Distributed execution.
Token usage
There is no separate token usage option. ReadLLMUsage from AgentRunResult after Run, or from AgentRunFinishedEvent.Result.LLMUsage after Stream.