| name | agent-sdk-go |
| description | Build production AI agents in Go with Agent SDK for Go. Use when configuring agents, tools, MCP, A2A, Temporal runtimes, streaming, memory, RAG, approvals, observability, or running examples from this documentation site. |
| version | 1.0 |
| compatibility | Go 1.26+. LLM API key required (OpenAI, Anthropic, or Gemini). Temporal optional for durable execution. |
Agent SDK for Go
Go library for building production AI agents — LLM calls, tools, multi-turn conversation, memory, RAG, MCP and A2A integrations, human-in-the-loop approvals, and sub-agent delegation.
Full documentation index: llms.txt
Capabilities
- Create and configure agents with
NewAgent and functional options
- Run agents with
Run, RunAsync, or Stream
- Register built-in, custom, MCP, and A2A tools
- Persist conversation history (in-memory or Redis)
- Store and recall long-term memory (Weaviate, pgvector)
- Add RAG retrievers (agentic, prefetch, hybrid modes)
- Require human approval for tools and sub-agent delegation
- Attach middleware hooks at LLM, tool, retrieval, and memory lifecycle points
- Export OpenTelemetry traces, metrics, and logs
- Execute in-process or on Temporal for durable workflows
Workflows
Create a minimal agent
- Read Quickstart
- Configure an LLM client — LLM Providers
- Call
NewAgent with WithLLMClient and WithSystemPrompt
- Call
Run(ctx, prompt, nil) and read AgentRunResult
- Always call
defer a.Close() — required to flush OTLP exporters on shutdown
Example: Simple Agent
Add tools
- Read Tools
- Register tools with
WithTools or WithToolRegistry
- Set
WithToolApprovalPolicy(AutoToolApprovalPolicy()) for trusted automation
- Run: Tools example
Stream to a UI
- Read Streaming
- Pass
WithStream(true) at agent creation
- Call
Stream and consume <-chan AgentEvent
- Check for
nil events; handle RUN_FINISHED for final result and token usage
- Example: Stream · AG-UI
Switch to Temporal (durable execution)
- Read Temporal runtime
- Add
WithTemporalConfig or WithTemporalClient — never both
- For production, split client and worker — Worker separation
- Align agent and worker configuration (fingerprint) — same name, LLM, tools, hooks group names, approval policy
- Examples: Temporal Client · Agent Worker · Durable Agent
Integration
Context
- Architecture: Architecture
- Agent loop: prepare context → call LLM → execute tools (iterate) → finalize
- Capabilities resolve at call time from registries — tools, MCP, A2A, and sub-agents can change between runs
- Feature pages explain concepts; example pages show run commands and expected output under
examples/
- Default tool approval policy is require-all — set
AutoToolApprovalPolicy() for unattended runs
- With
DisableLocalWorker() and streaming, you must also call EnableRemoteWorkers()
- Hook group names participate in the Temporal agent fingerprint — register the same names on client and worker
Documentation map