pub struct TeamRunner { /* private fields */ }Expand description
Binds an AgentTeam to concrete AgentExecutor sessions, enabling
Lead → Worker → Reviewer automated workflows.
Implementations§
Source§impl TeamRunner
impl TeamRunner
Sourcepub fn with_agent(
team: AgentTeam,
agent: Arc<Agent>,
workspace: &str,
registry: Arc<AgentRegistry>,
) -> Self
pub fn with_agent( team: AgentTeam, agent: Arc<Agent>, workspace: &str, registry: Arc<AgentRegistry>, ) -> Self
Create a runner with a default agent context for simplified member addition.
Unlike TeamRunner::new, this constructor lets you call
add_lead, add_worker, and
add_reviewer without repeating the agent,
workspace, and registry on every call.
Sourcepub fn bind_session(
&mut self,
member_id: &str,
executor: Arc<dyn AgentExecutor>,
) -> Result<()>
pub fn bind_session( &mut self, member_id: &str, executor: Arc<dyn AgentExecutor>, ) -> Result<()>
Bind an executor to a team member.
Returns an error if member_id is not registered in the team.
Sourcepub fn bind_agent(
&mut self,
member_id: &str,
agent: &Agent,
workspace: &str,
agent_name: &str,
registry: &AgentRegistry,
) -> Result<()>
pub fn bind_agent( &mut self, member_id: &str, agent: &Agent, workspace: &str, agent_name: &str, registry: &AgentRegistry, ) -> Result<()>
Bind a team member to a session created from a named agent definition.
Looks up agent_name in registry, applies the definition’s prompt,
permissions, model, and max_steps to a new [AgentSession] via
[Agent::session_for_agent], then binds it to member_id.
This is the primary integration point between the AgentTeam coordination
layer and the markdown/YAML-defined subagent capability layer.
§Errors
Returns an error if member_id is not in the team, agent_name is not
in registry, or session creation fails.
Sourcepub fn add_lead(
&mut self,
agent_name: &str,
opts: Option<TeamMemberOptions>,
) -> Result<()>
pub fn add_lead( &mut self, agent_name: &str, opts: Option<TeamMemberOptions>, ) -> Result<()>
Add a Lead member and bind it to the named agent definition.
Requires a default agent context set via TeamRunner::with_agent.
The member ID is fixed to "lead".
Use opts to override the model, prompt slots, or workspace (e.g. a git worktree).
§Errors
Returns an error if no default context is set or agent_name is not
found in the registry.
Sourcepub fn add_worker(
&mut self,
agent_name: &str,
opts: Option<TeamMemberOptions>,
) -> Result<()>
pub fn add_worker( &mut self, agent_name: &str, opts: Option<TeamMemberOptions>, ) -> Result<()>
Add a Worker member and bind it to the named agent definition.
Requires a default agent context set via TeamRunner::with_agent.
Member IDs are auto-generated as "worker-1", "worker-2", etc.
Multiple workers can be added; they run concurrently during execution.
Use opts to override the model, prompt slots, or workspace — set
workspace to an isolated git worktree path to prevent filesystem
conflicts between concurrent workers.
§Errors
Returns an error if no default context is set or agent_name is not
found in the registry.
Sourcepub fn add_reviewer(
&mut self,
agent_name: &str,
opts: Option<TeamMemberOptions>,
) -> Result<()>
pub fn add_reviewer( &mut self, agent_name: &str, opts: Option<TeamMemberOptions>, ) -> Result<()>
Add a Reviewer member and bind it to the named agent definition.
Requires a default agent context set via TeamRunner::with_agent.
The member ID is fixed to "reviewer".
Use opts to override the model, prompt slots, or workspace.
§Errors
Returns an error if no default context is set or agent_name is not
found in the registry.
Sourcepub fn task_board(&self) -> Arc<TeamTaskBoard>
pub fn task_board(&self) -> Arc<TeamTaskBoard>
Access the shared task board.
Sourcepub async fn run_until_done(&self, goal: &str) -> Result<TeamRunResult>
pub async fn run_until_done(&self, goal: &str) -> Result<TeamRunResult>
Run the full Lead → Worker → Reviewer workflow until all tasks are done
or max_rounds retry cycles are exceeded.
Steps:
- Lead decomposes
goalinto tasks via JSON response. - Workers run concurrently until all tasks are in review or done.
- Reviewer processes all InReview tasks (after workers finish).
- If rejected tasks remain, workers retry them (back to step 2).
Running the reviewer after workers (rather than concurrently) prevents a race where the reviewer’s polling timeout fires before long-running agent calls have produced any InReview tasks.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TeamRunner
impl !RefUnwindSafe for TeamRunner
impl Send for TeamRunner
impl Sync for TeamRunner
impl Unpin for TeamRunner
impl UnsafeUnpin for TeamRunner
impl !UnwindSafe for TeamRunner
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more