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

# Basic Slack Agent

> Minimal Slack bot with SQLite session persistence and @mention replies

Part of the [Slack interface](https://agno-v2.mintlify.site/agent-os/interfaces/slack/introduction.md) examples. Follow the [setup guide](https://agno-v2.mintlify.site/agent-os/interfaces/slack/setup.md).

## Code

```python basic.py theme={null}
from agno.agent import Agent
from agno.db.sqlite.sqlite import SqliteDb
from agno.models.openai import OpenAIChat
from agno.os.app import AgentOS
from agno.os.interfaces.slack import Slack

agent_db = SqliteDb(session_table="agent_sessions", db_file="tmp/persistent_memory.db")

basic_agent = Agent(
    name="Basic Agent",
    model=OpenAIChat(id="gpt-5.4-mini"),
    db=agent_db,
    add_history_to_context=True,
    num_history_runs=3,
    add_datetime_to_context=True,
)

# Setup our AgentOS app
agent_os = AgentOS(
    agents=[basic_agent],
    interfaces=[
        Slack(
            agent=basic_agent,
            reply_to_mentions_only=True,  # The Agent will react only to messages mentioning it
        )
    ],
)
app = agent_os.get_app()


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

## Usage

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

**1. Set Environment Variables**

```bash theme={null}
export SLACK_TOKEN=***
export SLACK_SIGNING_SECRET=***
export OPENAI_API_KEY=***
```

**2. Install Dependencies**

```bash theme={null}
uv pip install -U "agno[os,slack]" openai
```

**3. Run Example**

```bash theme={null}
python basic.py
```

## Key Features

* **Mention-Only Replies**: Responds only to @mentions in channels
* **Session Persistence**: SQLite database stores conversation history across restarts
* **Conversation History**: Last 3 interactions included in context


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.