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.
-
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.
- Run the agent directly with
- Google ADK β Agent orchestration.
- Gemini API β Text analysis and summarization.
- PRAW β Reddit data retrieval.
- Python 3.9+ β Core runtime.
-
Clone the Repository
git clone https://github.com/yourusername/reddit-analysis-agent.git cd reddit-analysis-agent -
Create Virtual Environment & Install Dependencies
python3 -m venv venv source venv/bin/activate # (Linux/Mac) venv\Scripts\activate # (Windows) pip install -r requirements.txt
-
Set Up Environment Variables Create a
.envfile 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
-
Authenticate Google ADK Follow Google ADK setup guide.
Once installed, simply run:
google adk runThe agent will prompt you for a keyword (e.g., "AI", "climate change", "crypto") and return an analysis of Reddit discussions.
Keyword: "AI"
## 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.
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
Your requirements.txt should include:
praw
google-generativeai
python-dotenv
- 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.
Contributions are welcome!
- Fork the repo
- Create a new branch
- Submit a pull request
This project is licensed under the MIT License β see the LICENSE file for details.