Skip to main content
The Agent Client Protocol (ACP) is a standardized JSON-RPC protocol for AI agent communication. Goose implements ACP for rich, bidirectional integration with IDEs, desktop applications, and other tools.

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

Use ACP for desktop applications and IDE integrations where you need rich tool feedback and permission prompts. Use the REST API for simpler web-based integrations.

Quick Start

Running ACP Server

The server communicates via stdin/stdout using JSON-RPC.

Python Client Example

See test_acp_client.py in the source repository for a complete example:

Protocol Methods

Connection Lifecycle

initialize

Establish connection and exchange capabilities. Request:
Response:

Session Management

session/new

Create a new session with optional MCP servers. Request:
Response:

session/load

Load an existing session by ID. Request:
Response: Returns full conversation history as a series of session/notification notifications, followed by the response:

session/prompt

Send a prompt and receive streaming responses. Request:
Response:
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 during session/prompt.

session/notification - Agent Message

session/notification - Tool Call

session/notification - Tool Call Update

Includes file locations for editor integration:
The locations field enables IDE integrations to highlight or navigate to files modified by tools.

requestPermission - Interactive Approval

For sensitive operations, the agent requests permission:
Client Response:

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:
Response:

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:
Ideal for:
  • 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: sacp crate (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:
Supported 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:
Sessions accumulate until the transport closes.

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)