Protocol Version
PROTOCOL_VERSION
The current version of the Agent Client Protocol.Method Name Constants
The SDK exports constants for all protocol method names. These ensure type safety and prevent typos when working with method names directly.AGENT_METHODS
Method names for requests sent to agents (client-to-agent).Usage Example
Method Descriptions
authenticate: Authenticate with the agentinitialize: Initialize the connectionsession_cancel: Cancel ongoing session operationssession_fork: Fork an existing session (UNSTABLE)session_list: List available sessions (UNSTABLE)session_load: Load an existing sessionsession_new: Create a new sessionsession_prompt: Send a prompt to the sessionsession_resume: Resume a stopped session (UNSTABLE)session_set_config_option: Update a configuration optionsession_set_mode: Change the session modesession_set_model: Change the session model (UNSTABLE)session_stop: Stop a running session (UNSTABLE)
CLIENT_METHODS
Method names for requests sent to clients (agent-to-client).Usage Example
Method Descriptions
File System Methods:fs_read_text_file: Read a text file from the file systemfs_write_text_file: Write a text file to the file system
session_request_permission: Request user permission for an operationsession_update: Stream session updates (notification)
terminal_create: Create a new terminalterminal_kill: Kill a terminal processterminal_output: Get terminal outputterminal_release: Release a terminalterminal_wait_for_exit: Wait for terminal to exit
Type Safety
All method constant objects are defined withas const to ensure type safety:
Working with Custom Methods
While the protocol defines standard methods, you can also use custom extension methods:x- to avoid conflicts with future protocol additions.
Notification Methods
Some methods are notifications (one-way messages) rather than requests:- Don’t expect a response
- Don’t have a request ID
- Are used for streaming updates
Method Naming Convention
The protocol uses a consistent naming pattern:- Method names use lowercase with slashes:
noun/verb - Constants use underscores:
noun_verb - TypeScript types use PascalCase:
VerbNounRequest/VerbNounResponse
| Protocol Method | Constant | Request Type | Response Type |
|---|---|---|---|
session/new | session_new | NewSessionRequest | NewSessionResponse |
session/prompt | session_prompt | PromptRequest | PromptResponse |
terminal/create | terminal_create | CreateTerminalRequest | CreateTerminalResponse |
fs/read_text_file | fs_read_text_file | ReadTextFileRequest | ReadTextFileResponse |