AgentTrait

Trait AgentTrait 

pub trait AgentTrait:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &str;
    fn run_live<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 mut InvocationContext,
    ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;

    // Provided methods
    fn tools(&self) -> Vec<Tool> { ... }
    fn sub_agents(&self) -> Vec<Arc<dyn Agent>> { ... }
}
Expand description

The fundamental agent trait. Everything that can process a live session implements this — LLM agents, function agents, pipelines, routers.

Required Methods§

fn name(&self) -> &str

Human-readable name for routing, logging, and debugging.

fn run_live<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 mut InvocationContext, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Run this agent on a live session. Returns when the agent is done (turn complete, transfer, or disconnect).

Provided Methods§

fn tools(&self) -> Vec<Tool>

Declare tools this agent provides (sent in the setup message).

fn sub_agents(&self) -> Vec<Arc<dyn Agent>>

Sub-agents this agent can transfer control to.

Implementors§

§

impl Agent for LlmAgent

§

impl Agent for LoopAgent

§

impl Agent for LoopAgent

§

impl Agent for ParallelAgent

§

impl Agent for SequentialAgent