Agent

Defines the interface that all ACP-compliant agents must implement. Agents are programs that use generative AI to autonomously modify code. They handle requests from clients and execute tasks using language models and tools.

authenticate

Authenticates the client using the specified authentication method. Called when the agent requires authentication before allowing session creation. The client provides the authentication method ID that was advertised during initialization. After successful authentication, the client can proceed to create sessions with new_session without receiving an auth_required error. See protocol docs: Initialization

AuthenticateRequest

Request parameters for the authenticate method. Specifies which authentication method to use. Type: Object Properties:
methodId
required
The ID of the authentication method to use. Must be one of the methods advertised in the initialize response.

initialize

Establishes the connection with a client and negotiates protocol capabilities. This method is called once at the beginning of the connection to:
  • Negotiate the protocol version to use
  • Exchange capability information between client and agent
  • Determine available authentication methods
The agent should respond with its supported protocol version and capabilities. See protocol docs: Initialization

InitializeRequest

Request parameters for the initialize method. Sent by the client to establish connection and negotiate capabilities. See protocol docs: Initialization Type: Object Properties:
clientCapabilities
Capabilities supported by the client.
  • Default: {"fs":{"readTextFile":false,"writeTextFile":false}}
protocolVersion
The latest protocol version supported by the client.

InitializeResponse

Response from the initialize method. Contains the negotiated protocol version and agent capabilities. See protocol docs: Initialization Type: Object Properties:
agentCapabilities
Capabilities supported by the agent.
  • Default: {"loadSession":false,"promptCapabilities":{"audio":false,"embeddedContext":false,"image":false}}
authMethods
Authentication methods supported by the agent.
  • Default: []
protocolVersion
The protocol version the client specified if supported by the agent, or the latest protocol version supported by the agent.The client should disconnect, if it doesn’t support this version.

session/cancel

Cancels ongoing operations for a session. This is a notification sent by the client to cancel an ongoing prompt turn. Upon receiving this notification, the Agent SHOULD:
  • Stop all language model requests as soon as possible
  • Abort all tool call invocations in progress
  • Send any pending session/update notifications
  • Respond to the original session/prompt request with StopReason::Cancelled
See protocol docs: Cancellation

CancelNotification

Notification to cancel ongoing operations for a session. See protocol docs: Cancellation Type: Object Properties:
sessionId
required
The ID of the session to cancel operations for.

session/load

Loads an existing session to resume a previous conversation. This method is only available if the agent advertises the loadSession capability. The agent should:
  • Restore the session context and conversation history
  • Connect to the specified MCP servers
  • Stream the entire conversation history back to the client via notifications
See protocol docs: Loading Sessions

LoadSessionRequest

Request parameters for loading an existing session. Only available if the agent supports the loadSession capability. See protocol docs: Loading Sessions Type: Object Properties:
cwd
string
required
The working directory for this session.
mcpServers
required
List of MCP servers to connect to for this session.
sessionId
required
The ID of the session to load.

session/new

Creates a new conversation session with the agent. Sessions represent independent conversation contexts with their own history and state. The agent should:
  • Create a new session context
  • Connect to any specified MCP servers
  • Return a unique session ID for future requests
May return an auth_required error if the agent requires authentication. See protocol docs: Session Setup

NewSessionRequest

Request parameters for creating a new session. See protocol docs: Creating a Session Type: Object Properties:
cwd
string
required
The working directory for this session. Must be an absolute path.
mcpServers
required
List of MCP (Model Context Protocol) servers the agent should connect to.

NewSessionResponse

Response from creating a new session. See protocol docs: Creating a Session Type: Object Properties:
sessionId
required
Unique identifier for the created session.Used in all subsequent requests for this conversation.

session/prompt

Processes a user prompt within a session. This method handles the whole lifecycle of a prompt:
  • Receives user messages with optional context (files, images, etc.)
  • Processes the prompt using language models
  • Reports language model content and tool calls to the Clients
  • Requests permission to run tools
  • Executes any requested tool calls
  • Returns when the turn is complete with a stop reason
See protocol docs: Prompt Turn

PromptRequest

Request parameters for sending a user prompt to the agent. Contains the user’s message and any additional context. See protocol docs: User Message Type: Object Properties:
prompt
required
The blocks of content that compose the user’s message.As a baseline, the Agent MUST support ContentBlock::Text and ContentBlock::ResourceLink, while other variants are optionally enabled via PromptCapabilities.The Client MUST adapt its interface according to PromptCapabilities.The client MAY include referenced pieces of context as either ContentBlock::Resource or ContentBlock::ResourceLink.When available, ContentBlock::Resource is preferred as it avoids extra round-trips and allows the message to include pieces of context from sources the agent may not have access to.
sessionId
required
The ID of the session to send this user message to

