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

# Research Assistant

> Agent that searches Slack message history and the web to answer research questions

## Code

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

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

research_assistant = Agent(
    name="Research Assistant",
    model=OpenAIChat(id="gpt-4o"),
    db=agent_db,
    tools=[
        SlackTools(
            enable_search_messages=True,
            enable_get_thread=True,
            enable_list_users=True,
            enable_get_user_info=True,
        ),
        WebSearchTools(),
    ],
    instructions=[
        "You are a research assistant that helps find information.",
        "You can search Slack messages using: from:@user, in:#channel, has:link, before:/after:date",
        "You can also search the web for current information.",
        "When asked to research something:",
        "1. Search Slack for internal discussions",
        "2. Search the web for external context",
        "3. Synthesize findings into a clear summary",
        "Identify relevant experts by looking at who contributed to discussions.",
    ],
    add_history_to_context=True,
    num_history_runs=3,
    add_datetime_to_context=True,
    markdown=True,
)

agent_os = AgentOS(
    agents=[research_assistant],
    interfaces=[
        Slack(
            agent=research_assistant,
            reply_to_mentions_only=True,
        )
    ],
)
app = agent_os.get_app()

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

## Usage

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

  <Step title="Set Environment Variables">
    ```bash theme={null}
    export SLACK_TOKEN=xoxb-your-bot-user-token
    export SLACK_SIGNING_SECRET=your-signing-secret
    export OPENAI_API_KEY=your-openai-api-key
    ```
  </Step>

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

  <Step title="Run Example">
    ```bash theme={null}
    python research_assistant.py
    ```
  </Step>
</Steps>

## Key Features

* **Slack Message Search**: Searches workspace history using Slack query syntax (`from:@user`, `in:#channel`, `has:link`, `before:/after:date`)
* **Web Search Integration**: Combines internal Slack findings with external web results for comprehensive answers
* **User Lookup**: Identifies relevant experts by resolving user IDs and checking who contributed to discussions
* **Session Persistence**: SQLite database stores conversation history across restarts
