Skip to main content

Module execution

Module execution 

Source
Expand description

Team execution engine — Team.bind() and Team.run().

Connects AgentRoles to callable agent functions and executes the orchestration pipeline driven by the team’s router.

§Design

BoundAgent is a Box<dyn Fn(&str) -> BoxFuture<Result<String>>> so that any callable async closure or agent can be bound without requiring traitclaw-core to be imported by consumers — they just pass a closure.

§Example

use traitclaw_team::execution::TeamRunner;

let mut runner = TeamRunner::new(2); // max 2 iterations

// Bind agents as async closures
runner.bind("researcher", |input: String| async move {
    Ok(format!("Research result for: {input}"))
});
runner.bind("writer", |input: String| async move {
    Ok(format!("Written summary of: {input}"))
});

// Set sequential order
runner.set_sequence(&["researcher", "writer"]);

let output = runner.run("Write a report on AI").await?;
assert!(output.contains("Written summary"));

Structs§

TeamRunner
Sequential team execution engine.

Functions§

run_verification_chain
Execute a generate-verify-retry loop.

Type Aliases§

BoundAgent
Type-erased callable agent.
BoxFuture
Future alias for boxed async agent calls.