PromptResponse

Response from processing a user prompt. See protocol docs: Check for Completion Type: Object Properties:
stopReason
required
Indicates why the agent stopped processing the turn.

Client

Defines the interface that ACP-compliant clients must implement. Clients are typically code editors (IDEs, text editors) that provide the interface between users and AI agents. They manage the environment, handle user interactions, and control access to resources.

fs/read_text_file

Reads content from a text file in the client’s file system. Only available if the client advertises the fs.readTextFile capability. Allows the agent to access file contents within the client’s environment. See protocol docs: Client

ReadTextFileRequest

Request to read content from a text file. Only available if the client supports the fs.readTextFile capability. Type: Object Properties:
limit
integer | null
Optional maximum number of lines to read.
  • Minimum: 0
line
integer | null
Optional line number to start reading from (1-based).
  • Minimum: 0
path
string
required
Absolute path to the file to read.
sessionId
required
The session ID for this request.

fs/write_text_file

Writes content to a text file in the client’s file system. Only available if the client advertises the fs.writeTextFile capability. Allows the agent to create or modify files within the client’s environment. See protocol docs: Client

WriteTextFileRequest

Request to write content to a text file. Only available if the client supports the fs.writeTextFile capability. Type: Object Properties:
content
string
required
The text content to write to the file.
path
string
required
Absolute path to the file to write.
sessionId
required
The session ID for this request.

session/request_permission

Requests permission from the user for a tool call operation. Called by the agent when it needs user authorization before executing a potentially sensitive operation. The client should present the options to the user and return their decision. If the client cancels the prompt turn via session/cancel, it MUST respond to this request with RequestPermissionOutcome::Cancelled. See protocol docs: Requesting Permission

RequestPermissionRequest

Request for user permission to execute a tool call. Sent when the agent needs authorization before performing a sensitive operation. See protocol docs: Requesting Permission Type: Object Properties:
options
Available permission options for the user to choose from.
sessionId
required
The session ID for this request.
toolCall
Details about the tool call requiring permission.

RequestPermissionResponse

Response to a permission request. Type: Object Properties:
The user’s decision on the permission request.

session/update

Handles session update notifications from the agent. This is a notification endpoint (no response expected) that receives real-time updates about session progress, including message chunks, tool calls, and execution plans. Note: Clients SHOULD continue accepting tool call updates even after sending a session/cancel notification, as the agent may send final updates before responding with the cancelled stop reason. See protocol docs: Agent Reports Output

SessionNotification

Notification containing a session update from the agent. Used to stream real-time progress and results during prompt processing. See protocol docs: Agent Reports Output Type: Object Properties:
sessionId
required
The ID of the session this update pertains to.
update
The actual update content.

AgentCapabilities

Capabilities supported by the agent. Advertised during initialization to inform the client about available features and content types. See protocol docs: Agent Capabilities Type: Object Properties:
loadSession
boolean
Whether the agent supports session/load.
  • Default: false
promptCapabilities
Prompt capabilities supported by the agent.
  • Default: {"audio":false,"embeddedContext":false,"image":false}

Annotations

Optional annotations for the client. The client can use annotations to inform how objects are used or displayed Type: Object Properties:
audience
array | null
lastModified
string | null
priority
number | null

AudioContent

Audio provided to or from an LLM. Type: Object Properties:
annotations
data
string
required
mimeType
string
required

AuthMethod

Describes an available authentication method. Type: Object Properties:
description
string | null
Optional description providing more details about this authentication method.
id
required
Unique identifier for this authentication method.
name
string
required
Human-readable name of the authentication method.

AuthMethodId

Unique identifier for an authentication method. Type: string

BlobResourceContents

Binary resource contents. Type: Object Properties:
blob
string
required
mimeType
string | null
uri
string
required

ClientCapabilities

Capabilities supported by the client. Advertised during initialization to inform the agent about available features and methods. See protocol docs: Client Capabilities Type: Object Properties:
File system capabilities supported by the client. Determines which file operations the agent can request.
  • Default: {"readTextFile":false,"writeTextFile":false}

ContentBlock

Content blocks represent displayable information in the Agent Client Protocol. They provide a structured way to handle various types of user-facing content—whether it’s text from language models, images for analysis, or embedded resources for context. Content blocks appear in:
  • User prompts sent via session/prompt
  • Language model output streamed through session/update notifications
  • Progress updates and results from tool calls
This structure is compatible with the Model Context Protocol (MCP), enabling agents to seamlessly forward content from MCP tool outputs without transformation. See protocol docs: Content Type: Union
text
Plain text contentAll agents MUST support text content blocks in prompts.
image
Images for visual context or analysis.Requires the image prompt capability when included in prompts.
audio
Audio data for transcription or analysis.Requires the audio prompt capability when included in prompts.
References to resources that the agent can access.All agents MUST support resource links in prompts.
resource
Complete resource contents embedded directly in the message.Preferred for including context as it avoids extra round-trips.Requires the embeddedContext prompt capability when included in prompts.

