pub trait Agent:
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 Self: 'async_trait,
'life0: 'async_trait,
'life1: '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§
Sourcefn run_live<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut InvocationContext,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run_live<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut InvocationContext,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run this agent on a live session. Returns when the agent is done (turn complete, transfer, or disconnect).
Provided Methods§
Sourcefn sub_agents(&self) -> Vec<Arc<dyn Agent>>
fn sub_agents(&self) -> Vec<Arc<dyn Agent>>
Sub-agents this agent can transfer control to.