GraphNews is a sophisticated multi-agent system built with LangGraph that automates the end-to-end process of news research, curation, and newsletter drafting. Unlike standard linear AI chains, this project utilizes a Cyclic Graph architecture to implement a "Self-Correction" loop, ensuring high-quality, factual output through autonomous peer review.
The system treats the editorial process as a state machine. Data flows through specialized nodes, maintaining a shared state to ensure context is preserved across the entire lifecycle:
- RESEARCHER: Scours the web using Tavily for the top 10 .
- CURATOR: Filters research results to select the top 5 most relevant sources.
- WRITER: Generates a structured Markdown draft based on curated items.
- CRITIC: Evaluates the draft. If the score is < 8/10, the draft is sent back to the WRITER with specific feedback for revision.
- FINALIZE: Once the quality threshold is met, or we reach the 3rd draft (to avoid infinite loops), the final newsletter is saved to disk.
graph TD
Start((Start)) --> Researcher[Researcher Node]
Researcher --> Curator[Curator Node]
Curator --> Writer[Writer Node]
Writer --> Critic[Critic Node]
Critic --> Decision{Score >= 8?}
Decision -- "No (Score < 8 and draft number < 3)" --> Writer
Decision -- "Yes (Approved)" --> End((Save Markdown))
subgraph "The Agentic Loop"
Writer
Critic
Decision
end
style Researcher fill:#f9f,stroke:#333,stroke-width:2px
style Curator fill:#bbf,stroke:#333,stroke-width:2px
style Writer fill:#dfd,stroke:#333,stroke-width:2px
style Critic fill:#fdd,stroke:#333,stroke-width:2px
style Decision fill:#fff,stroke:#333,stroke-width:2px
- Orchestration: LangGraph (Stateful Multi-Agent Workflows)
- LLM: DeepSeek-V3.2
- Search Engine: Tavily AI (Search API for LLMs)
- Language: Python
git clone https://github.com/simonsl07/GraphNews.git
cd GraphNews
pip install -r requirements.txtDEEPSEEK_API_KEY=your_key_here
TAVILY_API_KEY=your_key_here
python main.py- The "Hallucination" Brake: Implemented a max revision counter within the Critic node logic to prevent infinite loops and runaway API costs.
- Deterministic State Control: Used LangGraph's TypedDict state to maintain a single source of truth, preventing context drift.
- Add CLI arguments to control news topic and source count.
- Integrate LangSmith for full-trace agent debugging and cost monitoring.
- Human-in-the-Loop: Add a LangGraph Checkpointer to pause for human approval before final output.