Constructor
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | auto | Human-readable team name. |
model | str | Model | — | Leader model. String shorthand or Model instance. |
members | List[Agent | Team] | — | Member agents or nested teams. |
mode | TeamMode | coordinate | Execution mode. |
instructions | str | "" | Leader instructions. |
max_iterations | int | 10 | Max delegation rounds (tasks mode). |
share_member_interactions | bool | False | Pass member responses to subsequent delegations. |
tools | List[Function] | [] | Additional leader tools. |
output_schema | Type[BaseModel] | None | Structured output from leader. |
debug | bool | False | Debug logging. |
TeamMode
| Value | Behavior |
|---|---|
coordinate | Leader picks members, synthesizes responses. |
route | Leader routes to single specialist, returns directly. |
collaborate | All members in parallel, leader synthesizes. |
tasks | Leader decomposes into task list, delegates autonomously. |
Methods
| Method | Returns | Description |
|---|---|---|
run(instruction, **kwargs) | RunOutput | Synchronous execution. |
arun(instruction, **kwargs) | RunOutput | Async execution. |
run_stream(instruction, **kwargs) | Iterator[RunOutputEvent] | Sync streaming. |
arun_stream(instruction, **kwargs) | AsyncIterator[RunOutputEvent] | Async streaming. |
Events
| Event | When |
|---|---|
TeamRunStartedEvent | Team run begins. |
TeamRunCompletedEvent | Team run finishes. |
TeamRunErrorEvent | Team run fails. |
MemberDelegatedEvent | Leader delegates to a member. |
MemberCompletedEvent | Member finishes. |
MemberErrorEvent | Member fails. |
MemberRoutedEvent | Route mode selects member. |
TaskCreatedEvent | Tasks mode creates task. |
TaskStatusChangedEvent | Task status changes. |
TaskIterationEvent | Tasks mode completes iteration. |