Leader picks members and synthesizes their responses.
Create the team
import asyncio from definable.agent import Agent from definable.agent.team import Team, TeamMode researcher = Agent( model="gpt-4o", instructions="You are a research specialist. Find facts, data, and sources.", ) writer = Agent( model="gpt-4o", instructions="You are a technical writer. Write clear, well-structured content.", ) editor = Agent( model="gpt-4o", instructions="You are an editor. Polish prose, fix errors, improve clarity.", ) team = Team( name="content-team", model="gpt-4o", members=[researcher, writer, editor], mode=TeamMode.coordinate, instructions="Produce well-researched, polished technical articles.", ) async def main(): result = await team.arun("Write a 500-word article about AI agents in production.") print(result.content) asyncio.run(main())
Install dependencies
pip install definable
Export your API key
export OPENAI_API_KEY=sk-***
Run
python coordinate_team.py