pub struct AgentPool { /* private fields */ }Expand description
A collection of agents for group execution.
AgentPool takes ownership of a Vec<Agent> and provides
sequential pipeline execution where each agent’s output feeds
into the next agent’s input.
§Example
use traitclaw_core::pool::AgentPool;
use traitclaw_core::agent::Agent;
let pool = AgentPool::new(agents);
assert_eq!(pool.len(), 3);Implementations§
Source§impl AgentPool
impl AgentPool
Sourcepub fn get(&self, index: usize) -> Option<&Agent>
pub fn get(&self, index: usize) -> Option<&Agent>
Get a reference to an agent by index.
Returns None if the index is out of bounds.
Sourcepub async fn run_sequential(&self, input: &str) -> Result<AgentOutput>
pub async fn run_sequential(&self, input: &str) -> Result<AgentOutput>
Run agents sequentially, chaining outputs.
Each agent receives the previous agent’s text output as input.
The first agent receives the provided input string.
§Example
use traitclaw_core::pool::AgentPool;
use traitclaw_core::agent::Agent;
let output = pool.run_sequential("Research Rust async patterns").await?;
println!("Final output: {}", output.text());§Errors
Returns an error immediately if any agent in the pipeline fails. Earlier agents’ outputs are not available on error.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AgentPool
impl !RefUnwindSafe for AgentPool
impl Send for AgentPool
impl Sync for AgentPool
impl Unpin for AgentPool
impl UnsafeUnpin for AgentPool
impl !UnwindSafe for AgentPool
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