pub struct AgentChain { /* private fields */ }Expand description
Tries backends in order until one answers.
- A backend that cannot enforce the turn’s tool policy is skipped, unless the chain was built
with
AgentChain::allow_unenforced_tools(development only: the agent may then use every tool its CLI has, including a shell). - Errors that
AgentError::should_fall_backmove on to the next backend; others stop. - At most
max_concurrentturns run at once across the whole chain.
Implementations§
Source§impl AgentChain
impl AgentChain
Sourcepub fn new(backends: Vec<Arc<dyn AgentBackend>>, max_concurrent: usize) -> Self
pub fn new(backends: Vec<Arc<dyn AgentBackend>>, max_concurrent: usize) -> Self
A chain over backends (tried in order) running at most max_concurrent turns at once.
Sourcepub fn allow_unenforced_tools(self, allow: bool) -> Self
pub fn allow_unenforced_tools(self, allow: bool) -> Self
Lets backends run turns whose tool policy they cannot enforce. For local development with a trusted user only; never for a bot reachable by others.
Sourcepub fn machine_slots(self, slots: MachineSlots) -> Self
pub fn machine_slots(self, slots: MachineSlots) -> Self
Also waits for a machine-wide slot before each turn (shared with other bots).
Sourcepub fn backends(&self) -> &[Arc<dyn AgentBackend>]
pub fn backends(&self) -> &[Arc<dyn AgentBackend>]
The backends, in order.
Trait Implementations§
Source§impl AgentBackend for AgentChain
impl AgentBackend for AgentChain
Auto Trait Implementations§
impl !RefUnwindSafe for AgentChain
impl !UnwindSafe for AgentChain
impl Freeze for AgentChain
impl Send for AgentChain
impl Sync for AgentChain
impl Unpin for AgentChain
impl UnsafeUnpin for AgentChain
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