Team
internally has a team-leader agent that delegates tasks to the members. When you call run
or arun
on a team, the team leader agent uses a model to determine which member to delegate the task to.
The basic flow is:
- The team receives user input
- A Team Leader analyzes the input and decides how to break it down into subtasks
- The Team Leader delegates specific tasks to appropriate team members
- Team members complete their assigned tasks and return their results
- The Team Leader synthesizes all outputs into a final, cohesive response
Determine input for members
When a team is run, by default the team leader will determine the “task” to give a specific member. This then becomes theinput
when that member is run.
If you set determine_input_for_members
to False
, the team leader will send the user-provided input directly to the member agent(s). The team leader still determines the appropriate member to delegate the task to.
This feature is particularly useful when you have specialized agents with distinct expertise areas and want to automatically direct queries to the right specialist.
1
Create Team
Create a file
determine_input_for_members.py
determine_input_for_members.py
2
Run the team
Install librariesRun the team
Respond directly
During normal team execution, the team leader will process the responses from the members and return a single response to the user. If instead you want to return the response of members directly, you can setrespond_directly
to True
.
It can make sense to use this feature in combination with
determine_input_for_members=False
.1
Create Multi Language Team
Create a file
multi_language_team.py
multi_language_team.py
2
Run the team
Install librariesRun the team
This is not compatible with
delegate_task_to_all_members
.Delegate task to all members
When you setdelegate_task_to_all_members
to True
, the team leader will delegate the task to all members simultaneously, instead of one by one. When running async (using arun
) members will run concurrently.
1
Create a collaborative team
Create a file
discussion_team.py
discussion_team.py
2
Run the team
Install librariesRun the team
Developer Resources
- View the Team reference
- View Cookbook