Team.run() function runs the team and generates a response, either as a TeamRunResponse object or a stream of TeamRunResponseEvent objects.
Many of our examples use team.print_response() which is a helper utility to print the response in the terminal. It uses team.run() under the hood.
Here’s how to run your team. The response is captured in the response and response_stream variables.
Streaming Intermediate Steps
Throughout the execution of a team, multiple events take place, and we provide these events in real-time for enhanced team transparency. You can enable streaming of intermediate steps by settingstream_intermediate_steps=True.
Handling Events
You can process events as they arrive by iterating over the response stream:Team member events are yielded during team execution when a team member is being executed. You can disable this by setting
stream_member_events=False.Storing Events
You can store all the events that happened during a run on theRunResponse object.
TeamRunResponseContentEvent and RunResponseContentEvent events are not stored. You can modify which events are skipped by setting the events_to_skip parameter.
For example:
Event Types
The following events are sent by theTeam.run() and Team.arun() functions depending on team’s configuration:
Core Events
Tool Events
Reasoning Events
Memory Events
See detailed documentation in the TeamRunResponse documentation.
Structured Input
A team can be provided with structured input (i.e a pydantic model) by passing it in theTeam.run() or Team.print_response() as the message parameter.