This project is a multi-agent AI assistant built using LangGraph framework. It demonstrates how multiple agents can collaborate to extract topics from user queries, fetch relevant news, and generate concise summaries. The system is implemented in Python and leverages HuggingFace Transformers, LangGraph, and custom tools for a robust workflow.
The assistant currently runs as a console-based application, demonstrating multi-agent orchestration without requiring a UI.
intent_agentnews_agentget_news to retrieve articles dynamically.summarizer_agentImplements a StateGraph to connect agents:
Intent → News → SummarizerAgents communicate via a typed state dictionary (NewsState) to maintain structured data flow.
Console outputs track workflow progress, providing feedback for each step.
Python 3.x
Transformers & HuggingFace Pipeline: FLAN-T5-small for local LLM inference
LangGraph: Prebuilt REACT agents & StateGraph orchestration
Custom Tools:
detect_topic_llm: Topic extractionget_news: Fetch relevant newssummarize_articles: Article summarizationClone the repository:
git clone https://github.com/nirmalakuslekar/multi-agent-langgraph-news-qa-assistant.git
Navigate to the project directory:
cd multi-agent-langgraph-news-qa-assistant
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
Set the NewsAPI key as an environment variable:
export NEWS_API_KEY="your_api_key_here" # Linux/macOS
setx NEWS_API_KEY "your_api_key_here" # Windows
Run the application:
python main.py
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline from langchain_huggingface import ChatHuggingFace from langchain_huggingface.llms import HuggingFacePipeline device = 0 if torch.cuda.is_available() else -1 model_name = "google/flan-t5-small" tokenizer = AutoTokenizer.from_pretrained(model_name) base_model = AutoModelForSeq2SeqLM.from_pretrained(model_name) pipe = pipeline("text2text-generation", model=base_model, tokenizer=tokenizer, device=device) llm_pipeline = HuggingFacePipeline(pipeline=pipe) local_llm = ChatHuggingFace(llm=llm_pipeline)
from typing import TypedDict, List class NewsState(TypedDict): user_input: str topic: str articles: List[dict] summaries: List[dict]
intent_agent = create_react_agent(model=local_llm, tools=[detect_topic_llm], prompt="Extract topic keyword") news_agent = create_react_agent(model=local_llm, tools=[get_news], prompt="Fetch relevant news") summarizer_agent = create_react_agent(model=local_llm, tools=[summarize_articles], prompt="Summarize articles")
graph = StateGraph(NewsState) graph.add_node(intent_node) graph.add_node(news_node) graph.add_node(summarizer_node) graph.add_edge("intent_node", "news_node") graph.add_edge("news_node", "summarizer_node") graph.set_entry_point("intent_node") graph.set_finish_point("summarizer_node")
initial_state = NewsState(user_input="Get me the latest news about Netflix", topic="", articles=[], summaries=[]) compiled_graph = graph.compile() final_state = compiled_graph.invoke(initial_state)
The system performance was evaluated qualitatively using real-world news queries
across domains such as entertainment, technology, and business.
Evaluation Metrics
Testing Methodology
Each user query was processed through the complete multi-agent pipeline:
Intent Detection → News Retrieval → Summarization → Human Review.
The system was tested manually with multiple queries. Human feedback was used
to validate summary quality and trigger refinement when necessary.
Baseline Comparison
Compared to a single-agent summarization pipeline, the multi-agent LangGraph
approach provides:

This diagram illustrates the LangGraph-based multi-agent workflow, showing how the Intent Agent, News Agent, and Summarizer Agent communicate through a shared state.


This figure shows the runtime execution flow of the system, including human-in-the-loop interaction.
The complete working code for this Multi-Agent LangGraph News QA Assistant can be accessed on GitHub: