SuperAPI AI Directory

agent-sdk-go

agent-sdk-go is an open-source SDK for building persistent AI agents in the Go language. Its core feature is that it allows an agent's state, tool calls, and execution loop to recover after a process crash, thereby "continuing from where it left off." By default it runs in-process, providing crash recovery without additional infrastructure; when distributed, multi-process execution is needed, it can switch to Temporal or Restate. Each core component of the SDK is a pluggable interface, avoiding vendor lock-in. It supports LLM providers such as OpenAI, Anthropic, Gemini, DeepSeek, Ollama, and more; supports built-in and custom tools, MCP servers, the A2A protocol, sub-agents, human approval, multi-turn conversation history, memory and RAG, streaming output and AG-UI, extended reasoning, token usage statistics, budget control, lifecycle hooks, error control, execution configuration, distributed execution, and OpenTelemetry observability. It requires Go 1.26+ and is open-sourced under the Apache License 2.0. This project is an independent community library and is not affiliated with Temporal Technologies or Restate.

Open website

About this tool

agent-sdk-go is an open-source SDK for Go developers, used to build AI agents with persistent execution capabilities. Its target scenario is to make an agent's running state, tool calls, and execution loop recoverable after a process crash or restart, achieving "continuing from where it left off" and reducing lost work or missed approvals.

Main capabilities include:

  • Persistent execution: crash-recoverable runs on any runtime; after restart, it can reconnect to an active run and resume the event stream.
  • Distributed execution: when using Temporal, client triggering can be decoupled from worker execution and run across processes; when using Restate, it can scale by registering endpoint deployments.
  • LLM providers: supports OpenAI, Anthropic, Gemini, DeepSeek, Ollama (local), and custom providers can also be integrated through the interfaces.LLMClient interface.
  • Tools and MCP: provides built-in and custom tools; supports connecting to MCP servers via stdio or streamable HTTP.
  • A2A: can expose an agent as an A2A server, or connect a remote A2A agent as a tool.
  • Sub-agents: can delegate to expert agents with independent LLMs, tools, and task queues.
  • Human-in-the-loop approval: can gate tool calls, MCP calls, and delegation.
  • Conversation history: supports multi-turn conversations through in-memory or Redis backends.
  • Memory and RAG: provides long-term scoped memory and retrieval-augmented generation.
  • Streaming output and AG-UI: supports partial token streaming; provides the AG-UI protocol for frontend integration.
  • Reasoning capabilities: supports extended thinking on Anthropic, Gemini, DeepSeek, and OpenAI reasoning models.
  • Token usage: aggregates token counts for prompts, completions, and reasoning per run.
  • Budget control: limits token spending per run; when the limit is reached, it can stop execution or require human-in-the-loop approval.
  • Lifecycle hooks: provides middleware at LLM, tool, retrieval, and memory lifecycle points.
  • Error control: fallback LLMs after classified failures, authorization for one additional iteration, and per-tool circuit breakers.
  • Execution configuration: sets timeouts and maximum attempts for each operation via With*ExecutionConfig.
  • Observability: provides OpenTelemetry tratracing, metrics, and structured logging.

In terms of usage, the project requires Go 1.26+. Agents are durable by default, with no infrastructure required. Only when distributed, multi-process execution is needed do you need to add a Temporal or Restate server. Run modes include: in-process execution (zero configuration), Temporal (distributed execution, import pkg/agent/runtime/temporal), Restate (durable execution, import pkg/agent/runtime/restate, mutually exclusive with Temporal). The project also provides the agctl command-line tool, whose binary can be downloaded from GitHub Releases and placed in PATH.

Applicable scenarios include agent tasks that require crash recovery, distributed agent execution across processes, workflows with human approval, conversational agents that require long-term memory and RAG, and LLM applications that require observability and budget control.

In terms of limitations: the official materials do not provide a complete description of limitations. Known caveats include: local runtime does not support WithOffset(n>0), and can only replay from the beginning, and completed steps are merged into a single message at step granularity, rather than the original token-by-token stream; imports for the Temporal and Restate runtimes are mutually exclusive. The project is provided "as is" under the Apache License 2.0, and when building AI agents that perform real-world operations, appropriate safety guardrails, validation, and human-in-the-loop approval processes should be ensured; deployers are responsible for compliance, access control, and operational safety.