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

# Slack HITL: Simple Confirmation

> Minimal example: agent with one tool that requires confirmation.

Minimal example: agent with one tool that requires confirmation. Use this to verify the HITL card appears in Slack.

```python hitl_simple.py theme={null}
"""
Slack HITL — Simple Confirmation
================================

Minimal example: agent with one tool that requires confirmation.
Use this to verify the HITL card appears in Slack.

Try in Slack:
  @bot get me the top 3 hacker news stories
"""

import json

import httpx
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIResponses
from agno.os import AgentOS
from agno.os.interfaces.slack import Slack
from agno.tools import tool


@tool(requires_confirmation=True)
def get_top_hackernews_stories(num_stories: int) -> str:
    """Fetch top stories from Hacker News.

    Args:
        num_stories: Number of stories to retrieve

    Returns:
        JSON string containing story details
    """
    response = httpx.get("https://hacker-news.firebaseio.com/v0/topstories.json")
    story_ids = response.json()

    all_stories = []
    for story_id in story_ids[:num_stories]:
        story_response = httpx.get(
            f"https://hacker-news.firebaseio.com/v0/item/{story_id}.json"
        )
        story = story_response.json()
        story.pop("text", None)
        all_stories.append(story)
    return json.dumps(all_stories)


db = SqliteDb(
    db_file="tmp/hitl_simple.db",
    session_table="agent_sessions",
    approvals_table="approvals",
)

agent = Agent(
    name="HN Agent",
    id="hn-agent",
    model=OpenAIResponses(id="gpt-5.4"),
    tools=[get_top_hackernews_stories],
    markdown=True,
    db=db,
)

agent_os = AgentOS(
    description="Slack HITL — simple confirmation test",
    agents=[agent],
    db=db,
    interfaces=[
        Slack(
            agent=agent,
            reply_to_mentions_only=True,
        ),
    ],
)
app = agent_os.get_app()


if __name__ == "__main__":
    agent_os.serve(app="hitl_simple:app", reload=True, port=7777)
```

## Run the Example

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

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

  <Step title="Export environment variables">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export OPENAI_API_KEY="your_openai_api_key_here"
      export SLACK_SIGNING_SECRET="your_slack_signing_secret_here"
      export SLACK_TOKEN="your_slack_token_here"
      ```

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

  <Step title="Configure Slack">
    Complete [Slack setup](/agent-os/interfaces/slack/setup): create and install the app, expose the server through public HTTPS, and add the scopes listed in the example. The default event request URL is `<public-url>/slack/events`; HITL examples also use `<public-url>/slack/interactions` for interactivity. Use any custom prefix shown in the example instead of `/slack`.
  </Step>

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

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

Full source: [cookbook/05\_agent\_os/interfaces/slack/hitl\_simple.py](https://github.com/agno-agi/agno/blob/main/cookbook/05_agent_os/interfaces/slack/hitl_simple.py)
