claude-agent-sdk-go
A pure Go SDK for Claude Code's agentic capabilities, tracking the official TypeScript Agent SDK, that manages the Claude Code CLI as a subprocess and communicates over line-delimited JSON.
claude-agent-sdk-go gives Go programs a native interface to Claude Code by spawning and managing the Claude Code CLI as a subprocess and exchanging line-delimited JSON over stdin and stdout. It tracks the official TypeScript Agent SDK's surface, adapting the API to Go idioms where the shapes differ, and gives access to tool use, extended thinking, session management, and the hook system.
Calling Query or Stream spawns the CLI, sends a prompt, and yields messages as they arrive; for MCP tools, bidirectional control messages pass tool calls and responses between the Go application and the CLI. Streaming supports multi-turn conversations through a persistent Stream object.
Configuration options include selecting a model, a system prompt, a permission mode, a maximum turn count, and settings supplied as a file path or inline JSON, including allow-listed bash commands. It requires Go 1.23 or later and the Claude Code CLI installed separately.