Skip to main content
This page gives you the mental model: which components exist, how they connect, and what happens during a request. Feature details live in the individual feature pages.

Components

Agent — the public handle you create with NewAgent. Holds the configuration and capability registries. Receives your Run/Stream call and hands it to the Runtime. Runtime — executes the agent loop. Two implementations: in-process (default, no infra) and Temporal (durable, scalable). Both run the same loop; only the execution environment differs. Capabilities — plugged into the Runtime at construction. Tools, MCP servers, and A2A agents form the tool surface the LLM can call. Memory, Conversation, and Retrieval shape the context the LLM receives. Hooks — middleware callbacks that fire before and after LLM calls, tool execution, retrieval, and memory operations. Use them for logging, PII scrubbing, guardrails, and cost tracking without modifying agent logic. See Hooks.

Request lifecycle

What happens from the moment your code calls a.Run(ctx, prompt, nil): Each iteration is one LLM round-trip. The loop repeats until the LLM returns a final answer or the iteration limit is reached. On Stream, events are emitted at each step as they happen.

Runtimes

Run agents locally for development, or with Temporal for production-grade durability and fault tolerance. The same agent code runs on both — the SDK picks the backend based on which options you pass to NewAgent.
In-processTemporal
How it runsAgent loop executes in your Go processAgent loop becomes a Temporal workflow
DurabilityNone — process crash loses the runFull — Temporal replays after crashes
Worker scalingSingle processHorizontal — multiple worker processes on the same task queue
SetupNo infra requiredRequires a running Temporal server
When to useDevelopment, scripts, low-volume APIsProduction, long-running tasks, multi-tenant services
Add WithTemporalConfig or WithTemporalClient to switch. Everything else stays the same.

Temporal process topology

With Temporal, client and worker are separate concerns — the client starts workflows, the worker runs the loop: By default NewAgent embeds a local worker in the same process — no separate binary needed for development. For production, split client and worker — see Worker separation.

Runtimes

In-process vs Temporal — full comparison

Quickstart

Build and run your first agent

Features

Tools, memory, MCP, A2A, and more

Worker separation

Split client and worker processes