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

# Reddit

> Use Reddit tools with Agno agents.

## Prerequisites

1. Create/Login to Reddit account
   * Go to [https://www.reddit.com](https://www.reddit.com)

2. Create a Reddit App
   * Go to [https://www.reddit.com/prefs/apps](https://www.reddit.com/prefs/apps)
   * Click "Create App" or "Create Another App" button
   * Fill in required details:
     * Name: Your app name
     * App type: Select "script"
     * Description: Brief description
     * About url: Your website (can be [http://localhost](http://localhost))
     * Redirect uri: [http://localhost:8080](http://localhost:8080)
   * Click "Create app" button

3. Get credentials
   * client\_id: Found under your app name (looks like a random string)
   * client\_secret: Listed as "secret"
   * user\_agent: Format as: "platform:app\_id:version (by /u/username)"
   * username: Your Reddit username
   * password: Your Reddit account password

```python theme={null}

from agno.agent import Agent
from agno.tools.reddit import RedditTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

agent = Agent(
    instructions=[
        "Use your tools to answer questions about Reddit content and statistics",
        "Respect Reddit's content policies and NSFW restrictions",
        "When analyzing subreddits, provide relevant statistics and trends",
    ],
    tools=[RedditTools()],
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    agent.print_response("What are the top 5 posts on r/SAAS this week ?", stream=True)
```

## Run the Example

```bash theme={null}
# Clone and setup repo
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/91_tools

# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate

python reddit_tools.py
```

For details, see [Reddit cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/91_tools/reddit_tools.py).
