Expand description
§AutoAgent - the async orchestrator.
AutoAgent owns a collection of agents (as Arc<Mutex<Box<dyn AgentFunctions>>>)
and runs them concurrently on a Tokio runtime.
§Usage
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(()) }
}
#[tokio::main]
async fn main() {
let my_agent = MyAgent { agent: LmmAgent::new("p".into(), "t".into()), ..Default::default() };
let autogpt = AutoAgent::default()
.with(agents![my_agent])
.max_tries(3)
.build()
.unwrap();
autogpt.run().await.unwrap();
}§Attribution
Adapted from the autogpt project’s prelude.rs (AutoGPT struct):
https://github.com/wiseaidotdev/autogpt/blob/main/autogpt/src/prelude.rs
Structs§
- Auto
Agent - Orchestrates a pool of agents, running them concurrently on separate Tokio tasks and collecting results.
Type Aliases§
- Boxed
Agent - Type alias for a thread-safe, heap-allocated, type-erased agent.