Skip to content

About

AI News Digest Bot with LangChain and LangGraph.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🤖 AI News Digest Bot

A micro project to explore LangChain and LangGraph by building a multi-agent system that researches topics and generates article summaries with insights.

Gradio Web Interface Web interface with progress tracking and organized results

What it does

  • 🔍 Multi-source search using DuckDuckGo (default), Wikipedia, Tavily, or Brave
  • 🤖 Three specialized agents: Searcher finds articles, Summarizer condenses content, Insights generates takeaways
  • 🔄 Retry logic that broadens queries when results are too few
  • 🧠 LLM support for Claude Sonnet 4.5 or Gemini Pro
  • ⚡ Typically runs in under 60 seconds

Architecture

User Input → Searcher → [Check Results] → Summarizer → Insights → Output
                             ↓
                        [<2 results? Retry with broader query]

The system uses three agents:

  1. Searcher queries search APIs for relevant articles
  2. Summarizer uses an LLM to condense articles into key points
  3. Insights generates actionable takeaways and identifies trends

Stack: LangChain and LangGraph for orchestration, Gradio for the web interface, Claude or Gemini for language processing.

Setup

Clone and install dependencies:

git clone <your-repo-url>
cd Lang-Lands
pip install -r requirements.txt

Create a .env file (copy from .env.example):

# Pick one LLM provider
ANTHROPIC_API_KEY=sk-ant-your-key-here
# or
GOOGLE_API_KEY=your-google-key-here

# Optional search upgrades (DuckDuckGo works without keys)
# TAVILY_API_KEY=tvly-xxx    # 1000 free searches/month
# BRAVE_API_KEY=xxx          # 2000 free searches/month

Usage

Web interface (recommended):

python run_app.py

Opens at http://localhost:7860 with:

  • Example topics to get started
  • Real-time progress updates
  • Tabbed results (summaries, insights, sources)

Command line:

python main.py

Enter a topic when prompted.

Test search only (no LLM required):

python test_run.py

Project Structure

Lang-Lands/
├── backend/                 # Core logic
│   ├── agents/             # Searcher, Summarizer, Insights
│   ├── graph/              # LangGraph workflow and state
│   ├── utils/              # Search client
│   └── api.py              # Clean interface
│
├── frontend/               # Gradio web UI
│   ├── app.py
│   └── components.py
│
├── requirements/           # Split dependencies
│   ├── base.txt           # Backend only
│   ├── web.txt            # Backend + Gradio
│   └── dev.txt            # All + dev tools
│
├── main.py                # CLI entry
├── run_app.py             # Web entry
└── test_run.py            # Search test

Example Output

$ python main.py
Enter a topic to research: GPT-5 rumors
🔍 Searching for: GPT-5 rumors
✓ Found 5 results
📝 Summarizing articles...
✓ Summaries generated
💡 Generating insights...
✓ Insights generated

============================================================
🔍 AI NEWS DIGEST: GPT-5 RUMORS
============================================================

📰 ARTICLE SUMMARIES
• OpenAI hasn't officially announced GPT-5...
• Industry experts speculate Q2 2025 release...
[...]

────────────────────────────────────────────────────────────

💡 KEY INSIGHTS
1. Development Timeline: GPT-5 remains speculative...
2. Capability Expectations: Anticipated improvements...
[...]

────────────────────────────────────────────────────────────
📊 Sources: 5 articles analyzed

Configuration

LLM providers:

  • Claude Sonnet 4.5: Set ANTHROPIC_API_KEY
  • Gemini Pro: Set GOOGLE_API_KEY

Search priority (checks in order):

  1. Tavily (if TAVILY_API_KEY set)
  2. Brave (if BRAVE_API_KEY set)
  3. DuckDuckGo (default, no key needed)
  4. Wikipedia (fallback)

Development

Add a new agent:

  1. Create a file in backend/agents/
  2. Define a node function accepting and returning GraphState
  3. Wire it into the workflow in backend/graph/workflow.py

Modify workflow: Edit backend/graph/workflow.py to add nodes, change routing, or adjust retry behavior.

Add search providers: Implement new methods in backend/utils/search_client.py following the existing pattern.

Troubleshooting

"No LLM API key found" Create a .env file with ANTHROPIC_API_KEY or GOOGLE_API_KEY.

No search results The bot retries with broader queries automatically (up to 2 times) and falls back to Wikipedia if needed.

Rate limits DuckDuckGo has undocumented rate limits. Switch to Tavily or Brave for higher volume.

Resources

License

MIT License - see LICENSE for details.

About

AI News Digest Bot with LangChain and LangGraph.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages