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

# Human in the Loop: Dojo Demo

> Agent whose generate_task_steps tool requires user confirmation, returning a toggleable step list for the AG-UI Dojo step selector.

Frontend-provided tool: generate\_task\_steps (external\_execution)

```python human_in_the_loop.py theme={null}
"""
Human in the Loop — Dojo Demo
==============================

Frontend-provided tool: generate_task_steps (external_execution)

The frontend defines this tool via useHumanInTheLoop hook. The agent calls it,
and the frontend renders an interactive step-selector UI where the user can
toggle steps on/off and confirm.

Backend does NOT define the tool — it comes from the frontend in the request.
"""

from agno.agent.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIResponses

hitl_agent = Agent(
    name="human_in_the_loop",
    model=OpenAIResponses(id="gpt-5.5"),
    db=SqliteDb(db_file="/tmp/agui_human_in_the_loop.db"),
    instructions="""You are a task planning assistant. When asked to plan something:

1. **IMMEDIATELY call the generate_task_steps tool** with a list of steps
2. Generate exactly 10 clear, actionable steps
3. Each step must be an object with:
   - description: Brief imperative form (e.g., "Research travel options")
   - status: Set to "enabled" initially

Example tool call for "plan a trip to Mars":
{
  "steps": [
    {"description": "Research Mars travel options", "status": "enabled"},
    {"description": "Prepare necessary equipment", "status": "enabled"},
    {"description": "Complete health screenings", "status": "enabled"},
    ...
  ]
}

After calling the tool:
- Briefly confirm: "I've created a 10-step plan for you!"
- Don't repeat the steps (they're visible in the UI)
- Ask the user to review and select which steps to perform

When user provides feedback (after clicking "Perform Steps"):
- Acknowledge which steps were approved
- Provide a brief summary of next actions""",
    markdown=True,
)
```

## Run the Example

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U "agno[agui,os]" ddgs google-genai openai requests
    ```
  </Step>

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

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

  <Step title="Clone Agno">
    Clone the repository and run the remaining commands from its root:

    ```bash theme={null}
    git clone --branch v2.7.4 --depth 1 https://github.com/agno-agi/agno.git
    cd agno
    ```
  </Step>

  <Step title="Run the example">
    Run the example from the repository root:

    ```bash theme={null}
    python cookbook/05_agent_os/interfaces/agui/showcase.py
    ```
  </Step>
</Steps>

Full source: [cookbook/05\_agent\_os/interfaces/agui/human\_in\_the\_loop.py](https://github.com/agno-agi/agno/blob/v2.7.4/cookbook/05_agent_os/interfaces/agui/human_in_the_loop.py)
