Skip to content

Pinperepette/news_agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

31 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ News Agent Pro

Advanced AI-Powered News Analysis & Fact-Checking System

Python Rich AI

๐Ÿš€ Key Features

๐Ÿง  Intelligent Critical Analysis

  • ๐Ÿ”ฌ Scientific Agent: Evaluates research methodology and scientific rigor
  • ๐Ÿ›๏ธ Political Agent: Analyzes political statements and government sources
  • ๐Ÿ’ป Technology Agent: Verifies tech announcements and innovations
  • ๐Ÿ’ฐ Economic Agent: Checks financial data and economic reports
  • ๐ŸŒ Universal Agent: General fact-checking and cross-verification

๐ŸŽฏ Multi-Agent Orchestration

  • Intelligent Routing: AI automatically selects the most appropriate agents
  • Collaborative Verification: Multiple agents work together for comprehensive analysis
  • Domain Detection: Automatic classification of news by topic
  • Specialized Evaluation: Each agent uses domain-specific criteria

๐ŸŒ Multilingual Support

  • Flexible Sources: Select news sources from any language
  • Customizable Output: Receive results in your preferred language
  • Automatic Language Detection: Smart language recognition
  • Intelligent Translation: Seamless cross-language analysis

๐Ÿ“Š Advanced Analytics & Tracking

  • SQLite Database: Complete session and performance tracking
  • Detailed Statistics: Per-session and global analytics
  • Customizable Reports: Data export and analysis
  • Real-time Monitoring: Performance tracking

๐ŸŽจ Modern Rich Interface

  • Beautiful UI: Rich colors and animations
  • Interactive Dashboard: Real-time statistics
  • Progress Indicators: Visual feedback for long operations
  • Keyboard Navigation: Intuitive shortcuts and controls

๐Ÿ” Advanced News Verification System

  • Real news from Google News in real-time (via RSS, no sketchy scraping)
  • Interactive terminal table with keyboard navigation, Rich styling, and focus highlight
  • Multiple AI Providers: Support for Ollama (local), OpenAI, and Claude
  • Chained LLM agents:
    • Summary Agent: concise, factual abstract
    • Implications Agent: in-depth analysis of consequences
    • Theory Agent: connects dots and builds scenarios
    • Universal Analysis Agent: multi-thematic framework for complex topics
    • (All agents can be triggered from the terminal UI!)
  • ๐Ÿ” Advanced News Verification System (with SerpAPI):
    • Verify selected articles or custom text
    • Three verification modes: Fast, Medium, Comprehensive
    • Standard and Advanced verification with step-by-step reasoning
    • Fact-checking search results with full content scraping
    • Bilingual search (Italian + English sources)
    • Reliable sources cross-reference
    • AI-powered truth analysis with critical skepticism
    • Direct truth validation with clear verdicts (VERA/FALSA/DUBBIA)
  • โš™๏ธ Built-in Settings Manager: Modify all configuration directly from UI
  • Full article content scraping for comprehensive analysis
  • Open article in browser with one key
  • Multi-language and Google News topic filtering (configurable in settings)
  • No cloud required:
    • 100% local processing with Ollama, no external APIs needed
    • Cloud options available for higher quality analysis
  • Designed for hacking/extending: config/code separation, easy to customize
  • Cross-Platform Support: Works on Windows, macOS, Linux, and WSL

๐Ÿ“ฆ Installation

Requirements

  • Python 3.8+
  • Ollama (for local models) or OpenAI/Claude API keys

Quick Setup

# Clone the repository
git clone <repository-url>
cd news_agent

# Install dependencies
pip install -e .

# Configure API keys
cp settings.ini.example settings.ini
# Edit settings.ini with your API keys

# Start the application
python -m news_agent.main

Windows Installation

For detailed Windows installation instructions, see WINDOWS_INSTALL.md

๐Ÿ”‘ API Keys Setup

๐Ÿค– AI Providers

OpenAI (Paid - Cloud)

  1. Get API Key: Go to platform.openai.com
  2. Sign up/Login: Create account or login
  3. Add Payment Method: Credit card required
  4. Get API Key: Go to "API Keys" โ†’ "Create new secret key"
  5. Configure:
    [AI]
    provider = openai
    openai_api_key = sk-your-key-here
    openai_model = gpt-4

Claude (Paid - Cloud)

  1. Get API Key: Go to console.anthropic.com
  2. Sign up/Login: Create account or login
  3. Add Payment Method: Credit card required
  4. Get API Key: Go to "API Keys" โ†’ "Create key"
  5. Configure:
    [AI]
    provider = claude
    claude_api_key = sk-ant-your-key-here
    claude_model = claude-3-sonnet-20240229

Ollama (Free - Local)

  1. Install Ollama:
    • macOS/Linux: curl -fsSL https://ollama.ai/install.sh | sh
    • Windows: Download from ollama.ai
  2. Start Ollama: ollama serve
  3. Download Model: ollama pull qwen2:7b-instruct
  4. Configure:
    [AI]
    provider = ollama
    model = qwen2:7b-instruct

