Overview
TheAgent interface defines the methods that all ACP-compliant agents must implement. These methods handle the lifecycle of the connection, session management, prompt processing, and cancellation.
Required Methods
initialize
Establishes the connection with a client and negotiates protocol capabilities.string
required
The protocol version requested by the client
object
required
Capabilities advertised by the client (file system access, terminal support, etc.)
string
required
The protocol version the agent will use (should match the client’s version)
object
required
Capabilities advertised by the agent (session loading, modes, etc.)
- Negotiate the protocol version to use
- Exchange capability information between client and agent
- Determine available authentication methods
Example
newSession
Creates a new conversation session with the agent.string
Optional working directory for the session
MCPServerConfig[]
MCP servers to connect to for this session
string
required
A unique identifier for the new session
Mode[]
Optional list of available modes for this session
string
The initial mode for this session
- Create a new session context
- Connect to any specified MCP servers
- Return a unique session ID for future requests
auth_required error if the agent requires authentication.
See protocol docs: Session Setup
Example
authenticate
Authenticates the client using the specified authentication method.string
required
The authentication method ID that was advertised during initialization
object
Optional credentials provided by the client
newSession without receiving an auth_required error.
See protocol docs: Initialization
Example
prompt
Processes a user prompt within a session.string
required
The session ID to process the prompt in
Message[]
required
The user messages with optional context (files, images, etc.)
StopReason
required
The reason the prompt turn ended: “end_turn”, “cancelled”, or “error”
- Receives user messages with optional context
- Processes the prompt using language models
- Reports language model content and tool calls to the client
- Requests permission to run tools
- Executes any requested tool calls
- Returns when the turn is complete with a stop reason
Example
cancel
Cancels ongoing operations for a session.string
required
The session ID to cancel operations for
- Stop all language model requests as soon as possible
- Abort all tool call invocations in progress
- Send any pending
session/updatenotifications - Respond to the original
session/promptrequest withStopReason::Cancelled
Example
Optional Methods
loadSession
Loads an existing session to resume a previous conversation.string
required
The session ID to load
MCPServerConfig[]
MCP servers to connect to for this session
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
setSessionMode
Sets the operational mode for a session.string
required
The session ID to update
string
required
The mode to switch to (must be one of the advertised modes)
Unstable Methods
The following methods are marked as UNSTABLE and may be removed or changed at any point:unstable_forkSession: Forks an existing session to create a new independent sessionunstable_listSessions: Lists existing sessions from the agentunstable_resumeSession: Resumes an existing session without returning previous messagesunstable_setSessionModel: Selects a model for a given session
Extension Methods
extMethod: Allows custom request handlers not part of the ACP specificationextNotification: Allows custom notification handlers not part of the ACP specification