github coder/acp-go-sdk v0.4.3
v0.4.3: Initial release

latest releases: v0.13.5, v0.13.4, v0.13.0...
10 months ago

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.3

Added

Core API

  • Agent side: implement acp.Agent (and optionally acp.AgentLoader for session/load), then wire it up with acp.NewAgentSideConnection(agent, os.Stdout, os.Stdin).
  • Client side: implement acp.Client (and optionally acp.ClientTerminal for terminal features), then call acp.NewClientSideConnection(client, stdin, stdout) and drive a turn via InitializeNewSessionPrompt.
  • Both connection types expose Done() for peer-disconnect signalling and SetLogger(*slog.Logger) for diagnostics.
  • RequestError and JSON-RPC error helpers in errors.go for 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 (with WithStart* / WithUpdate* option funcs), and the convenience wrappers StartReadToolCall / StartEditToolCall.
  • Generic Ptr[T](v T) *T for 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/generate regenerates the _gen.go bindings from schema/schema.json and schema/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 make targets for reproducible work: make version (bump and regenerate from schema/version), make test, make fmt, make check, and make release VERSION=X.Y.Z for a guided release flow.

Full Changelog: https://github.com/coder/acp-go-sdk/commits/v0.4.3

Don't miss a new acp-go-sdk release

NewReleases is sending notifications on new releases.