Overview
ACP provides:- Bidirectional communication: Agents can request permissions and receive cancellations
- Rich tool call handling: Detailed status updates, locations, and content
- Session management: Create, load, and resume sessions with full history
- MCP server integration: Dynamically add MCP servers to sessions
- Streaming responses: Real-time updates as the agent works
ACP vs REST API
Quick Start
Running ACP Server
Python Client Example
Seetest_acp_client.py in the source repository for a complete example:
Protocol Methods
Connection Lifecycle
initialize
Establish connection and exchange capabilities. Request:Session Management
session/new
Create a new session with optional MCP servers. Request:session/load
Load an existing session by ID. Request:session/notification notifications, followed by the response:
session/prompt
Send a prompt and receive streaming responses. Request:The response is sent only after all streaming notifications complete. Use notifications to receive real-time updates.
session/cancel
Cancel an in-progress prompt. Notification:Notifications (Agent → Client)
Notifications stream updates duringsession/prompt.
session/notification - Agent Message
session/notification - Tool Call
session/notification - Tool Call Update
Includes file locations for editor integration:requestPermission - Interactive Approval
For sensitive operations, the agent requests permission:Custom Methods
Goose extends ACP with custom methods for additional functionality._extensions/add
Add an MCP extension to a running session:_session/list
List all sessions:Other Custom Methods
_session/get: Get full session details_session/delete: Delete a session_session/export: Export session data_session/import: Import session data_extensions/remove: Remove an extension_tools: List available tools_resource/read: Read an MCP resource_working_dir/update: Change session working directory_config/extensions: Get extension configuration
Transport Options
stdio (Default)
Communicate via standard input/output:- CLI tools
- Editor plugins (VS Code, Neovim)
- Process-based integrations
WebSocket (Future)
WebSocket transport for browser-based clients:HTTP (Future)
HTTP transport for stateless clients:Implementation Details
Source Code
- ACP server:
crates/goose-acp/src/server.rs - CLI integration:
crates/goose-cli/src/cli.rs(Command::Acp) - Protocol library:
sacpcrate (vendored) - Custom methods:
crates/goose-acp/src/custom_requests.rs - Test client:
test_acp_client.py
Tool Location Extraction
Goose automatically extracts file locations from tool responses for developer tools:write: File creation (line 1)edit: File modification (parsed from output)view: File viewing (parsed from output)
Session State Management
ACP sessions are isolated per connection:Best Practices
Error Handling
Handle JSON-RPC errors gracefully:Notification Buffering
Buffer notifications during streaming:Cancellation
Implement cancellation for long-running operations:Resources
- ACP Specification: Anthropic Cookbook
- Goose ACP Implementation:
crates/goose-acp/ - Test Client:
test_acp_client.py - sacp Library:
vendor/sacp/(Rust ACP implementation)