Skip to main content

AgentRunner

Trait AgentRunner 

Source
pub trait AgentRunner: Send + Sync {
    // Required method
    fn run<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        spec: &'life1 AgentSpec,
        task: &'life2 str,
        runtime: &'life3 Runtime,
        mailbox: &'life4 Mailbox,
    ) -> Pin<Box<dyn Future<Output = Result<AgentOutput, MultiError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
}
Expand description

Trait for running an agent to completion.

Implement this with your model loop. For example:

  1. Initialize chat with spec.system_prompt
  2. Send task to the model
  3. Parse response into ActionProposal
  4. Call runtime.execute(&proposal)
  5. Format results back to model
  6. Repeat until model says “done”
  7. Return AgentOutput

Required Methods§

Source

fn run<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, spec: &'life1 AgentSpec, task: &'life2 str, runtime: &'life3 Runtime, mailbox: &'life4 Mailbox, ) -> Pin<Box<dyn Future<Output = Result<AgentOutput, MultiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Implementors§