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:
- Initialize chat with
spec.system_prompt - Send
taskto the model - Parse response into
ActionProposal - Call
runtime.execute(&proposal) - Format results back to model
- Repeat until model says “done”
- Return
AgentOutput