Team API#

Teams enable multiple agents to collaborate on complex tasks.

Available Teams#

Team Type

Description

PantheonTeam

Smart delegation with call_agent() (recommended)

SwarmTeam

Dynamic agent handoff

SequentialTeam

Linear pipeline processing

MoATeam

Mixture of Agents (parallel + synthesis)

AgentAsToolTeam

Sub-agents as tools

SwarmTeam#

Agents transfer control dynamically using transfer functions.

from pantheon.team import SwarmTeam

@agent1.tool
def transfer_to_agent2():
    """Transfer to agent2 for specialized work."""
    return agent2

@agent2.tool
def transfer_to_agent1():
    """Transfer back to agent1."""
    return agent1

team = SwarmTeam([agent1, agent2])

SequentialTeam#

Agents process in order, each building on the previous output.

from pantheon.team import SequentialTeam

# researcher -> analyst -> writer
team = SequentialTeam([researcher, analyst, writer])

MoATeam#

Multiple agents work in parallel, then an aggregator synthesizes.

from pantheon.team import MoATeam

team = MoATeam(
    agents=[expert1, expert2, expert3],
    aggregator=synthesizer
)

AgentAsToolTeam#

Leader agent calls sub-agents as tools.

from pantheon.team import AgentAsToolTeam

team = AgentAsToolTeam(
    leader=main_agent,
    agents=[specialist1, specialist2]
)

Common Methods#

All teams support:

run(message)

response = await team.run("Your task here")

chat()

await team.chat()  # Interactive REPL

Creating Teams from Templates#

from pantheon.factory import create_team_from_template
from pantheon.endpoint import Endpoint

endpoint = Endpoint()
team = await create_team_from_template(endpoint, "data_research_team")

Best Practices#

Clear Roles

Give each agent a distinct responsibility:

researcher = Agent(
    name="researcher",
    instructions="Focus on finding accurate information."
)

critic = Agent(
    name="critic",
    instructions="Review and find issues with the content."
)

Appropriate Size

Keep teams between 2-5 agents. Too many agents can slow down responses.

Start with PantheonTeam

Unless you have specific needs, PantheonTeam handles most use cases well.