Documentation Index
Fetch the complete documentation index at: https://docs.definable.ai/llms.txt
Use this file to discover all available pages before exploring further.
Build a team where all members receive the same task and work in parallel.
Create the team
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())
Install and run
python collaborate_team.py
All three analysts run in parallel. The leader synthesizes their responses into a balanced analysis.