> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-service-account.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Basic Task Mode Example

> A tasks-mode team decomposes a briefing request into research, writing, and review tasks.

```python basic_task_mode.py theme={null}
"""
Basic Task Mode Example

Demonstrates a team in `mode=tasks` where the team leader autonomously:
1. Decomposes a user goal into discrete tasks
2. Assigns tasks to the most suitable member agent
3. Executes tasks by delegating to members
4. Collects results and provides a final summary

Run: .venvs/demo/bin/python cookbook/03_teams/02_modes/tasks/04_basic_task_mode.py
"""

from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.team.mode import TeamMode
from agno.team.team import Team

# ---------------------------------------------------------------------------
# Create Members
# ---------------------------------------------------------------------------

researcher = Agent(
    name="Researcher",
    role="Research specialist who finds information on topics",
    model=OpenAIResponses(id="gpt-5-mini"),
    instructions=[
        "You are a research specialist.",
        "When given a topic, provide a clear, concise summary of key facts.",
        "Always cite what you know and be honest about limitations.",
    ],
)

writer = Agent(
    name="Writer",
    role="Content writer who creates well-structured text",
    model=OpenAIResponses(id="gpt-5-mini"),
    instructions=[
        "You are a skilled content writer.",
        "Take provided information and craft it into polished, engaging text.",
        "Use clear structure with headers and bullet points when appropriate.",
    ],
)

critic = Agent(
    name="Critic",
    role="Quality reviewer who provides constructive feedback",
    model=OpenAIResponses(id="gpt-5-mini"),
    instructions=[
        "You are a constructive critic.",
        "Review content for accuracy, clarity, and completeness.",
        "Provide specific, actionable feedback.",
    ],
)

# ---------------------------------------------------------------------------
# Create Team
# ---------------------------------------------------------------------------

content_team = Team(
    name="Content Creation Team",
    mode=TeamMode.tasks,
    model=OpenAIResponses(id="gpt-5.2"),
    members=[researcher, writer, critic],
    instructions=[
        "You are a content creation team leader.",
        "Break down the user's request into research, writing, and review tasks.",
        "Assign each task to the most appropriate team member.",
        "After all tasks are complete, synthesize the results into a final response.",
    ],
    show_members_responses=True,
    markdown=True,
    max_iterations=10,
    debug_mode=True,
)

# ---------------------------------------------------------------------------
# Run Team
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    content_team.print_response(
        "Write a short briefing on the current state of quantum computing, "
        "covering recent breakthroughs, key challenges, and potential near-term applications."
    )
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno openai
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:OPENAI_API_KEY="your_openai_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run the example">
    Save the code above as `basic_task_mode.py`, then run:

    ```bash theme={null}
    python basic_task_mode.py
    ```
  </Step>
</Steps>

Full source: [cookbook/03\_teams/02\_modes/tasks/04\_basic\_task\_mode.py](https://github.com/agno-agi/agno/blob/main/cookbook/03_teams/02_modes/tasks/04_basic_task_mode.py)
