# Agent SDK for Go - [Agent SDK for Go](https://docs.agenticenv.ai/introduction.md): Build AI agents in Go, crash-resilient by default — scale out with Temporal or Restate when you need to. - [Architecture](https://docs.agenticenv.ai/architecture.md): How Agent, Runtime, Tools, Memory, MCP, and A2A fit together as an orchestration system - [Quickstart](https://docs.agenticenv.ai/getting-started/quickstart.md): Create your first agent and run it in under 5 minutes - [LLM Providers](https://docs.agenticenv.ai/getting-started/llm-providers.md): Configure OpenAI, Anthropic, Gemini, DeepSeek, or Ollama — or bring your own LLM client - [Configuration](https://docs.agenticenv.ai/getting-started/configuration.md): Configure NewAgent options — runtime, LLM, streaming, approvals, timeouts and workers - [Run](https://docs.agenticenv.ai/getting-started/run.md): Start an agent and manage execution synchronously or asynchronously - [Streaming](https://docs.agenticenv.ai/getting-started/streaming.md): Stream live tokens and lifecycle events from an agent run - [CLI (agctl)](https://docs.agenticenv.ai/getting-started/cli.md): Run agents from the terminal with agctl — interactive chat or one-shot prompts - [Runtimes Overview](https://docs.agenticenv.ai/runtimes/overview.md): Choose between in-process, Temporal, and Restate runtimes based on your distribution and infrastructure requirements - [In-Process Runtime](https://docs.agenticenv.ai/runtimes/in-process.md): Run the full agent loop in-process, durable by default via durable-go, with no external infrastructure required - [Temporal Runtime](https://docs.agenticenv.ai/runtimes/temporal.md): Run agents as durable Temporal workflows that survive crashes, restarts, and arbitrary delays - [Restate Runtime](https://docs.agenticenv.ai/runtimes/restate.md): Run agents as durable Restate invocations that survive crashes, restarts, and arbitrary delays - [Tools](https://docs.agenticenv.ai/features/tools.md): Register built-in or custom tools and control parallel vs sequential execution per turn - [MCP](https://docs.agenticenv.ai/features/mcp.md): Connect Model Context Protocol servers as first-class agent tools over stdio or streamable HTTP - [A2A](https://docs.agenticenv.ai/features/a2a.md): Expose agents as A2A HTTP servers or connect to remote A2A agents as tools - [Sub-agents](https://docs.agenticenv.ai/features/sub-agents.md): Register specialist sub-agents and configure delegation depth and approval policies - [Approvals](https://docs.agenticenv.ai/features/approvals.md): Configure human-in-the-loop approval for tool calls, MCP invocations, sub-agent delegation, and per-run budget limits - [Execution Config](https://docs.agenticenv.ai/features/execution-config.md): Set timeout and max attempts per operation — LLM calls, tools, MCP, sub-agents, memory, and more. - [Conversation](https://docs.agenticenv.ai/features/conversation.md): Persist message history across turns in the same session using in-memory or Redis backends - [Memory](https://docs.agenticenv.ai/features/memory.md): Store and recall long-term memories scoped by user or tenant using Weaviate, pgvector, or custom backends - [Retrieval (RAG)](https://docs.agenticenv.ai/features/retrieval.md): Connect agents to external knowledge bases with agentic, prefetch, or hybrid retriever modes - [Response Format](https://docs.agenticenv.ai/features/response-format.md): Configure plain-text or JSON schema structured output from the LLM using ResponseFormat - [Token Usage](https://docs.agenticenv.ai/features/token-usage.md): Aggregate prompt, completion, and reasoning token counts across LLM rounds in a run - [Budget](https://docs.agenticenv.ai/features/budget.md): Cap token and cost usage on each agent run with WithBudget - [Reasoning](https://docs.agenticenv.ai/features/reasoning.md): Configure extended thinking per provider via WithLLMSampling and LLMReasoning - [Hooks](https://docs.agenticenv.ai/features/hooks.md): Implement middleware hooks at LLM, tool, retrieval, and memory lifecycle points for guardrails and auditing - [Error Control](https://docs.agenticenv.ai/features/error-control.md): LLM fallback, extra iterations, and a per-tool circuit breaker — after retries. - [AG-UI](https://docs.agenticenv.ai/features/ag-ui-protocol.md): Enable AG-UI event streaming for CopilotKit and other AG-UI-compatible web frontends - [Durable Execution](https://docs.agenticenv.ai/advanced/durable-execution.md): How agent runs survive crashes — automatic runtime resilience and client-side Run / Stream recovery - [Distributed Execution](https://docs.agenticenv.ai/advanced/distributed-execution.md): Run the agent client and worker in separate processes for independent scaling and production deployments - [Dynamic Capabilities](https://docs.agenticenv.ai/advanced/dynamic-capabilities.md): Add or remove tools, MCP servers, A2A agents, and sub-agents at runtime via registries - [Deterministic Execution in Agents](https://docs.agenticenv.ai/advanced/deterministic-execution.md): Run named user workflows from inside an agent — the LLM routes intent, your orchestration engine controls execution - [Code Execution in Agents](https://docs.agenticenv.ai/advanced/code-execution.md): Let the LLM write and run code safely — plug in any sandbox behind a single interface - [Multiple Agents](https://docs.agenticenv.ai/advanced/multiple-agents.md): Run several agents in one process - [Timeouts and Agent Modes](https://docs.agenticenv.ai/advanced/timeouts-and-modes.md): Configure run duration, approval timeouts, and interactive vs autonomous agent behavior - [Telemetry](https://docs.agenticenv.ai/observability/telemetry.md): Enable OpenTelemetry export and access run-level agent telemetry data - [Tracing](https://docs.agenticenv.ai/observability/tracing.md): Enable distributed tracing for agent runs, LLM calls, tool invocations, and memory operations via OTLP - [Metrics](https://docs.agenticenv.ai/observability/metrics.md): Export OpenTelemetry counters and histograms for LLM latency, token usage, and tool calls - [Logs](https://docs.agenticenv.ai/observability/logs.md): Configure structured SDK logging with slog, set log levels, and export logs via OTLP - [Eval Harness](https://docs.agenticenv.ai/testing/eval-harness.md): Run behavioral regression evals to verify tool calls, completion quality, and telemetry without a live LLM - [Benchmarks](https://docs.agenticenv.ai/testing/benchmarks.md): Run config-driven benchmarks to measure agent latency, throughput, and token usage under load - [Readiness Checklist](https://docs.agenticenv.ai/production/readiness.md): Deploy agents to production with a checklist for timeouts, secrets, LLM fallback, and observability setup - [Agent Chat](https://docs.agenticenv.ai/reference-apps/agent-chat.md): Durable chat reference app built with Agent SDK for Go — Temporal workflows, SSE streaming, and crash recovery - [Configuration](https://docs.agenticenv.ai/examples/configuration.md): Configure Go, LLM credentials, Docker dependencies, and env vars before running any example - [Running Examples](https://docs.agenticenv.ai/examples/running-examples.md): Run examples with go run or Task — example index, infra setup, suggested order, and multi-process commands - [Simple Agent](https://docs.agenticenv.ai/examples/simple-agent.md): Run a minimal agent with Run() using the in-process runtime and no extra setup - [Temporal Client](https://docs.agenticenv.ai/examples/temporal-client.md): Build a caller-owned Temporal client connection for TLS, API keys, and Temporal Cloud - [Durable Engine](https://docs.agenticenv.ai/examples/durable-engine.md): Build a caller-owned durable-go engine for payload encryption, journal MAC, and stable step-token keys - [Non-blocking Run](https://docs.agenticenv.ai/examples/nonblocking-run.md): Run an agent with a handle — poll Status, optionally Cancel, wait on Done(), then Get(); tool approvals via WithApprovalHandler - [Concurrent Runs](https://docs.agenticenv.ai/examples/concurrent-runs.md): Run multiple prompts concurrently on one Agent instance using Run handles and sync.WaitGroup - [JSON Response](https://docs.agenticenv.ai/examples/json-response.md): Configure ResponseFormat with a JSONSchema to get structured machine-parseable output from the agent - [Reasoning](https://docs.agenticenv.ai/examples/reasoning.md): Enable extended thinking with WithLLMSampling and stream provider-specific reasoning deltas - [Execution Config](https://docs.agenticenv.ai/examples/execution-config.md): Override timeout and max attempts per operation — LLM, tools, and sub-agents. - [Budget Config](https://docs.agenticenv.ai/examples/agent-with-budget.md): Configure WithBudget to stop or pause a run when token or cost limits are reached - [Error Control](https://docs.agenticenv.ai/examples/error-control.md): LLM fallback, extra iterations, and a per-tool circuit breaker - [Tools](https://docs.agenticenv.ai/examples/tools.md): Register built-in and custom tools with approval handlers, authorizers, and dynamic registry patterns - [Workflows](https://docs.agenticenv.ai/examples/workflows.md): Deterministic workflow execution inside an agent — the LLM routes intent, your orchestration engine runs steps - [Code Execution](https://docs.agenticenv.ai/examples/code-execution.md): Let the LLM write and run code in an isolated sandbox via a custom execute_code tool - [MCP Config](https://docs.agenticenv.ai/examples/mcp-config.md): Connect MCP servers using WithMCPConfig over stdio or streamable HTTP via env variables - [MCP Client](https://docs.agenticenv.ai/examples/mcp-client.md): Build explicit MCP clients with mcpclient.NewClient and register them via WithMCPClients - [Stream](https://docs.agenticenv.ai/examples/stream.md): Enable streaming and handle text deltas and tool lifecycle events on an AgentEvent channel - [Conversation](https://docs.agenticenv.ai/examples/conversation.md): Persist multi-turn conversation history in Redis using WithConversation and a session ID - [Stream + Conversation](https://docs.agenticenv.ai/examples/stream-conversation.md): Stream with conversation history and handle TEXT_MESSAGE deltas without duplicating RUN_FINISHED content - [AG-UI](https://docs.agenticenv.ai/examples/agui.md): Build a Go SSE server and connect it to a CopilotKit UI via AG-UI events - [Memory](https://docs.agenticenv.ai/examples/memory.md): Store and recall long-term memories across runs using Weaviate or pgvector backends - [Retrieval (RAG)](https://docs.agenticenv.ai/examples/retrieval.md): Ground agent responses with Weaviate or pgvector using agentic, prefetch, or hybrid retriever modes - [Observability](https://docs.agenticenv.ai/examples/observability.md): Export OTLP traces, metrics, and logs using WithObservabilityConfig or manually injected clients - [Hooks](https://docs.agenticenv.ai/examples/hooks.md): Implement lifecycle hooks for PII scrubbing, retrieval filtering, and memory tenant access checks - [Logs](https://docs.agenticenv.ai/examples/logs.md): Control stdout and stderr output routing with LOG_ENABLE and LOG_LEVEL across any example - [A2A Server](https://docs.agenticenv.ai/examples/a2a-server.md): Run an inbound A2A HTTP server with an agent card and JSON-RPC endpoint via RunA2A - [A2A Config](https://docs.agenticenv.ai/examples/a2a-config.md): Connect to a remote A2A agent using WithA2AConfig and call its skills as tools - [A2A Client](https://docs.agenticenv.ai/examples/a2a-client.md): Build an explicit A2A client with a2aclient.NewClient and register it via WithA2AClients - [Sub-agents](https://docs.agenticenv.ai/examples/subagents.md): Delegate tasks to a specialist sub-agent with approval flow - [Multiple Agents](https://docs.agenticenv.ai/examples/multiple-agents.md): Run two root agents concurrently in one process - [Durable Agent (Local)](https://docs.agenticenv.ai/examples/durable-agent-local.md): Test local-runtime durability with a single agent process — kill mid-stream and reconnect from a saved offset, no server required - [Durable Agent (Temporal)](https://docs.agenticenv.ai/examples/durable-agent.md): Test Temporal durability with worker crashes, process restarts, and mid-run recovery scenarios - [Durable Agent (Restate)](https://docs.agenticenv.ai/examples/durable-agent-restate.md): Test Restate durability with a single agent process — kill mid-stream and reconnect from a saved offset - [Agent Worker](https://docs.agenticenv.ai/examples/agent-worker.md): Split the agent client and Temporal worker into separate processes using DisableLocalWorker and NewAgentWorker - [Reconnect](https://docs.agenticenv.ai/examples/reconnect.md): Resume an agent event stream from a saved offset after a process crash or disconnect This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.