Overview
The Agent interface 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.Type Definition
Required Methods
initialize
- Negotiate the protocol version to use
- Exchange capability information between client and agent
- Determine available authentication methods
InitializeRequest
required
The initialization request parameters
InitializeResponse
The agent’s capabilities and protocol version
newSession
- 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.
NewSessionRequest
required
The new session request parameters
NewSessionResponse
The new session information including session ID
authenticate
newSession without receiving an auth_required error.
AuthenticateRequest
required
The authentication request parameters
AuthenticateResponse | void
An empty object on success, or void
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
PromptRequest
required
The prompt request parameters
PromptResponse
The prompt response with stop reason
cancel
- 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
CancelNotification
required
The cancellation notification parameters
Promise<void>
A promise that resolves when the notification has been processed
Optional Methods
loadSession
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
LoadSessionRequest
required
The load session request parameters
LoadSessionResponse
An empty object on success
unstable_forkSession
session.fork capability.
ForkSessionRequest
required
The fork session request parameters
ForkSessionResponse
The forked session information
unstable_listSessions
listSessions capability.
Returns a list of sessions with metadata like session ID, working directory, title, and last update time. Supports filtering by working directory and cursor-based pagination.
ListSessionsRequest
required
The list sessions request parameters
ListSessionsResponse
The list of sessions with metadata
unstable_resumeSession
session.resume capability.
The agent should resume the session context, allowing the conversation to continue without replaying the message history (unlike session/load).
ResumeSessionRequest
required
The resume session request parameters
ResumeSessionResponse
The resumed session information
setSessionMode
availableModes during session creation or loading. Agents may also change modes autonomously and notify the client via current_mode_update notifications.
This method can be called at any time during a session, whether the Agent is idle or actively generating a turn.
SetSessionModeRequest
required
The set session mode request parameters
SetSessionModeResponse | void
An empty object on success, or void
unstable_setSessionModel
SetSessionModelRequest
required
The set session model request parameters
SetSessionModelResponse | void
An empty object on success, or void
setSessionConfigOption
SetSessionConfigOptionRequest
required
The set config option request parameters
SetSessionConfigOptionResponse
The full set of configuration options and their current values
extMethod
string
required
The extension method name
Record<string, unknown>
required
The extension method parameters
Record<string, unknown>
The extension method response
extNotification
string
required
The extension notification name
Record<string, unknown>
required
The extension notification parameters
Promise<void>
A promise that resolves when the notification has been processed