Skip to content

a-nnurag/RedditAgent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Reddit Post Analysis Agent (RAG Workflow)

A Retrieval-Augmented Generation (RAG) powered Reddit post analysis agent built with Google ADK, Gemini API, and PRAW. This agent retrieves Reddit posts and comments based on a user-provided keyword and generates AI-powered analysis reports.


πŸš€ Features

  • Keyword-based Retrieval

    • Enter any keyword, and the agent fetches Reddit posts/comments related to it.
    • Works across multiple subreddits.
  • RAG Workflow with Gemini API

    • Collected Reddit data is passed into Google ADK (with Gemini API) for analysis.
    • Produces summaries, sentiment insights, and key entities/topics.
  • Actionable Insights

    • Detects positive/negative sentiment, trending entities, and discussion themes.
    • Outputs in JSON or Markdown format.
  • Seamless CLI Execution

    • Run the agent directly with google adk run.
    • No need for custom scripts β€” just supply a keyword.

πŸ› οΈ Tech Stack

  • Google ADK – Agent orchestration.
  • Gemini API – Text analysis and summarization.
  • PRAW – Reddit data retrieval.
  • Python 3.9+ – Core runtime.

πŸ“¦ Installation

  1. Clone the Repository

    git clone https://github.com/yourusername/reddit-analysis-agent.git
    cd reddit-analysis-agent
  2. Create Virtual Environment & Install Dependencies

    python3 -m venv venv
    source venv/bin/activate   # (Linux/Mac)
    venv\Scripts\activate      # (Windows)
    
    pip install -r requirements.txt
  3. Set Up Environment Variables Create a .env file in the root:

    # Google Gemini / ADK
    GOOGLE_GENAI_USE_VERTEXAI=FALSE
    GOOGLE_API_KEY=your_google_api_key
    
    # Reddit API (PRAW)
    client_id=your_client_id
    client_secret=your_client_secret
    user_agent=RedditEngagementTracker/1.0
  4. Authenticate Google ADK Follow Google ADK setup guide.


▢️ Running the Agent

Once installed, simply run:

google adk run

The agent will prompt you for a keyword (e.g., "AI", "climate change", "crypto") and return an analysis of Reddit discussions.


πŸ“Š Example Output

Input

Keyword: "AI"

Output Report (Markdown)

## Reddit Analysis Report – Keyword: "AI"

**Top Posts**
1. "AI beats humans in a strategy game" (1200 upvotes)
2. "Concerns about AI regulation" (850 upvotes)

**Sentiment Breakdown**
- Positive: 61%
- Neutral: 27%
- Negative: 12%

**Key Entities**
- OpenAI
- Google
- ChatGPT
- Regulation

**Summary**
Discussions about "AI" are dominated by excitement over breakthroughs,
balanced by concerns about ethics, regulations, and long-term risks.

πŸ“‚ Project Structure

redditagent/
│── __pycache__/            # Python cache files
│── __init__.py             # Marks as a package
│── .env                    # API keys & credentials
│── agent.py                # Google ADK RAG agent definition
│── venv/                   # Virtual environment
│── README.md               # Documentation
│── requirements.txt        # Dependencies

πŸ“œ Requirements

Your requirements.txt should include:

praw
google-generativeai
python-dotenv

🧩 Future Improvements

  • Multi-keyword search in one run.
  • Real-time monitoring of subreddit discussions.
  • Visualization dashboard (Streamlit).
  • Support for multi-language Reddit analysis.
  • Export reports to Google Sheets/Slack.

🀝 Contributing

Contributions are welcome!

  1. Fork the repo
  2. Create a new branch
  3. Submit a pull request

πŸ“œ License

This project is licensed under the MIT License – see the LICENSE file for details.


About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages