Skip to main content

Agent

Trait Agent 

Source
pub trait Agent: Send + Sync {
    // Required methods
    fn execute<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        input: &'life1 str,
        context: &'life2 AgentContext,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn system_prompt(&self) -> String;
    fn agent_type(&self) -> AgentType;
}
Expand description

Base trait for all agents

Required Methods§

Source

fn execute<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, input: &'life1 str, context: &'life2 AgentContext, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute the agent with given input and context

Source

fn system_prompt(&self) -> String

Get the agent’s system prompt

Source

fn agent_type(&self) -> AgentType

Get the agent type

Implementors§