Creates a new agent-side connection to a client.
This establishes the communication channel from the agent's perspective following the ACP specification.
A function that creates an Agent handler to process incoming client requests
The stream for sending data to the client (typically stdout)
The stream for receiving data from the client (typically stdin)
See protocol docs: Communication Model
Handles session update notifications from the agent.
This is a notification endpoint (no response expected) that sends 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
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
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
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
An agent-side connection to a client.
This class provides the agent's view of an ACP connection, allowing agents to communicate with clients. It implements the Client interface to provide methods for requesting permissions, accessing the file system, and sending session updates.
See protocol docs: Agent