Skip to main content

Frontend

Trait Frontend 

Source
pub trait Frontend: Send + Sync {
    // Required methods
    fn on_event<'life0, 'async_trait>(
        &'life0 self,
        event: AgentEvent,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn request_tool_confirmation<'life0, 'life1, 'async_trait>(
        &'life0 self,
        info: &'life1 ToolCallInfo,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Abstract frontend interface. Implementations handle rendering events and collecting user input.

Required Methods§

Source

fn on_event<'life0, 'async_trait>( &'life0 self, event: AgentEvent, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Agent pushes events to the frontend (text deltas, tool calls, errors, etc.).

Source

fn request_tool_confirmation<'life0, 'life1, 'async_trait>( &'life0 self, info: &'life1 ToolCallInfo, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Request user confirmation for a tool call. Blocks until user responds. Returns true if the user approved, false if rejected.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§