EmbeddedResource

The contents of a resource, embedded into a prompt or tool call result. Type: Object Properties:
annotations

EmbeddedResourceResource

Resource content that can be embedded in a message. Type: Union
TextResourceContents
BlobResourceContents

EnvVariable

An environment variable to set when launching an MCP server. Type: Object Properties:
name
string
required
The name of the environment variable.
value
string
required
The value to set for the environment variable.

FileSystemCapability

File system capabilities that a client may support. See protocol docs: FileSystem Type: Object Properties:
readTextFile
boolean
Whether the Client supports fs/read_text_file requests.
  • Default: false
writeTextFile
boolean
Whether the Client supports fs/write_text_file requests.
  • Default: false

ImageContent

An image provided to or from an LLM. Type: Object Properties:
annotations
data
string
required
mimeType
string
required
uri
string | null

McpServer

Configuration for connecting to an MCP (Model Context Protocol) server. MCP servers provide tools and context that the agent can use when processing prompts. See protocol docs: MCP Servers Type: Object Properties:
args
"string"[]
required
Command-line arguments to pass to the MCP server.
command
string
required
Path to the MCP server executable.
env
required
Environment variables to set when launching the MCP server.
name
string
required
Human-readable name identifying this MCP server.

PermissionOption

An option presented to the user when requesting permission. Type: Object Properties:
Hint about the nature of this permission option.
name
string
required
Human-readable label to display to the user.
optionId
Unique identifier for this permission option.

PermissionOptionId

Unique identifier for a permission option. Type: string

PermissionOptionKind

The type of permission option being presented to the user. Helps clients choose appropriate icons and UI treatment. Type: Union
allow_once
Allow this operation only this time.
allow_always
Allow this operation and remember the choice.
reject_once
Reject this operation only this time.
reject_always
Reject this operation and remember the choice.

Plan

An execution plan for accomplishing complex tasks. Plans consist of multiple entries representing individual tasks or goals. Agents report plans to clients to provide visibility into their execution strategy. Plans can evolve during execution as the agent discovers new requirements or completes tasks. See protocol docs: Agent Plan Type: Object Properties:
entries
required
The list of tasks to be accomplished.When updating a plan, the agent must send a complete list of all entries with their current status. The client replaces the entire plan with each update.

PlanEntry

A single entry in the execution plan. Represents a task or goal that the assistant intends to accomplish as part of fulfilling the user’s request. See protocol docs: Plan Entries Type: Object Properties:
content
string
required
Human-readable description of what this task aims to accomplish.
priority
The relative importance of this task. Used to indicate which tasks are most critical to the overall goal.
status
Current execution status of this task.

PlanEntryPriority

Priority levels for plan entries. Used to indicate the relative importance or urgency of different tasks in the execution plan. See protocol docs: Plan Entries Type: Union
high
High priority task - critical to the overall goal.
medium
Medium priority task - important but not critical.
low
Low priority task - nice to have but not essential.

PlanEntryStatus

Status of a plan entry in the execution flow. Tracks the lifecycle of each task from planning through completion. See protocol docs: Plan Entries Type: Union
pending
The task has not started yet.
in_progress
The task is currently being worked on.
completed
The task has been successfully completed.

PromptCapabilities

Prompt capabilities supported by the agent in session/prompt requests. Baseline agent functionality requires support for ContentBlock::Text and ContentBlock::ResourceLink in prompt requests. Other variants must be explicitly opted in to. Capabilities for different types of content in prompt requests. Indicates which content types beyond the baseline (text and resource links) the agent can process. See protocol docs: Prompt Capabilities Type: Object Properties:
audio
boolean
Agent supports ContentBlock::Audio.
  • Default: false
embeddedContext
boolean
Agent supports embedded context in session/prompt requests.When enabled, the Client is allowed to include ContentBlock::Resource in prompt requests for pieces of context that are referenced in the message.
  • Default: false
image
boolean
Agent supports ContentBlock::Image.
  • Default: false

ProtocolVersion

Protocol version identifier. This version is only bumped for breaking changes. Non-breaking changes should be introduced via capabilities. Type: integer (uint16)
ConstraintValue
Minimum0
Maximum65535

ReadTextFileResponse

Response containing the contents of a text file. Type: Object Properties:
content
string
required

RequestPermissionOutcome

