Automated AI news agent that monitors RSS feeds, summarizes insights using Perplexity Sonar, and delivers daily digests to Telegram.
A Python tool that runs locally on your machine. When executed, it fetches AI news from multiple RSS feeds, generates concise summaries using the Perplexity API, and posts them to a Telegram channel/bot. The tool includes local storage for all fetched articles and summaries, plus a final overview summary that consolidates all news into a single digest.
Key Features:
- 📰 Monitors multiple AI news RSS feeds
- 🤖 AI-powered summaries using Perplexity Sonar
- 💾 Local storage of all fetched articles and summaries
- 📊 Daily overview summary with bullet points
- 🔒 Budget management to protect API credits
- 📬 Automated Telegram delivery
Primary Constraint: Simple local execution with strict budget management to preserve the $5/month Perplexity API credit.
- Python 3.10 or higher
- Perplexity API key (sign up at https://www.perplexity.ai/)
- Telegram Bot Token (create a bot using @BotFather on Telegram)
- Telegram Chat ID (use @userinfobot to get your chat ID, or use a channel ID)
-
Clone this repository:
git clone https://github.com/soroush-thr/spectrum.git cd spectrum -
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Copy
.env.exampleto.env:cp .env.example .env
- Edit
.envand fill in your API keys:PERPLEXITY_API_KEY=pplx-your-actual-key-here TELEGRAM_BOT_TOKEN=your-bot-token-here TELEGRAM_CHAT_ID=your-chat-id-here
- Copy
Run the script:
python main.pyThe script will:
- Fetch articles from configured RSS feeds
- Filter articles published in the last 48 hours (configurable)
- Sort by date (newest first)
- Process up to 5 articles (budget limit)
- Summarize each article using Perplexity API
- Post individual summaries to your Telegram channel/bot
- Generate and send a final overview summary with bullet points
- Save all fetched articles and summaries locally to
storage/directory
Individual Messages:
Source: [Feed Name]
Headline: [Article Title]
Summary: [AI-generated summary]
Link: [Article URL]
Final Overview:
📊 Daily AI News Overview (YYYY-MM-DD)
• [Bullet point summary of all news]
• [Key developments and trends]
• [Consolidated insights]
Edit config.py to modify the RSS feed sources. The default configuration includes:
- The Verge - AI
- TechCrunch - AI
- Ars Technica - AI
- MIT Technology Review - AI
- Wired - AI
The script includes built-in budget protection:
- MAX_ARTICLES: Maximum number of articles to process per run (default: 5)
- HOURS_LOOKBACK: Hours to look back for articles (default: 48)
These can be adjusted in config.py to match your budget and needs.
All fetched articles and generated summaries are automatically saved to the storage/ directory:
-
Fetched Articles:
storage/fetched_articles_YYYY-MM-DD_HH-MM-SS.json- Contains all articles found in RSS feeds (before filtering)
- Includes title, link, description, publication date, and source feed
-
Summaries:
storage/summaries_YYYY-MM-DD_HH-MM-SS.json- Contains processed articles with AI-generated summaries
- Includes all article metadata plus the summary and processing timestamp
This allows you to:
- Review what was fetched even if articles were too old to process
- Keep a local archive of all summaries
- Analyze trends over time
- Debug issues with specific articles
- The script processes a maximum of 5 articles per run, even if more articles are found
- Articles are sorted by date (newest first) before applying the limit
- If an error occurs (e.g., API rate limit), the script will skip that article and continue with the next one
- Each run uses:
(number of articles + 1)Perplexity API calls (one per article + one for final overview) - Monitor your Perplexity API usage to stay within the $5/month credit
- Make sure you've created a
.envfile (copy from.env.example) - Verify the key is correctly formatted:
PERPLEXITY_API_KEY=pplx-...
- Create a bot using @BotFather on Telegram
- Copy the token and add it to your
.envfile - See
telegram-bot-setup.mdfor detailed bot configuration instructions
- For personal chats: Use @userinfobot to get your chat ID
- For channels: Forward a message from your channel to @userinfobot or use the channel's username (e.g.,
@yourchannel)
- Check your internet connection
- Verify the RSS feed URL is accessible
- Some feeds may be temporarily unavailable
- The script will continue processing other feeds if one fails
- You've hit the rate limit or exceeded your credit
- Wait before running the script again
- Check your Perplexity API usage dashboard
- Consider reducing
MAX_ARTICLESinconfig.py
- The RSS feeds may not have published new articles in the last 48 hours
- Check the feed URLs in
config.pyare correct and accessible - Review the
storage/fetched_articles_*.jsonfiles to see what was fetched - Consider increasing
HOURS_LOOKBACKinconfig.pyif needed
.
├── .env # Your local API keys (ignored by git)
├── .env.example # Template for .env
├── .gitignore # Excludes .env, __pycache__, storage/, etc.
├── config.py # RSS feeds and constants
├── main.py # Main application logic
├── requirements.txt # Python dependencies
├── telegram-bot-setup.md # Telegram bot configuration guide
├── logo-prompt.md # Logo generation prompt for bot profile picture
├── storage/ # Local storage directory (gitignored)
│ ├── fetched_articles_*.json
│ └── summaries_*.json
└── README.md # This file
This is a local MVP with no database or state management. The script relies on:
- Time-based filtering (last N hours) to avoid processing duplicate articles
- Local JSON files for storage and archival
- Simple error handling that continues processing on failures
Contributions are welcome! Please feel free to submit a Pull Request.
See LICENSE file for details.