Run calls simultaneously on one Agent instance. Each run gets its own durable invocation (Temporal workflow / Restate invocation) or local goroutine — no separate Agent per request required.
Source: examples/agent_with_concurrent_runs/
What it demonstrates
- Concurrent
Run+Getwithsync.WaitGroupfor fan-out across one agent - Results printed as they arrive (arrival order varies)
- Runtime-agnostic:
local,temporal, andrestateviaAGENT_RUNTIME
Run
Fromexamples/:
Key code
Run returns an AgentRun handle immediately; the goroutine blocks on Get until that run completes. All runs are in flight simultaneously on the same Agent.
Expected output
Learn more
Multiple Agents
Several agents in one process
Non-blocking Run
Non-blocking Run with Done() and Get()