Skip to main content

Overview

Team enables multiple specialized agents to work together on complex tasks. Teams automatically coordinate work, share context, and combine results through different operational modes.

Key Features

  • Multiple Operation Modes: Sequential, coordinate, or route execution
  • Smart Assignment: Automatically picks the right agent for each task
  • Context Sharing: Agents receive context from previous tasks
  • Result Combining: Combines outputs into coherent final answer
  • Flexible Coordination: Leader-based planning or expert routing
  • Shared Memory: Optional memory sharing across team

Example

from upsonic import Agent, Task, Team

# Create specialized agents
data_analyst = Agent(
    model="anthropic/claude-sonnet-4-5",
    name="Data Analyst",
    role="Data Analysis Expert",
    goal="Analyze data and extract insights"
)

report_writer = Agent(
    model="anthropic/claude-sonnet-4-5",
    name="Report Writer",
    role="Business Report Specialist",
    goal="Create professional business reports"
)

# Create team with coordination
team = Team(
    agents=[data_analyst, report_writer],
    mode="coordinate",
    model="anthropic/claude-sonnet-4-5"  # Required for leader agent
)

# Define tasks
tasks = [
    Task(description="Analyze Q4 sales data and identify trends"),
    Task(description="Create executive summary of findings")
]

# Leader agent coordinates the team
result = team.print_do(tasks)
print(result)