pub struct SwarmBuilder { /* private fields */ }Expand description
Builds a Swarm.
Implementations§
Source§impl SwarmBuilder
impl SwarmBuilder
Sourcepub fn agent(self, agent: Agent) -> Self
pub fn agent(self, agent: Agent) -> Self
Add an agent. It needs a name, which the others hand off to; its description tells them what it is for.
The swarm adds the handoff_to_agent tool to the
agent’s tool set, which clones of the agent share.
Sourcepub fn entry(self, name: impl Into<String>) -> Self
pub fn entry(self, name: impl Into<String>) -> Self
The agent the run starts with. Defaults to the first one added.
Sourcepub fn max_handoffs(self, max_handoffs: usize) -> Self
pub fn max_handoffs(self, max_handoffs: usize) -> Self
How many handoffs a run may make before it fails. Defaults to 20.
Sourcepub fn execution_timeout(self, timeout: Duration) -> Self
pub fn execution_timeout(self, timeout: Duration) -> Self
How long a whole run may take. Defaults to 15 minutes.
Sourcepub fn agent_timeout(self, timeout: Duration) -> Self
pub fn agent_timeout(self, timeout: Duration) -> Self
How long one agent’s turn may take. Defaults to 5 minutes.
Sourcepub fn detect_repetition(self, window: usize, min_unique: usize) -> Self
pub fn detect_repetition(self, window: usize, min_unique: usize) -> Self
Fail a run whose last window turns went to fewer than min_unique
distinct agents: two agents passing the work back and forth. Off by
default.
Sourcepub fn allow_questions(self) -> Self
pub fn allow_questions(self) -> Self
Sourcepub fn checkpoints(
self,
store: impl AsyncStore + WasmCompatSend + WasmCompatSync + 'static,
) -> Self
pub fn checkpoints( self, store: impl AsyncStore + WasmCompatSend + WasmCompatSync + 'static, ) -> Self
Sourcepub fn build(self) -> Result<Swarm, BuildError>
pub fn build(self) -> Result<Swarm, BuildError>
Check the agents and give each one the handoff tool.
Auto Trait Implementations§
impl !RefUnwindSafe for SwarmBuilder
impl !UnwindSafe for SwarmBuilder
impl Forget for SwarmBuilder
impl Freeze for SwarmBuilder
impl Move for SwarmBuilder
impl Send for SwarmBuilder
impl Sync for SwarmBuilder
impl Unpin for SwarmBuilder
impl UnsafeUnpin for SwarmBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more