Skip to main content

Agent

Trait Agent 

Source
pub trait Agent:
    Send
    + Sync
    + 'static {
    // Required methods
    fn run<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        input: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<AgentOutput>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn stream_run<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        input: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<BoxStream<'_, Result<AgentEvent>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Contract for executable agents.

Required Methods§

Source

fn run<'life0, 'life1, 'async_trait>( &'life0 mut self, input: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<AgentOutput>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Runs the agent to completion for a user input.

Source

fn stream_run<'life0, 'life1, 'async_trait>( &'life0 mut self, input: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<BoxStream<'_, Result<AgentEvent>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Runs the agent as an event stream.

Implementors§