Skip to main content

agents

Macro agents 

Source
macro_rules! agents {
    ( $($agent:expr),* $(,)? ) => { ... };
}
Expand description

Wraps any AgentFunctions implementor in the type-erased pointer form expected by AutoAgent::with.

ยงExample

use lmm_agent::prelude::*;

#[derive(Debug, Default, Auto)]
pub struct MyAgent {
    pub persona: Cow<'static, str>,
    pub behavior: Cow<'static, str>,
    pub status: Status,
    pub agent: LmmAgent,
    pub memory: Vec<Message>,
}
#[async_trait]
impl Executor for MyAgent {
    async fn execute<'a>(&'a mut self, _: &'a mut Task, _: bool, _: bool, _: u64) -> Result<()> { Ok(()) }
}
let my_agent_a = MyAgent { agent: LmmAgent::new("p".into(), "t".into()), ..Default::default() };
let my_agent_b = MyAgent { agent: LmmAgent::new("p".into(), "t".into()), ..Default::default() };
let wrapped = agents![my_agent_a, my_agent_b];