Skip to main content
Build a team that autonomously decomposes a goal into tasks and delegates them.
1

Create the team

tasks_team.py
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. Gather facts and data on assigned topics.",
)
designer = Agent(
    model="gpt-4o",
    instructions="You are a UX designer. Create wireframes and design specifications.",
)
developer = Agent(
    model="gpt-4o",
    instructions="You are a developer. Write implementation plans and code outlines.",
)

team = Team(
    name="product-team",
    model="gpt-4o",
    members=[researcher, designer, developer],
    mode=TeamMode.tasks,
    max_iterations=10,
    instructions="Build a complete product specification for the given feature.",
)

async def main():
    result = await team.arun("Design a user onboarding flow for a SaaS product.")
    print(result.content)

asyncio.run(main())
2

Install and run

pip install definable
python tasks_team.py
The leader creates tasks (research competitors, design wireframes, write specs), assigns them to members, and iterates until all tasks are complete.