Skip to main content
The Agent Client Protocol allows Agents and Clients to communicate by exposing methods that each side can call and sending notifications to inform each other of events.

Communication Model

The protocol follows the JSON-RPC 2.0 specification with two types of messages:
  • Methods: Request-response pairs that expect a result or error
  • Notifications: One-way messages that don’t expect a response
ACP v2 follows JSON-RPC 2.0 batch behavior. See Transports for batch handling requirements.

Message Flow

A typical flow follows this pattern:
1

Initialization Phase

  • Client → Agent: initialize to establish connection
  • Client → Agent: authenticate if required by the Agent
2

Session Setup - either:

  • Client → Agent: session/new to create a new session
  • Client → Agent: session/load to resume an existing session if supported
3

Prompt Turn

  • Client → Agent: session/prompt to send user message
  • Agent → Client: session/update notifications for progress updates
  • Agent → Client: File operations or permission requests as needed
  • Client → Agent: session/cancel to interrupt processing if needed
  • Turn ends and the Agent sends the session/prompt response with a stop reason

Agent

Agents are programs that use generative AI to autonomously modify code. They typically run as subprocesses of the Client.

Baseline Methods

authenticate
Authenticate with the Agent (if required).
session/prompt
Send user prompts to the Agent.

Optional Methods

session/load
Load an existing session (requires session.load capability).
logout
End the current authenticated state (requires capabilities.auth.logout capability).

Notifications

session/cancel
Cancel ongoing operations (no response expected).

Client

Clients provide the interface between users and agents. They are typically code editors (IDEs, text editors) but can also be other UIs for interacting with agents. Clients manage the environment, handle user interactions, and control access to resources.

Baseline Methods

session/request_permission

Notifications

session/update

Argument requirements

  • All file paths in the protocol MUST be absolute.
  • Line numbers are 1-based

Error Handling

All methods follow standard JSON-RPC 2.0 error handling:
  • Successful responses include a result field
  • Errors include an error object with code and message
  • Notifications never receive responses (success or error)

Conventions

Unless explicitly defined otherwise in the schema, ACP-defined JSON object property keys use camelCase. String values carried by discriminator fields use snake_case. The JSON-RPC envelope fields (jsonrpc, id, method, params, result, and error) follow the JSON-RPC 2.0 specification. In v2, selected enum-like fields and tagged unions can define custom or future fallbacks. For those fields, _-prefixed values are reserved for implementation-specific extensions, while unknown non-underscore values are reserved for future ACP variants.

Extensibility

The protocol provides built-in mechanisms for adding custom functionality while maintaining compatibility:
  • Add custom data using _meta fields
  • Create custom methods by prefixing their name with underscore (_)
  • Advertise custom capabilities during initialization
Learn about protocol extensibility to understand how to use these mechanisms.

Next Steps