Client

Trait Client 

Source
pub trait Client {
    // Required methods
    fn request_permission(
        &self,
        args: RequestPermissionRequest,
    ) -> impl Future<Output = Result<RequestPermissionResponse, Error>>;
    fn write_text_file(
        &self,
        args: WriteTextFileRequest,
    ) -> impl Future<Output = Result<(), Error>>;
    fn read_text_file(
        &self,
        args: ReadTextFileRequest,
    ) -> impl Future<Output = Result<ReadTextFileResponse, Error>>;
    fn session_notification(
        &self,
        args: SessionNotification,
    ) -> impl Future<Output = Result<(), Error>>;
}
Expand description

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.

Required Methods§

Source

fn request_permission( &self, args: RequestPermissionRequest, ) -> impl Future<Output = Result<RequestPermissionResponse, Error>>

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

Source

fn write_text_file( &self, args: WriteTextFileRequest, ) -> impl Future<Output = Result<(), Error>>

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

Source

fn read_text_file( &self, args: ReadTextFileRequest, ) -> impl Future<Output = Result<ReadTextFileResponse, Error>>

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

Source

fn session_notification( &self, args: SessionNotification, ) -> impl Future<Output = Result<(), Error>>

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§