pub struct AutoAgent {
pub id: Uuid,
pub agents: Vec<BoxedAgent>,
pub execute: bool,
pub browse: bool,
pub max_tries: u64,
pub crud: bool,
pub auth: bool,
pub external: bool,
}Expand description
Orchestrates a pool of agents, running them concurrently on separate Tokio tasks and collecting results.
§Examples
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 agent = MyAgent {
persona: "Researcher".into(),
behavior: "Research Rust.".into(),
agent: LmmAgent::new("Researcher".into(), "Research Rust.".into()),
..Default::default()
};
AutoAgent::default()
.with(agents![agent])
.build()
.unwrap()
.run()
.await
.unwrap();
}Fields§
§id: UuidUnique ID for this orchestrator instance.
agents: Vec<BoxedAgent>Pool of agents to run.
execute: boolWhether agents should execute generated artefacts.
browse: boolWhether agents may open browser tabs.
max_tries: u64Maximum task-execution attempts per agent.
crud: boolCRUD permission scope passed to each agent task.
auth: boolAuth permission scope.
external: boolExternal-access permission scope.
Implementations§
Source§impl AutoAgent
impl AutoAgent
Sourcepub fn with<A>(self, agents: A) -> Self
pub fn with<A>(self, agents: A) -> Self
Provides the agent pool.
Use the agents! macro to construct the pool.
Sourcepub fn execute(self, execute: bool) -> Self
pub fn execute(self, execute: bool) -> Self
Sets whether agents should execute generated artefacts (default: true).
Sourcepub fn browse(self, browse: bool) -> Self
pub fn browse(self, browse: bool) -> Self
Sets whether agents may open browser tabs (default: false).
Sourcepub fn max_tries(self, max_tries: u64) -> Self
pub fn max_tries(self, max_tries: u64) -> Self
Sets the maximum retry count per agent (default: 1).
Sourcepub fn crud(self, enabled: bool) -> Self
pub fn crud(self, enabled: bool) -> Self
Enables/disables CRUD scope for all agents (default: true).
Sourcepub fn auth(self, enabled: bool) -> Self
pub fn auth(self, enabled: bool) -> Self
Enables/disables auth scope for all agents (default: false).
Sourcepub fn external(self, enabled: bool) -> Self
pub fn external(self, enabled: bool) -> Self
Enables/disables external-access scope for all agents (default: true).