Skip to main content
Run your team with Team.run() (sync) or Team.arun() (async).

Basic Execution

Execution Flow

When you call run():
  1. Pre-hooks execute (if configured)
  2. Reasoning runs (if enabled) to plan the task
  3. Context is built with system message, history, memories, and session state
  4. Model decides whether to respond directly, use tools, or delegate to members
  5. Members execute their tasks (concurrently in async mode)
  6. Leader synthesizes member results into a final response
  7. Post-hooks execute (if configured)
  8. Session and metrics are stored (if database configured)
Callable factories are resolved after session state is loaded, so factories can access run_context and session_state. Async factories require arun() or aprint_response(). In TeamMode.tasks, the leader uses task management tools to build and execute a shared task list, looping until the goal is complete or max_iterations is reached. Teams can pause for human-in-the-loop requirements (e.g., approvals or user input). When a run requires confirmation, the run returns with pending requirements so you can collect input or resolve approvals before continuing. Paused runs return status=RunStatus.paused and requirements on the TeamRunOutput. Human oversight is a control path. Runs can pause for confirmation or external execution and resume when requirements are resolved.
Team execution flow

Streaming

Enable streaming with stream=True. This returns an iterator of events instead of a single response.
Streaming is not supported in TeamMode.tasks. If you set stream=True, the run falls back to non-streaming execution.

Stream All Events

By default, only content is streamed. Set stream_events=True to get tool calls, reasoning steps, and other internal events:

Stream Member Events

When using arun() with multiple members, they execute concurrently. Member events arrive as they happen, not in order. Disable member event streaming with stream_member_events=False:

Run Output

Team.run() returns a TeamRunOutput object containing: See TeamRunOutput reference for the full schema.

Async Execution

Use arun() for async execution. Members run concurrently when the leader delegates to multiple members at once.

Tasks Mode

Tasks mode runs an iterative loop that creates, executes, and updates tasks until the goal is complete.

Specifying User and Session

Associate runs with a user and session for history tracking:
See Sessions for details.

Passing Files

Pass images, audio, video, or files to the team:
See Multimodal for details.

Structured Output

Pass an output schema to get structured responses:
See Input & Output for details.

Cancelling Runs

Cancel a running team with Team.cancel_run(). See Run Cancellation. For development, use print_response() to display formatted output:

Core Events

Tool Events

Reasoning Events

Memory Events

Hook Events

Developer Resources