๐Ÿ” News Verification APIs (Optional)

SerpAPI (Paid - Web Search)

  1. Get API Key: Go to serpapi.com
  2. Sign up: Create account
  3. Add Payment Method: Credit card required
  4. Get API Key: Dashboard โ†’ "API Key"
  5. Configure:
    [News]
    serpapi_key = your-serpapi-key

ScrapingDog (Paid - Content Extraction)

  1. Get API Key: Go to scrapingdog.com
  2. Sign up: Create account
  3. Add Payment Method: Credit card required
  4. Get API Key: Dashboard โ†’ "API Key"
  5. Configure:
    [News]
    scrapingdog_api_key = your-scrapingdog-key

๐Ÿ’ฐ Pricing Information

OpenAI

  • GPT-4: ~$0.03 per 1K tokens
  • GPT-3.5: ~$0.002 per 1K tokens
  • Free Tier: $5 credit for new users

Claude

  • Claude 3 Sonnet: ~$0.015 per 1K tokens
  • Claude 3 Haiku: ~$0.0025 per 1K tokens
  • Free Tier: $5 credit for new users

SerpAPI

  • Starter: $50/month for 5,000 searches
  • Basic: $100/month for 12,500 searches
  • Pro: $250/month for 35,000 searches

ScrapingDog

  • Starter: $29/month for 1,000 requests
  • Basic: $99/month for 5,000 requests
  • Pro: $299/month for 20,000 requests

Ollama

  • Free: No cost, runs locally
  • Hardware: Requires 8GB+ RAM for good performance

โš™๏ธ Complete Configuration Example

[AI]
provider = openai
openai_api_key = sk-your-openai-key-here
openai_model = gpt-4

[News]
serpapi_key = your-serpapi-key
scrapingdog_api_key = your-scrapingdog-key

[General]
default_language = en
articles_per_page = 15
search_timeout = 30
enable_analytics = true

๐ŸŽฏ How to Use

๐Ÿš€ Quick Mode

  1. Launch the application
  2. Select "Quick Mode"
  3. System automatically analyzes predefined sources
  4. Receive results in your preferred language

๐Ÿ” Custom Analysis

  1. Select Sources: Choose from multiple languages
  2. Choose Output Language: Independent of source language
  3. Critical Analysis: AI analyzes like an expert
  4. Detailed Results: Plausibility assessment and suspicious points

๐Ÿ“ Manual Analysis

  1. Enter article title and content
  2. System automatically detects language
  3. Receive complete critical analysis
  4. Strategic queries for verification

๐Ÿค– AI Agents Overview

๐Ÿ”ฌ Scientific Agent

  • Purpose: Evaluates research methodology and scientific studies
  • Focus:
    • Access to original data vs. reconstructions
    • Experimental protocol rigor
    • Instrumentation quality
    • Peer review status
    • Replicability of methods
  • Icon: ๐Ÿ”ฌ

๐Ÿ›๏ธ Political Agent

  • Purpose: Analyzes political statements and government sources
  • Focus:
    • Official declarations
    • Government communications
    • Political party statements
    • Institutional sources
  • Icon: ๐Ÿ›๏ธ

๐Ÿ’ป Technology Agent

  • Purpose: Verifies tech announcements and innovations
  • Focus:
    • Official company announcements
    • Patent information
    • Technical documentation
    • Industry expert opinions
  • Icon: ๐Ÿ’ป

๐Ÿ’ฐ Economic Agent

  • Purpose: Checks financial data and economic reports
  • Focus:
    • Official financial reports
    • Economic indicators
    • Market data
    • Expert economic analysis
  • Icon: ๐Ÿ’ฐ

๐ŸŒ Universal Agent

  • Purpose: General fact-checking and cross-verification
  • Focus:
    • Multiple source verification
    • Cross-reference checking
    • General credibility assessment
  • Icon: ๐ŸŒ

๐ŸŒ Supported Sources

๐Ÿ‡ฎ๐Ÿ‡น Italian

  • ANSA
  • Repubblica
  • Corriere della Sera
  • Il Sole 24 Ore
  • La Stampa

๐Ÿ‡บ๐Ÿ‡ธ English

  • Reuters
  • BBC News
  • CNN
  • TechCrunch
  • Wired
  • The Verge

๐Ÿ‡ซ๐Ÿ‡ท French

  • Le Monde
  • Le Figaro
  • Les Echos
  • L'Express

๐Ÿ‡ช๐Ÿ‡ธ Spanish

  • El Paรญs
  • El Mundo
  • ABC
  • La Vanguardia

๐Ÿ‡ฉ๐Ÿ‡ช German

  • Der Spiegel
  • Die Zeit
  • Sรผddeutsche Zeitung
  • Frankfurter Allgemeine

