Skip to main content

What is Sequential Team mode

Sequential mode is the default and most straightforward team operation mode. Tasks flow from one agent to the next in a linear pipeline. There are two ways to assign agents to tasks in sequential mode:
  • Automatic Selection — The team intelligently analyzes each task and selects the best-suited agent based on their roles and capabilities. This is the default behavior.
  • Manual Assignment — You explicitly assign a specific agent to a task using the agent parameter. This gives you full control over which agent handles which task.

Automatic Selection

By default, the team automatically picks the best agent for each task. You simply define your tasks and let the team decide.
from upsonic import Agent, Task, Team

# Create specialized agents
researcher = Agent(
    model="anthropic/claude-sonnet-4-5",
    name="Researcher",
    role="Research Specialist",
    goal="Find accurate information and data"
)

writer = Agent(
    model="anthropic/claude-sonnet-4-5",
    name="Writer",
    role="Content Writer",
    goal="Create clear and engaging content"
)

# Create sequential team
team = Team(
    agents=[researcher, writer],
    mode="sequential"
)

# Define tasks — the team will automatically select the best agent for each
tasks = [
    Task(description="Research the latest developments in quantum computing"),
    Task(description="Write a blog post about quantum computing for general audience")
]

# Execute team workflow
result = team.print_do(tasks)

Manual Assignment

You can explicitly assign a specific agent to a task by passing the agent parameter. This overrides the automatic selection and ensures the designated agent handles that task.
from upsonic import Agent, Task, Team

# Create specialized agents
writer = Agent(
    model="anthropic/claude-sonnet-4-5",
    name="Writer",
    role="Content Writer",
    goal="Create engaging content"
)

editor = Agent(
    model="anthropic/claude-sonnet-4-5",
    name="Editor",
    role="Content Editor",
    goal="Polish and improve content"
)

# Create sequential team
team = Team(agents=[writer, editor], mode="sequential")

# Explicitly assign agents to tasks
task1 = Task(description="Write a product description", agent=writer)
task2 = Task(description="Edit and polish the description", agent=editor)

# Execute with manual assignments
result = team.print_do([task1, task2])

Streaming with mixed Agent and Team entities

You can stream output with a mix of Agent and nested Team entities. Each entity’s output is preceded by a header (e.g. --- [Agent] Researcher ---).
from upsonic import Agent, Task, Team

researcher = Agent(
    model="anthropic/claude-sonnet-4-5",
    name="Researcher",
    role="Research Specialist",
    goal="Find accurate information and data",
)

editor = Agent(
    model="anthropic/claude-sonnet-4-5",
    name="Editor",
    role="Editor",
    goal="Polish and refine content",
)

writer_team = Team(
    entities=[
        Agent(
            model="anthropic/claude-sonnet-4-5",
            name="Writer",
            role="Content Writer",
            goal="Create clear and engaging content",
        ),
        editor,
    ],
    mode="sequential",
    name="WriterTeam",
)

team = Team(
    entities=[researcher, writer_team],
    mode="sequential",
)

tasks = [
    Task(description="Research the latest developments in quantum computing"),
    Task(description="Write a blog post about quantum computing for general audience"),
]

for chunk in team.stream(tasks):
    print(chunk, end="", flush=True)

Params

  • agents: List of Agent instances
  • mode: Set to "sequential"
  • response_format: Optional, defaults to str
  • ask_other_team_members: Optional, enables inter-agent communication