{"id":51162488,"url":"https://github.com/ironpark/acp-go","last_synced_at":"2026-06-26T15:02:19.031Z","repository":{"id":314393663,"uuid":"1055319998","full_name":"ironpark/acp-go","owner":"ironpark","description":"Agent Client Protocol (ACP) Implement For Golang","archived":false,"fork":false,"pushed_at":"2026-04-25T06:31:36.000Z","size":8202,"stargazers_count":28,"open_issues_count":1,"forks_count":5,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-10T11:28:59.054Z","etag":null,"topics":["acp","agent","agent-client-protocol","zed"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ironpark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"ironpark"}},"created_at":"2025-09-12T05:17:36.000Z","updated_at":"2026-06-02T07:41:34.000Z","dependencies_parsed_at":"2025-09-12T08:20:02.994Z","dependency_job_id":null,"html_url":"https://github.com/ironpark/acp-go","commit_stats":null,"previous_names":["ironpark/acp-go"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ironpark/acp-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ironpark%2Facp-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ironpark%2Facp-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ironpark%2Facp-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ironpark%2Facp-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ironpark","download_url":"https://codeload.github.com/ironpark/acp-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ironpark%2Facp-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34821764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acp","agent","agent-client-protocol","zed"],"created_at":"2026-06-26T15:02:15.593Z","updated_at":"2026-06-26T15:02:19.025Z","avatar_url":"https://github.com/ironpark.png","language":"Go","funding_links":["https://github.com/sponsors/ironpark"],"categories":[],"sub_categories":[],"readme":"![agent client protocol golang banner](./docs/imgs/banner-dark.jpg)\n\n# Agent Client Protocol - Go Implementation\n\nA Go implementation of the Agent Client Protocol (ACP), which standardizes communication between _code editors_ (interactive programs for viewing and editing source code) and _coding agents_ (programs that use generative AI to autonomously modify code).\n\nThis is an **unofficial** implementation of the ACP specification in Go. The official protocol specification and reference implementations can be found at the [official repository](https://github.com/zed-industries/agent-client-protocol).\n\n\u003e [!NOTE]\n\u003e The Agent Client Protocol is under active development. This implementation may lag behind the latest specification changes. Please refer to the [official repository](https://github.com/zed-industries/agent-client-protocol) for the most up-to-date protocol specification.\n\nLearn more about the protocol at [agentclientprotocol.com](https://agentclientprotocol.com/).\n\n## Installation\n\n```bash\ngo get github.com/ironpark/go-acp\n```\n\n## Example Code\nSee the [docs/example](./docs/example/) directory for complete working examples:\n\n- **[Agent Example](./docs/example/agent/)** - Agent implementation with SessionStream, middleware, and permission requests\n- **[Client Example](./docs/example/client/)** - Client implementation using SpawnAgent and MatchSessionUpdate\n\n## Architecture\n\nThis implementation provides a clean, modern architecture with bidirectional JSON-RPC 2.0 communication:\n\n- **`Connection`**: Unified bidirectional transport layer with concurrent request/response correlation\n- **`Transport`**: Pluggable transport interface (stdio, HTTP+SSE) for flexible deployment\n- **`AgentSideConnection`**: High-level ACP interface for implementing agents\n- **`ClientSideConnection`**: High-level ACP interface for implementing clients\n- **`SessionStream`**: Convenience wrapper for sending session updates with minimal boilerplate\n- **`Middleware`**: Composable request/response processing chain for cross-cutting concerns\n- **`TerminalHandle`**: Resource management wrapper for terminal sessions\n- **Generated Types**: Complete type-safe Go structs generated from the official ACP JSON schema\n\n## Quick Start\n\n### Agent\n\n```go\nagent := \u0026MyAgent{}\nconn := acp.NewAgentSideConnection(agent, os.Stdin, os.Stdout,\n    acp.WithMiddleware(acp.RecoveryMiddleware()),\n    acp.WithMiddleware(acp.LoggingMiddleware(nil)),\n)\nconn.Start(context.Background())\n```\n\n### Client\n\n```go\nclient := \u0026MyClient{}\nconn, _ := acp.SpawnAgent(ctx, client, \"my-agent\")\ngo conn.Start(ctx)\n\nconn.Initialize(ctx, \u0026acp.InitializeRequest{...})\nconn.Prompt(ctx, \u0026acp.PromptRequest{...})\n```\n\n## Features\n\n### Transport Layer\n\nThe SDK supports pluggable transports via the `Transport` interface:\n\n```go\n// Default: stdio (newline-delimited JSON)\nconn := acp.NewConnection(handler, os.Stdin, os.Stdout)\n\n// HTTP+SSE transport for web deployments\ntransport := acp.NewHTTPServerTransport()\nconn := acp.NewConnection(handler, nil, nil, acp.WithTransport(transport))\nhttp.Handle(\"/\", transport.Handler())\n```\n\n### Middleware\n\nAdd cross-cutting concerns to the connection handler chain:\n\n```go\nconn := acp.NewAgentSideConnection(agent, reader, writer,\n    acp.WithMiddleware(\n        acp.RecoveryMiddleware(),                   // catch panics\n        acp.LoggingMiddleware(log.Printf),          // log method calls\n        acp.TimeoutMiddleware(30 * time.Second),    // per-request timeout\n    ),\n)\n```\n\nCustom middleware follows the standard pattern:\n\n```go\nfunc authMiddleware(next acp.MethodHandler) acp.MethodHandler {\n    return func(ctx context.Context, method string, params json.RawMessage) (any, error) {\n        if method != \"initialize\" \u0026\u0026 !isAuthenticated(ctx) {\n            return nil, acp.ErrAuthRequired(nil)\n        }\n        return next(ctx, method, params)\n    }\n}\n```\n\n### SessionStream\n\nReduce boilerplate when sending session updates from agents:\n\n```go\nstream := acp.NewSessionStream(client, sessionID)\n\n// Stream text\nstream.SendText(ctx, \"Hello!\")\nstream.SendThought(ctx, \"thinking...\")\n\n// Tool call lifecycle\nstream.StartToolCall(ctx, toolID, \"Reading file\", acp.ToolKindRead)\nstream.CompleteToolCall(ctx, toolID, content...)\nstream.FailToolCall(ctx, toolID)\n\n// Other updates\nstream.SendPlan(ctx, entries)\nstream.SendModeUpdate(ctx, modeID)\nstream.SendSessionInfo(ctx, title, updatedAt)\n```\n\n### Match Pattern\n\nExhaustive pattern matching for discriminated union types:\n\n```go\nacp.MatchSessionUpdate(\u0026update, acp.SessionUpdateMatcher[string]{\n    AgentMessageChunk: func(v acp.SessionUpdateAgentMessageChunk) string {\n        return acp.MatchContentBlock(\u0026v.Content, acp.ContentBlockMatcher[string]{\n            Text: func(t acp.ContentBlockText) string { return t.Text },\n            Default: func() string { return \"[non-text]\" },\n        })\n    },\n    ToolCall: func(v acp.SessionUpdateToolCall) string {\n        return v.Title\n    },\n    Default: func() string { return \"\" },\n})\n```\n\nMatchers are available for all union types: `SessionUpdate`, `ContentBlock`, `ToolCallContent`, `RequestPermissionOutcome`, `MCPServer`.\n\n### Connection Options\n\n```go\nacp.NewConnection(handler, reader, writer,\n    acp.WithWriteQueueSize(500),                    // configurable write queue\n    acp.WithRequestTimeout(30 * time.Second),       // default request timeout\n    acp.WithShutdownTimeout(10 * time.Second),      // graceful shutdown timeout\n    acp.WithErrorHandler(func(err error) { ... }),   // error callback\n)\n```\n\n## Protocol Support\n\nThis implementation supports ACP Protocol Version 1 with the following features:\n\n### Agent Methods (Client → Agent)\n- `initialize` - Initialize the agent and negotiate capabilities\n- `authenticate` - Authenticate with the agent (optional)\n- `session/new` - Create a new conversation session\n- `session/load` - Load an existing session (if supported)\n- `session/list` - List available sessions\n- `session/set_mode` - Change session mode\n- `session/set_config_option` - Update session configuration\n- `session/prompt` - Send user prompt to agent\n- `session/cancel` - Cancel ongoing operations\n\n### Client Methods (Agent → Client)\n- `session/update` - Send session updates (notifications)\n- `session/request_permission` - Request user permission for operations\n- `fs/read_text_file` - Read text file from client filesystem\n- `fs/write_text_file` - Write text file to client filesystem\n- **Terminal Support** (unstable):\n  - `terminal/create` - Create terminal session\n  - `terminal/output` - Get terminal output\n  - `terminal/wait_for_exit` - Wait for terminal exit\n  - `terminal/kill` - Kill terminal process\n  - `terminal/release` - Release terminal handle\n\n### Unstable Features\n- `session/fork` - Fork a session (via `SessionForker` interface)\n- `session/resume` - Resume a session (via `SessionResumer` interface)\n- `session/close` - Close a session (via `SessionCloser` interface)\n- `session/set_model` - Set model (via `ModelSetter` interface)\n\n## Contributing\n\nThis is an unofficial implementation. For protocol specification changes, please contribute to the [official repository](https://github.com/zed-industries/agent-client-protocol).\n\nFor Go implementation issues and improvements, please open an issue or pull request.\n\n## License\n\nThis implementation follows the same license as the official ACP specification.\n\n## Related Projects\n\n- **Official ACP Repository**: [zed-industries/agent-client-protocol](https://github.com/zed-industries/agent-client-protocol)\n- **Rust Implementation**: Part of the official repository\n- **Protocol Documentation**: [agentclientprotocol.com](https://agentclientprotocol.com/)\n\n### Editors with ACP Support\n\n- [Zed](https://zed.dev/docs/ai/external-agents)\n- [neovim](https://neovim.io) through the [CodeCompanion](https://github.com/olimorris/codecompanion.nvim) plugin\n- [yetone/avante.nvim](https://github.com/yetone/avante.nvim): A Neovim plugin designed to emulate the behaviour of the Cursor AI IDE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fironpark%2Facp-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fironpark%2Facp-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fironpark%2Facp-go/lists"}