Learn how to run a team and get the response.
Team.run()
function runs the team and generates a response, either as a TeamRunOutput
object or a stream of TeamRunOutputEvent
objects.
team.print_response()
which is a helper utility to
print the response in the terminal. It uses team.run()
under the hood.response
and response_stream
variables.
Team.arun()
method.Team.print_response()
method.
Team.print_response()
method is a helper method that uses the Team.run()
method under the hood.
This is only for convenience during development and not recommended for production use.See the Team class reference for more details.Team.run()
or Team.print_response()
as the input
parameter.
input_schema
on the team to validate the input. See more details in the Input and Output documentation.output_schema
on the team to specify typed output.
Team.run()
function returns a TeamRunOutput
object when not streaming. Here are some of the core attributes:
run_id
: The id of the run.team_id
: The id of the team.team_name
: The name of the team.session_id
: The id of the session.user_id
: The id of the user.content
: The response content.content_type
: The type of content. In the case of structured output, this will be the class name of the pydantic model.reasoning_content
: The reasoning content.messages
: The list of messages sent to the model.metrics
: The metrics of the run. For more details see Metrics.model
: The model used for the run.member_responses
: The list of member responses. Optional to add when store_member_responses=True
on the Team
.stream=True
when calling run()
. This will return an iterator of TeamRunOutputEvent
objects instead of a single response.
stream_intermediate_steps=True
.
stream_member_events=False
.RunOutput
object.
TeamRunContentEvent
and RunContentEvent
events are not stored. You can modify which events are skipped by setting the events_to_skip
parameter.
For example:
Team.run()
and Team.arun()
functions depending on team’s configuration:
Event Type | Description |
---|---|
TeamRunStarted | Indicates the start of a run |
TeamRunContent | Contains the model’s response text as individual chunks |
TeamRunCompleted | Signals successful completion of the run |
TeamRunError | Indicates an error occurred during the run |
TeamRunCancelled | Signals that the run was cancelled |
Event Type | Description |
---|---|
TeamToolCallStarted | Indicates the start of a tool call |
TeamToolCallCompleted | Signals completion of a tool call, including tool call results |
Event Type | Description |
---|---|
TeamReasoningStarted | Indicates the start of the team’s reasoning process |
TeamReasoningStep | Contains a single step in the reasoning process |
TeamReasoningCompleted | Signals completion of the reasoning process |
Event Type | Description |
---|---|
TeamMemoryUpdateStarted | Indicates that the team is updating its memory |
TeamMemoryUpdateCompleted | Signals completion of a memory update |
Event Type | Description |
---|---|
TeamParserModelResponseStarted | Indicates the start of the parser model response |
TeamParserModelResponseCompleted | Signals completion of the parser model response |
Event Type | Description |
---|---|
TeamOutputModelResponseStarted | Indicates the start of the output model response |
TeamOutputModelResponseCompleted | Signals completion of the output model response |
CustomEvent
class: