Skip to main content
Dispatches several 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 + Get with sync.WaitGroup for fan-out across one agent
  • Results printed as they arrive (arrival order varies)
  • Runtime-agnostic: local, temporal, and restate via AGENT_RUNTIME

Run

From examples/:

Key code

Each 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

Arrival order varies — results print as each run finishes, not in submission order.

Learn more

Multiple Agents

Several agents in one process

Non-blocking Run

Non-blocking Run with Done() and Get()