Expand description
§Agent Client Protocol (ACP)
The Agent Client Protocol standardizes communication between code editors (IDEs, text-editors, etc.) and coding agents (programs that use generative AI to autonomously modify code).
§Protocol & Transport
ACP is a JSON-RPC based protocol. While clients typically start agents as subprocesses and communicate over stdio (stdin/stdout), this crate is transport-agnostic.
You can use any bidirectional stream that implements AsyncRead
and AsyncWrite
.
§Core Components
- Agent: Programs that use generative AI to autonomously modify code
- See: Agent
- Client: Code editors that provide the interface between users and agents
- See: Client
§Getting Started
To understand the protocol, start by exploring the Agent
and Client
traits,
which define the core methods and capabilities of each side of the connection.
To see working examples of these traits in action, check out the agent and client example binaries included with this crate.
§Implementation Pattern
ACP uses a symmetric design where each participant implements one trait and creates a connection that provides the complementary trait:
-
Agent builders implement the
Agent
trait to handle client requests (like initialization, authentication, and prompts). They pass this implementation toAgentSideConnection::new
, which returns a connection providingClient
methods for requesting permissions and accessing the file system. -
Client builders implement the
Client
trait to handle agent requests (like file system operations and permission checks). They pass this implementation toClientSideConnection::new
, which returns a connection providingAgent
methods for managing sessions and sending prompts.
For the complete protocol specification and documentation, visit: https://agentclientprotocol.com
Structs§
- Agent
Capabilities - Capabilities supported by the agent.
- Agent
Method Names - Names of all methods that agents handle.
- Agent
Side - Marker type representing the agent side of an ACP connection.
- Agent
Side Connection - An agent-side connection to a client.
- Annotations
- Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
- Audio
Content - Audio provided to or from an LLM.
- Auth
Method - Describes an available authentication method.
- Auth
Method Id - Unique identifier for an authentication method.
- Authenticate
Request - Request parameters for the authenticate method.
- Blob
Resource Contents - Binary resource contents.
- Cancel
Notification - Notification to cancel ongoing operations for a session.
- Client
Capabilities - Capabilities supported by the client.
- Client
Method Names - Names of all methods that clients handle.
- Client
Side - Marker type representing the client side of an ACP connection.
- Client
Side Connection - A client-side connection to an agent.
- Diff
- A diff representing file modifications.
- Embedded
Resource - The contents of a resource, embedded into a prompt or tool call result.
- EnvVariable
- An environment variable to set when launching an MCP server.
- Error
- JSON-RPC error object.
- Error
Code - Predefined error codes for common JSON-RPC and ACP-specific errors.
- File
System Capability - File system capabilities that a client may support.
- Image
Content - An image provided to or from an LLM.
- Initialize
Request - Request parameters for the initialize method.
- Initialize
Response - Response from the initialize method.
- Load
Session Request - Request parameters for loading an existing session.
- McpServer
- Configuration for connecting to an MCP (Model Context Protocol) server.
- NewSession
Request - Request parameters for creating a new session.
- NewSession
Response - Response from creating a new session.
- Permission
Option - An option presented to the user when requesting permission.
- Permission
Option Id - Unique identifier for a permission option.
- Plan
- An execution plan for accomplishing complex tasks.
- Plan
Entry - A single entry in the execution plan.
- Prompt
Capabilities - Prompt capabilities supported by the agent in
session/prompt
requests. - Prompt
Request - Request parameters for sending a user prompt to the agent.
- Prompt
Response - Response from processing a user prompt.
- Protocol
Version - Protocol version identifier.
- Read
Text File Request - Request to read content from a text file.
- Read
Text File Response - Response containing the contents of a text file.
- Request
Permission Request - Request for user permission to execute a tool call.
- Request
Permission Response - Response to a permission request.
- Resource
Link - A resource that the server is capable of reading, included in a prompt or tool call result.
- Session
Id - A unique identifier for a conversation session between a client and agent.
- Session
Notification - Notification containing a session update from the agent.
- Stream
Message - A message that flows through the RPC stream.
- Stream
Receiver - A receiver for observing the message stream.
- Text
Content - Text provided to or from an LLM.
- Text
Resource Contents - Text-based resource contents.
- Tool
Call - Represents a tool call that the language model has requested.
- Tool
Call Id - Unique identifier for a tool call within a session.
- Tool
Call Location - A file location being accessed or modified by a tool.
- Tool
Call Update - An update to an existing tool call.
- Tool
Call Update Fields - Optional fields that can be updated in a tool call.
- Write
Text File Request - Request to write content to a text file.
Enums§
- Agent
Notification - All possible notifications that an agent can send to a client.
- Agent
Request - All possible requests that an agent can send to a client.
- Agent
Response - All possible responses that an agent can send to a client.
- Client
Notification - All possible notifications that a client can send to an agent.
- Client
Request - All possible requests that a client can send to an agent.
- Client
Response - All possible responses that a client can send to an agent.
- Content
Block - Content blocks represent displayable information in the Agent Client Protocol.
- Embedded
Resource Resource - Resource content that can be embedded in a message.
- Permission
Option Kind - The type of permission option being presented to the user.
- Plan
Entry Priority - Priority levels for plan entries.
- Plan
Entry Status - Status of a plan entry in the execution flow.
- Request
Permission Outcome - The outcome of a permission request.
- Role
- The sender or recipient of messages and data in a conversation.
- Session
Update - Different types of updates that can be sent during session processing.
- Stop
Reason - Reasons why an agent stops processing a prompt turn.
- Stream
Message Content - The content of a stream message.
- Stream
Message Direction - The direction of a message in the RPC stream.
- Tool
Call Content - Content produced by a tool call.
- Tool
Call Status - Execution status of a tool call.
- Tool
Kind - Categories of tools that can be invoked.
Constants§
- AGENT_
METHOD_ NAMES - Constant containing all agent method names.
- CLIENT_
METHOD_ NAMES - Constant containing all client method names.
- V0
- V1
- VERSION