Teams
Coordinate multiple AI agents to solve complex problems
Teams in Marvin allow multiple agents to collaborate on tasks, combining their specialized skills and perspectives to achieve better results than a single agent could alone.
What are Teams?
A Team is a group of agents that can work together on tasks, with mechanisms for coordination and delegation. Teams are useful when:
- A task requires multiple specialized skills or perspectives
- You want agents to check each other’s work
- Complex problems benefit from collaborative problem-solving
Types of Teams
Marvin offers several team configurations:
Swarm
A Swarm is the simplest type of team, where all agents can freely collaborate and delegate to each other. Any agent in the swarm can ask another agent for help at any time.
RoundRobinTeam
A RoundRobinTeam rotates through its members in sequence, with each agent taking a turn to contribute.
RandomTeam
A RandomTeam randomly selects an agent for each turn, introducing variety in the collaboration.
How Teams Work
When you run a task with a team:
- The team selects an active agent (depending on the team type)
- The active agent works on the task
- If needed, the agent can delegate to other team members
- The process continues until the task is complete
- The final result is returned
Behind the scenes, Marvin manages the conversation flow between agents, ensuring that each agent has the context it needs to contribute effectively.
Creating Effective Teams
For best results with teams:
- Specialized Roles: Give each agent a distinct role or perspective
- Clear Instructions: Ensure each agent has clear, specific instructions
- Complementary Skills: Combine agents with different but complementary abilities
- Appropriate Size: Start with 2-4 agents; too many can lead to inefficiency
Advanced Team Usage
Custom Team Configurations
You can create custom team configurations by extending the Team
class:
Team with Shared Memory
Teams can share memory across agents:
When to Use Teams vs. Single Agents
- Use a single agent when the task is straightforward, focused, or requires a consistent voice
- Use a team when the task is complex, requires multiple perspectives, or benefits from debate and refinement
Teams add some overhead in terms of tokens and processing time, so they’re best used when their collaborative capabilities provide clear benefits over a single agent approach.