The outcome of a permission request. Type: Union
cancelled
The prompt turn was cancelled before the user responded.When a client sends a session/cancel notification to cancel an ongoing prompt turn, it MUST respond to all pending session/request_permission requests with this Cancelled outcome.See protocol docs: Cancellation
selected
The user selected one of the provided options.
A resource that the server is capable of reading, included in a prompt or tool call result. Type: Object Properties:
annotations
description
string | null
mimeType
string | null
name
string
required
size
integer | null
title
string | null
uri
string
required

Role

The sender or recipient of messages and data in a conversation. Type: Enumeration
Value
"assistant"
"user"

SessionId

A unique identifier for a conversation session between a client and agent. Sessions maintain their own context, conversation history, and state, allowing multiple independent interactions with the same agent. # Example
use agent_client_protocol::SessionId;
use std::sync::Arc;

let session_id = SessionId(Arc::from("sess_abc123def456"));
See protocol docs: Session ID Type: string

SessionUpdate

Different types of updates that can be sent during session processing. These updates provide real-time feedback about the agent’s progress. See protocol docs: Agent Reports Output Type: Union
user_message_chunk
A chunk of the user’s message being streamed.
agent_message_chunk
A chunk of the agent’s response being streamed.
agent_thought_chunk
A chunk of the agent’s internal reasoning being streamed.
tool_call
Notification that a new tool call has been initiated.
tool_call_update
Update on the status or results of a tool call.
plan
The agent’s execution plan for complex tasks. See protocol docs: Agent Plan

StopReason

Reasons why an agent stops processing a prompt turn. See protocol docs: Stop Reasons Type: Union
end_turn
The turn ended successfully.
max_tokens
The turn ended because the agent reached the maximum number of tokens.
max_turn_requests
The turn ended because the agent reached the maximum number of allowed agent requests between user turns.
refusal
The turn ended because the agent refused to continue. The user prompt and everything that comes after it won’t be included in the next prompt, so this should be reflected in the UI.
cancelled
The turn was cancelled by the client via session/cancel.This stop reason MUST be returned when the client sends a session/cancel notification, even if the cancellation causes exceptions in underlying operations. Agents should catch these exceptions and return this semantically meaningful response to confirm successful cancellation.

TextContent

Text provided to or from an LLM. Type: Object Properties:
annotations
text
string
required

TextResourceContents

Text-based resource contents. Type: Object Properties:
mimeType
string | null
text
string
required
uri
string
required

ToolCall

Represents a tool call that the language model has requested. Tool calls are actions that the agent executes on behalf of the language model, such as reading files, executing code, or fetching data from external sources. See protocol docs: Tool Calls Type: Object Properties:
Content produced by the tool call.
The category of tool being invoked. Helps clients choose appropriate icons and UI treatment.
File locations affected by this tool call. Enables “follow-along” features in clients.
rawInput
object
Raw input parameters sent to the tool.
rawOutput
object
Raw output returned by the tool.
Current execution status of the tool call.
title
string
required
Human-readable title describing what the tool is doing.
toolCallId
required
Unique identifier for this tool call within the session.

ToolCallContent

Content produced by a tool call. Tool calls can produce different types of content including standard content blocks (text, images) or file diffs. See protocol docs: Content Type: Union
content
Standard content block (text, images, resources).
diff
File modification shown as a diff.

ToolCallId

Unique identifier for a tool call within a session. Type: string

ToolCallLocation

A file location being accessed or modified by a tool. Enables clients to implement “follow-along” features that track which files the agent is working with in real-time. See protocol docs: Following the Agent Type: Object Properties:
line
integer | null
Optional line number within the file.
  • Minimum: 0
path
string
required
The file path being accessed or modified.

ToolCallStatus

Execution status of a tool call. Tool calls progress through different statuses during their lifecycle. See protocol docs: Status Type: Union
pending
The tool call hasn’t started running yet because the input is either streaming or we’re awaiting approval.
in_progress
The tool call is currently running.
completed
The tool call completed successfully.
failed
The tool call failed with an error.

ToolCallUpdate

An update to an existing tool call. Used to report progress and results as tools execute. All fields except the tool call ID are optional - only changed fields need to be included. See protocol docs: Updating Type: Object Properties:
content
array | null
Replace the content collection.
kind
ToolKind | null
Update the tool kind.
locations
array | null
Replace the locations collection.
rawInput
object
Update the raw input.
rawOutput
object
Update the raw output.
status
Update the execution status.
title
string | null
Update the human-readable title.
toolCallId
required
The ID of the tool call being updated.

ToolKind

Categories of tools that can be invoked. Tool kinds help clients choose appropriate icons and optimize how they display tool execution progress. See protocol docs: Creating Type: Union
read
Reading files or data.
edit
Modifying files or content.
delete
Removing files or data.
move
Moving or renaming files.
Searching for information.
execute
Running commands or code.
think
Internal reasoning or planning.
fetch
Retrieving external data.
other
Other tool types (default).