๐ŸŽฎ Navigation & Controls

Main Menu

  • Arrow Keys: Navigate between options
  • Enter: Select option
  • q: Quit application

Article List

  • โ†‘โ†“: Navigate articles
  • Enter: Open selected article
  • n: Next page
  • p: Previous page
  • o: Open article in browser
  • v: Critical analysis
  • c: Configuration
  • q: Quit

Analysis Mode

  • 1: Analyze selected article
  • 2: Custom text analysis
  • 3: URL analysis
  • 0: Back to main menu

LLM Agents Menu (a)

  1. Summary: Quick factual summary using full article content
  2. Implications: Social, economic, political consequences
  3. Theory/Scenario: Complex scenarios and connections
  4. Universal Analysis: Multi-thematic framework for complex topics
  5. All Agents: Run all agents in sequence

โš™๏ธ Configuration

AI Provider Settings

  • Ollama (Local - no internet required)
  • OpenAI (GPT-4/GPT-3.5)
  • Claude (Anthropic)
  • Auto (Automatic fallback)

API Keys

  • OpenAI API Key
  • Claude API Key
  • SerpAPI Key (for web search)
  • ScrapingDog API Key (for content extraction)

General Settings

  • Default language
  • Number of results per page
  • Search timeout
  • Cache settings

๐Ÿ“ฐ SELECTED ARTICLE:

  1. Standard Verification: Basic critical analysis of selected article
  2. Standard Truth Validation: Direct truth validation with confidence level
  3. Multi-Agent System ๐Ÿค–: NEW - Complete analysis with 6 specialized agents

๐Ÿ“ CUSTOM TEXT:

  1. Standard Verification: Basic critical analysis of custom text
  2. Advanced Verification (Step-by-Step): Detailed analysis with structured reasoning
  3. Advanced Truth Validation: Advanced truth validation with complex analysis

๐Ÿค– Multi-Agent System (Option 3):

The most comprehensive verification system using 6 specialized agents:

  • ๐Ÿ” Investigator Agent: Finds and collects key information
  • ๐Ÿ“Š Methodological Analyst Agent: Evaluates scientific studies
  • ๐ŸŽฏ Verifier Agent: Checks specific facts
  • โš–๏ธ Judge Agent: Analyzes bias and conflicts of interest
  • ๐ŸŒ Consensus Agent: Analyzes scientific consensus
  • ๐Ÿง  Synthesizer Agent: Combines all results for final verdict

โšก Verification Modes:

  • Fast (~30 sec): Quick fact-checking, basic sources, Italian only
  • Medium (~2 min): Balanced approach, bilingual sources, full scraping
  • Comprehensive (~5 min): Comprehensive analysis, complete bilingual sources

๐Ÿ”ง Technical Architecture

Core Components

  • Critical Analyst: Main analysis engine
  • Intelligent Orchestrator: Agent selection and coordination
  • Specialized Agents: Domain-specific analysis
  • Multilingual System: Language handling
  • Rich UI: User interface

Data Flow

  1. Input: Article or text
  2. Analysis: Critical assessment
  3. Routing: Agent selection
  4. Verification: Multi-source checking
  5. Evaluation: Final assessment
  6. Output: Detailed report

๐Ÿ“Š Analytics & Reports

Session Tracking

  • Articles analyzed
  • Sources used
  • Analysis time
  • Agent performance

Global Statistics

  • Total articles processed
  • Success rate
  • Most used sources
  • Performance trends

Export Options

  • CSV reports
  • JSON data
  • Custom formats

๐Ÿ› ๏ธ Development

Project Structure

news_agent/
โ”œโ”€โ”€ news_agent/
โ”‚   โ”œโ”€โ”€ main.py                 # Main application
โ”‚   โ”œโ”€โ”€ critical_analyst.py     # Critical analysis logic
โ”‚   โ”œโ”€โ”€ intelligent_orchestrator.py  # Agent coordination
โ”‚   โ”œโ”€โ”€ specialized_agents.py   # Domain-specific agents
โ”‚   โ”œโ”€โ”€ multilingual_system.py  # Language handling
โ”‚   โ”œโ”€โ”€ analytics.py            # Analytics system
โ”‚   โ”œโ”€โ”€ ui.py                   # User interface
โ”‚   โ””โ”€โ”€ settings.py             # Configuration
โ”œโ”€โ”€ tests/                      # Test files
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ settings.ini
โ””โ”€โ”€ README.md

Running Tests

# Run all tests
python -m pytest

# Run specific test
python test_critical_analyst.py
python test_integration.py

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

๐Ÿ“„ License

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

๐Ÿ†˜ Support

For issues and questions:

  • Check the WINDOWS_INSTALL.md for Windows-specific help
  • Review the configuration examples
  • Check the test files for usage examples

News Agent Pro - Advanced AI-powered news analysis and fact-checking system

About

Think locally. Parse globally.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages