> ## 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 Team HITL: External Execution (Simple)

> Slack team whose member agent has an external-execution send_email tool; the run pauses, Slack shows the tool name and arguments, and the user supplies the result.

Simple port of AgentOS human\_in\_the\_loop/team/external\_tool\_execution.py.

```python team_hitl_external_execution_simple.py theme={null}
"""
Slack Team HITL — External Execution (Simple)
==============================================

Simple port of AgentOS human_in_the_loop/team/external_tool_execution.py.

A team member's tool is marked for external execution. The run pauses and
Slack shows the tool name and arguments. The user executes the tool externally
and provides the result.

Try in Slack:
  @bot send an email to alice@example.com about the meeting

Slack scopes: app_mentions:read, assistant:write, chat:write, im:history
"""

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

db = SqliteDb(
    db_file="tmp/team_hitl_external_execution_simple.db",
    session_table="team_sessions",
    approvals_table="approvals",
)


@tool(external_execution=True)
def send_email(to: str, subject: str, body: str) -> str:
    """Send an email to someone. Executed externally by the user."""
    return ""


email_agent = Agent(
    name="EmailAgent",
    model=OpenAIResponses(id="gpt-5.4"),
    tools=[send_email],
    instructions=[
        "You MUST call the send_email tool immediately when asked to send an email.",
        "Do NOT simulate or describe sending - use the tool.",
    ],
    db=db,
    telemetry=False,
)

team = Team(
    id="email-team-hitl-simple",
    name="CommunicationTeam",
    model=OpenAIResponses(id="gpt-5.4"),
    members=[email_agent],
    instructions=["Delegate all email requests to the EmailAgent immediately."],
    db=db,
    add_history_to_context=True,
    telemetry=False,
)

agent_os = AgentOS(
    description="Slack Team HITL — external execution (simple)",
    teams=[team],
    db=db,
    interfaces=[
        Slack(
            team=team,
            reply_to_mentions_only=True,
        ),
    ],
)
app = agent_os.get_app()


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

## 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 `team_hitl_external_execution_simple.py`, then run:

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

Full source: [cookbook/05\_agent\_os/interfaces/slack/team\_hitl\_external\_execution\_simple.py](https://github.com/agno-agi/agno/blob/main/cookbook/05_agent_os/interfaces/slack/team_hitl_external_execution_simple.py)
