First public release of github.com/coder/acp-go-sdk, the Go SDK for the Agent Client Protocol. This release tracks ACP schema v0.4.3 and provides everything needed to build ACP agents and clients in Go over stdio.
go get github.com/coder/acp-go-sdk@v0.4.3Added
Core API
- Agent side: implement
acp.Agent(and optionallyacp.AgentLoaderforsession/load), then wire it up withacp.NewAgentSideConnection(agent, os.Stdout, os.Stdin). - Client side: implement
acp.Client(and optionallyacp.ClientTerminalfor terminal features), then callacp.NewClientSideConnection(client, stdin, stdout)and drive a turn viaInitialize→NewSession→Prompt. - Both connection types expose
Done()for peer-disconnect signalling andSetLogger(*slog.Logger)for diagnostics. RequestErrorand JSON-RPC error helpers inerrors.gofor returning structured failures from handlers.
Generated protocol bindings
Generated from ACP schema v0.4.3 into agent_gen.go, client_gen.go, types_gen.go, constants_gen.go, and helpers_gen.go. These cover the full request/response/notification surface — Initialize, NewSession, LoadSession, Authenticate, Prompt, Cancel, WriteTextFile, ReadTextFile, RequestPermission, SessionUpdate, and the terminal methods (CreateTerminal, KillTerminalCommand, ReleaseTerminal, TerminalOutput, WaitForTerminalExit).
Helper constructors
Reduce the boilerplate of building ACP union types by hand:
- Content blocks:
TextBlock,ImageBlock,AudioBlock,ResourceLinkBlock,ResourceBlock. - Tool-call content:
ToolContent,ToolDiffContent,ToolTerminalRef. - Session updates:
UpdateUserMessageText,UpdateAgentMessageText,UpdateAgentThoughtText,UpdatePlan,StartToolCall/UpdateToolCall(withWithStart*/WithUpdate*option funcs), and the convenience wrappersStartReadToolCall/StartEditToolCall. - Generic
Ptr[T](v T) *Tfor optional fields.
update := acp.StartReadToolCall("tool-1", "Read file", "/etc/hosts")
_ = conn.SessionUpdate(ctx, acp.SessionNotification{SessionId: id, Update: update})Examples
Runnable examples under example/ that double as integration smoke tests:
go run ./example/agent— a minimal ACP agent over stdio.go run ./example/client— drives a sample turn against a running agent.go run ./example/claude-code— bridges to Claude Code.go run ./example/gemini— bridges to the Gemini CLI in ACP mode (-model,-sandbox,-debug,-gemini /path/to/gemini).
Tooling
cmd/generateregenerates the_gen.gobindings fromschema/schema.jsonandschema/meta.json.- JSON golden fixtures in
testdata/json_golden/and a parity test (json_parity_test.go) that locks wire-format compatibility with the reference TypeScript implementation. - Nix flake plus
maketargets for reproducible work:make version(bump and regenerate fromschema/version),make test,make fmt,make check, andmake release VERSION=X.Y.Zfor a guided release flow.
Full Changelog: https://github.com/coder/acp-go-sdk/commits/v0.4.3