<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>LangGraph |</title><link>https://dhruvmadhwal.github.io/tags/langgraph/</link><atom:link href="https://dhruvmadhwal.github.io/tags/langgraph/index.xml" rel="self" type="application/rss+xml"/><description>LangGraph</description><generator>HugoBlox Kit (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Sun, 01 Jun 2025 00:00:00 +0000</lastBuildDate><image><url>https://dhruvmadhwal.github.io/media/icon.svg</url><title>LangGraph</title><link>https://dhruvmadhwal.github.io/tags/langgraph/</link></image><item><title>Multi-Hop Reasoning Agent</title><link>https://dhruvmadhwal.github.io/projects/pytorch/</link><pubDate>Sun, 01 Jun 2025 00:00:00 +0000</pubDate><guid>https://dhruvmadhwal.github.io/projects/pytorch/</guid><description>&lt;p&gt;Large language models can answer many questions directly, but they often struggle when a question requires several connected steps. Research shows that breaking complex questions into smaller sub-questions can improve performance, especially when each step is supported by retrieved evidence instead of relying only on model memory (
,
,
).&lt;/p&gt;
&lt;h2 id="why-multi-hop-reasoning"&gt;Why Multi-Hop Reasoning?&lt;/h2&gt;
&lt;p&gt;This project builds on that idea by creating a multi-agent question answering system for complex, multi-step questions. Instead of sending one large prompt to a model, the system decomposes the task, plans intermediate steps, retrieves evidence when needed, and synthesizes a final answer.&lt;/p&gt;
&lt;p&gt;The goal is to produce answers that are grounded and traceable rather than purely guessed from model memory. This is useful for questions that require combining facts across domains such as sports, geography, literature, or current events.&lt;/p&gt;
&lt;p&gt;For example, consider the question:&lt;/p&gt;
&lt;blockquote class="border-l-4 border-neutral-300 dark:border-neutral-600 pl-4 italic text-neutral-600 dark:text-neutral-400 my-6"&gt;
&lt;p&gt;What country is home to the city where the author of &lt;em&gt;Pride and Prejudice&lt;/em&gt; was born?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A direct answer requires multiple connected steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Identify the author of &lt;em&gt;Pride and Prejudice&lt;/em&gt;.&lt;br&gt;
Answer: Jane Austen.&lt;/li&gt;
&lt;li&gt;Find where Jane Austen was born.&lt;br&gt;
Answer: Steventon, Hampshire.&lt;/li&gt;
&lt;li&gt;Determine which country Steventon is in.&lt;br&gt;
Answer: England.&lt;/li&gt;
&lt;li&gt;Synthesize the final answer.&lt;br&gt;
Final answer: England.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This kind of question is simple for a person, but it illustrates why multi-hop reasoning matters: the answer is not found in a single fact. The system has to connect several pieces of information in the right order.&lt;/p&gt;
&lt;h2 id="how-the-agent-works"&gt;How the Agent Works&lt;/h2&gt;
&lt;p&gt;The agent coordinates several specialized components: a planner that decides how to approach the question, a retrieval step that gathers supporting information, a code execution step for calculations or data processing, and a synthesis step that produces the final answer.&lt;/p&gt;
&lt;p&gt;It supports both closed-book reasoning and retrieval-augmented answering using RAG and live web search. It also includes state tracking and stall recovery, allowing the agent to continue through longer reasoning chains without getting stuck.&lt;/p&gt;
&lt;h2 id="implementation"&gt;Implementation&lt;/h2&gt;
&lt;p&gt;I implemented the system in Python using LangGraph and LangChain, with structured outputs through Pydantic and asynchronous execution using asyncio. I also built a Streamlit interface that shows the agent’s intermediate steps, making it easier to inspect how the final answer was reached.&lt;/p&gt;
&lt;p&gt;Overall, this project was an experiment in making LLM-based question answering more reliable by combining decomposition, retrieval, tool use, and multi-agent orchestration.&lt;/p&gt;
&lt;p&gt;If you want to try it yourself, check out the demo
. And if you&amp;rsquo;d like to take a closer look at the implementation, you can find the code
.&lt;/p&gt;</description></item></channel></rss>