AgentRequest

Enum AgentRequest 

Source
pub enum AgentRequest {
    WriteTextFileRequest(WriteTextFileRequest),
    ReadTextFileRequest(ReadTextFileRequest),
    RequestPermissionRequest(RequestPermissionRequest),
    CreateTerminalRequest(CreateTerminalRequest),
    TerminalOutputRequest(TerminalOutputRequest),
    ReleaseTerminalRequest(ReleaseTerminalRequest),
    WaitForTerminalExitRequest(WaitForTerminalExitRequest),
    KillTerminalCommandRequest(KillTerminalCommandRequest),
    ExtMethodRequest(ExtRequest),
}
Expand description

All possible requests that an agent can send to a client.

This enum is used internally for routing RPC requests. You typically won’t need to use this directly - instead, use the methods on the [Client] trait.

This enum encompasses all method calls from agent to client.

Variants§

§

WriteTextFileRequest(WriteTextFileRequest)

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

§

ReadTextFileRequest(ReadTextFileRequest)

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

§

RequestPermissionRequest(RequestPermissionRequest)

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

§

CreateTerminalRequest(CreateTerminalRequest)

Executes a command in a new terminal

Only available if the terminal Client capability is set to true.

Returns a TerminalId that can be used with other terminal methods to get the current output, wait for exit, and kill the command.

The TerminalId can also be used to embed the terminal in a tool call by using the ToolCallContent::Terminal variant.

The Agent is responsible for releasing the terminal by using the terminal/release method.

See protocol docs: Terminals

§

TerminalOutputRequest(TerminalOutputRequest)

Gets the terminal output and exit status

Returns the current content in the terminal without waiting for the command to exit. If the command has already exited, the exit status is included.

See protocol docs: Terminals

§

ReleaseTerminalRequest(ReleaseTerminalRequest)

Releases a terminal

The command is killed if it hasn’t exited yet. Use terminal/wait_for_exit to wait for the command to exit before releasing the terminal.

After release, the TerminalId can no longer be used with other terminal/* methods, but tool calls that already contain it, continue to display its output.

The terminal/kill method can be used to terminate the command without releasing the terminal, allowing the Agent to call terminal/output and other methods.

See protocol docs: Terminals

§

WaitForTerminalExitRequest(WaitForTerminalExitRequest)

Waits for the terminal command to exit and return its exit status

See protocol docs: Terminals

§

KillTerminalCommandRequest(KillTerminalCommandRequest)

Kills the terminal command without releasing the terminal

While terminal/release will also kill the command, this method will keep the TerminalId valid so it can be used with other methods.

This method can be helpful when implementing command timeouts which terminate the command as soon as elapsed, and then get the final output so it can be sent to the model.

Note: terminal/release when TerminalId is no longer needed.

See protocol docs: Terminals

§

ExtMethodRequest(ExtRequest)

Handles extension method requests from the agent.

Allows the Agent to send an arbitrary request that is not part of the ACP spec. Extension methods provide a way to add custom functionality while maintaining protocol compatibility.

See protocol docs: Extensibility

Trait Implementations§

Source§

impl Clone for AgentRequest

Source§

fn clone(&self) -> AgentRequest

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AgentRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for AgentRequest

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for AgentRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,