All products / Claude Agent SDK for Go

Foundation

Claude Agent SDK for Go

An idiomatic Go SDK for the Claude Code CLI, mirroring the Python Agent SDK.

What it is

An idiomatic Go SDK for the Claude Code CLI, mirroring the Python Agent SDK.

Why it exists

Go teams building agents were told to call Python. This SDK gives them one-shot queries, interactive clients, in-process tools, hooks, sandboxing and session management in pure Go.

How to use it

Go module

go get github.com/ProjAnvil/claude-agent-sdk-golang

Prerequisite

Go 1.25+
curl -fsSL https://claude.ai/install.sh | bash

One-shot query

messages, errs := claude.Query(ctx, "Hello Claude", nil)

↗ Full README

For other agents

Import the module and call Query or ClaudeSDKClient. Custom Go functions become in-process MCP tools through Tool(...).Handler(...), so an agent can use your code as a tool without a separate server.