Skip to main content
Build a team where all members receive the same task and work in parallel.
1

Create the team

collaborate_team.py
import asyncio
from definable.agent import Agent
from definable.agent.team import Team, TeamMode

optimist = Agent(
    model="gpt-4o",
    instructions="You are an optimistic analyst. Focus on opportunities and positive trends.",
)
pessimist = Agent(
    model="gpt-4o",
    instructions="You are a cautious analyst. Focus on risks, challenges, and potential downsides.",
)
realist = Agent(
    model="gpt-4o",
    instructions="You are a balanced analyst. Weigh both opportunities and risks pragmatically.",
)

team = Team(
    name="analysis-team",
    model="gpt-4o",
    members=[optimist, pessimist, realist],
    mode=TeamMode.collaborate,
    instructions="Synthesize all perspectives into a balanced analysis.",
)

async def main():
    result = await team.arun("Analyze the impact of AI on software engineering jobs.")
    print(result.content)

asyncio.run(main())
2

Install and run

pip install definable
python collaborate_team.py
All three analysts run in parallel. The leader synthesizes their responses into a balanced analysis.