[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"article-how-to-build-agentic-rag-with-langgraph-en":3,"article-related-how-to-build-agentic-rag-with-langgraph-en":30,"series-ai-agent-f2612ba2-997c-4d94-b83b-f0a52f1adb32":85},{"id":4,"slug":5,"title":6,"content":7,"summary":8,"source":9,"source_url":10,"author":11,"image_url":12,"cover_image":12,"category":13,"language":14,"translated_content":11,"related_article_id":15,"keywords":16,"key_takeaways":23,"views":27,"created_at":28,"published_at":29,"topic_cluster_id":11},"f2612ba2-997c-4d94-b83b-f0a52f1adb32","how-to-build-agentic-rag-with-langgraph-en","How to Build Agentic RAG with LangGraph","\u003Cp data-speakable=\"summary\">Build an agentic \u003Ca href=\"\u002Ftag\u002Frag\">RAG\u003C\u002Fa> workflow that routes, retrieves, validates, and answers queries.\u003C\u002Fp>\u003Cp>This guide is for developers who want to move beyond basic \u003Ca href=\"\u002Fnews\u002Fretrieval-augmented-generation-explained-en\">retrieval augmented generation\u003C\u002Fa> and build a system that can refine a query, choose the right source, validate the answer, and handle multimodal inputs. After following the steps, you will have a working agentic RAG prototype with routing, tool use, and answer checks.\u003C\u002Fp>\u003Cp>We will use \u003Ca href=\"https:\u002F\u002Fwww.langchain.com\u002F\" target=\"_blank\" rel=\"noopener noreferrer\">LangChain docs\u003C\u002Fa> and the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain\" target=\"_blank\" rel=\"noopener noreferrer\">LangChain GitHub repo\u003C\u002Fa>, plus \u003Ca href=\"https:\u002F\u002Fwww.llamaindex.ai\u002F\" target=\"_blank\" rel=\"noopener noreferrer\">LlamaIndex docs\u003C\u002Fa> and the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Frun-llama\u002Fllama_index\" target=\"_blank\" rel=\"noopener noreferrer\">LlamaIndex GitHub repo\u003C\u002Fa>, and optionally \u003Ca href=\"https:\u002F\u002Flangchain-ai.github.io\u002Flanggraph\u002F\" target=\"_blank\" rel=\"noopener noreferrer\">LangGraph docs\u003C\u002Fa> and the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flanggraph\" target=\"_blank\" rel=\"noopener noreferrer\">LangGraph GitHub repo\u003C\u002Fa> for orchestration.\u003C\u002Fp>\u003Ch2>Before you start\u003C\u002Fh2>\u003Cul>\u003Cli>Node 20+ or Python 3.11+ installed\u003C\u002Fli>\u003Cli>An OpenAI API key or another LLM provider key\u003C\u002Fli>\u003Cli>A vector database account or local vector store, such as Chroma or FAISS\u003C\u002Fli>\u003Cli>Access to at least one data source: documents, API, or web search\u003C\u002Fli>\u003Cli>Git installed for cloning starter code\u003C\u002Fli>\u003Cli>Basic familiarity with embeddings, retrieval, and prompt templates\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>Step 1: Set up the agentic RAG project\u003C\u002Fh2>\u003Cp>Your first outcome is a local project skeleton that can run an \u003Ca href=\"\u002Ftag\u002Fllm\">LLM\u003C\u002Fa>, call tools, and store retrieved context.\u003C\u002Fp>\n\u003Cfigure class=\"my-6\">\u003Cimg src=\"https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1778120449011-mfth.png\" alt=\"How to Build Agentic RAG with LangGraph\" class=\"rounded-xl w-full\" loading=\"lazy\" \u002F>\u003C\u002Ffigure>\n\u003Cp>Create a new app, install the core dependencies, and add environment variables for your model key and retrieval backend.\u003C\u002Fp>\u003Cpre>\u003Ccode>mkdir agentic-rag-demo && cd agentic-rag-demo\nnpm init -y\nnpm install langchain @langchain\u002Fopenai @langchain\u002Fcommunity dotenv\n# or use Python if you prefer\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Verify the setup by running a minimal script that loads your key and prints a test response. You should see a successful model call, not an authentication error.\u003C\u002Fp>\u003Ch2>Step 2: Index source documents\u003C\u002Fh2>\u003Cp>Your second outcome is a searchable knowledge base that the \u003Ca href=\"\u002Ftag\u002Fagent\">agent\u003C\u002Fa> can query instead of guessing from the prompt alone.\u003C\u002Fp>\n\u003Cfigure class=\"my-6\">\u003Cimg src=\"https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1778120450204-jzba.png\" alt=\"How to Build Agentic RAG with LangGraph\" class=\"rounded-xl w-full\" loading=\"lazy\" \u002F>\u003C\u002Ffigure>\n\u003Cp>Load your documents, split them into chunks, generate embeddings, and store them in a vector index. If you are using LlamaIndex, this is where you connect files, PDFs, or web pages to the retrieval layer.\u003C\u002Fp>\u003Cpre>\u003Ccode>\u002F\u002F Pseudocode\nloadDocuments();\nsplitIntoChunks();\nembedChunks();\nstoreInVectorDB();\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Verify the index by running a similarity search for a known phrase. You should see the most relevant chunk returned with a matching source reference.\u003C\u002Fp>\u003Ch2>Step 3: Add query routing logic\u003C\u002Fh2>\u003Cp>Your third outcome is an agent that decides where each query should go before retrieval starts.\u003C\u002Fp>\u003Cp>Build a routing step that classifies the request as document lookup, web lookup, \u003Ca href=\"\u002Ftag\u002Fapi\">API\u003C\u002Fa> lookup, or direct answer. This mirrors single-agent RAG routing and gives you a clean entry point for more advanced multi-agent flows later.\u003C\u002Fp>\u003Cpre>\u003Ccode>if (needsRealtimeData(query)) routeTo(\"api-tool\");\nelse if (isInDocs(query)) routeTo(\"vector-search\");\nelse routeTo(\"web-search\");\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Verify the router by testing three query types. You should see different routes chosen for a policy question, a product question, and a real-time request.\u003C\u002Fp>\u003Ch2>Step 4: Orchestrate tool use and retrieval\u003C\u002Fh2>\u003Cp>Your fourth outcome is a multi-step workflow that can refine a query, retrieve context, and call tools when the first answer is not enough.\u003C\u002Fp>\u003Cp>Use an agent loop or LangGraph state machine to support query refinement, source selection, retrieval, and follow-up tool calls. This is the core agentic behavior: the system can plan, act, inspect the result, and try again if needed.\u003C\u002Fp>\u003Cpre>\u003Ccode>state = {\n  query,\n  refinedQuery,\n  source,\n  context,\n  draftAnswer,\n  validationResult\n}\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Verify the orchestration by asking a complex question that requires two hops, such as a document lookup plus a live API check. You should see the agent chain multiple steps instead of returning the first retrieved snippet.\u003C\u002Fp>\u003Ch2>Step 5: Validate the final answer\u003C\u002Fh2>\u003Cp>Your fifth outcome is a response checker that rejects weak or unsupported answers before they reach the user.\u003C\u002Fp>\u003Cp>Add a validation pass that compares the draft answer against the original query and retrieved context. If the answer is missing evidence, the agent should fetch more context, rewrite the response, or return a safe fallback.\u003C\u002Fp>\u003Cpre>\u003Ccode>if (!isSupported(draftAnswer, context)) {\n  draftAnswer = refineAndRetry(query, context);\n}\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Verify validation by testing an ambiguous prompt and a grounded prompt. You should see the system ask for more information or produce a cited answer only when the evidence is sufficient.\u003C\u002Fp>\u003Ch2>Step 6: Expand to multimodal inputs\u003C\u002Fh2>\u003Cp>Your sixth outcome is an agentic RAG pipeline that can handle text, images, and real-time inputs in one workflow.\u003C\u002Fp>\u003Cp>Add specialized tools for OCR, image captioning, or live data fetches, then route each input type to the right agent. This is where agentic RAG becomes more flexible than traditional RAG because it can adapt its retrieval strategy to the source type.\u003C\u002Fp>\u003Cpre>\u003Ccode>\u002F\u002F Example tool set\ntextRetriever();\nimageCaptionTool();\nrealtimeApiTool();\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Verify the extension by submitting one text query, one image-based query, and one time-sensitive query. You should see each input type produce a different retrieval path and a context-aware final answer.\u003C\u002Fp>\u003Ctable>\u003Cthead>\u003Ctr>\u003Cth>Metric\u003C\u002Fth>\u003Cth>Before\u002FBaseline\u003C\u002Fth>\u003Cth>After\u002FResult\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Decision-making\u003C\u002Ftd>\u003Ctd>Reactive, fixed workflow\u003C\u002Ftd>\u003Ctd>Adaptive routing and tool selection\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Data retrieval\u003C\u002Ftd>\u003Ctd>Single predefined source\u003C\u002Ftd>\u003Ctd>Multiple sources, including APIs and web\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Workflow\u003C\u002Ftd>\u003Ctd>One-pass retrieval and generation\u003C\u002Ftd>\u003Ctd>Multi-step refine, retrieve, validate loop\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Input support\u003C\u002Ftd>\u003Ctd>Text only\u003C\u002Ftd>\u003Ctd>Text, images, and real-time inputs\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch2>Common mistakes\u003C\u002Fh2>\u003Cul>\u003Cli>Routing everything to the vector store. Fix: add a source classifier so real-time or API-backed questions do not use stale documents.\u003C\u002Fli>\u003Cli>Skipping validation. Fix: compare the final answer with retrieved evidence and retry when support is weak.\u003C\u002Fli>\u003Cli>Adding too many agents too early. Fix: start with one router and one retriever, then split into specialized agents only after the workflow is stable.\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>What's next\u003C\u002Fh2>\u003Cp>Once the basic pipeline works, deepen it with memory, parallel sub-\u003Ca href=\"\u002Ftag\u002Fagents\">agents\u003C\u002Fa>, and evaluation sets so you can compare routing accuracy, answer quality, and latency across different agent designs.\u003C\u002Fp>","Build an agentic RAG workflow that routes, retrieves, validates, and answers queries.","www.geeksforgeeks.org","https:\u002F\u002Fwww.geeksforgeeks.org\u002Fartificial-intelligence\u002Fwhat-is-agentic-rag\u002F",null,"https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1778120449011-mfth.png","ai-agent","en","a8e2e21f-b0d2-4f4f-89bb-1936d5fe8fd5",[17,18,19,20,21,22],"Agentic RAG","LangChain","LlamaIndex","LangGraph","retrieval augmented generation","AI agents",[24,25,26],"Agentic RAG adds autonomous routing, tool use, and validation to standard RAG.","A practical build starts with indexing, then routing, then orchestration, then validation.","Multimodal support and real-time tools make the workflow more flexible than fixed retrieval pipelines.",4,"2026-05-07T02:20:30.085666+00:00","2026-05-07T02:20:30.066+00:00",{"tags":31,"relatedLang":44,"relatedPosts":48},[32,35,37,39,41],{"name":33,"slug":34},"retrieval-augmented generation","retrieval-augmented-generation",{"name":20,"slug":36},"langgraph",{"name":18,"slug":38},"langchain",{"name":19,"slug":40},"llamaindex",{"name":42,"slug":43},"agentic RAG","agentic-rag",{"id":15,"slug":45,"title":46,"language":47},"how-to-build-agentic-rag-with-langgraph-zh","如何用 LangGraph 打造 Agentic RAG","zh",[49,55,61,67,73,79],{"id":50,"slug":51,"title":52,"cover_image":53,"image_url":53,"created_at":54,"category":13},"5efa67dd-b9f7-4a2f-8c68-3a4bc6a6b7d9","claude-code-dynamic-workflow-ai-harness-en","Claude Code 动态工作流：AI 自写 Harness","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1781035372495-9czj.png","2026-06-09T20:02:22.33375+00:00",{"id":56,"slug":57,"title":58,"cover_image":59,"image_url":59,"created_at":60,"category":13},"2bd28e0e-0f4b-4987-a961-28763c1e1926","agent-orchestration-enterprise-ai-layer-en","Agent orchestration is the missing layer for enterprise AI","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780984981174-08mj.png","2026-06-09T06:02:31.384174+00:00",{"id":62,"slug":63,"title":64,"cover_image":65,"image_url":65,"created_at":66,"category":13},"95684312-23dc-4a78-a917-df14d132c5fa","ai-agents-use-blockchain-trust-layer-en","AI agents use blockchain as a trust layer","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780980506080-ki4s.png","2026-06-09T04:48:01.710214+00:00",{"id":68,"slug":69,"title":70,"cover_image":71,"image_url":71,"created_at":72,"category":13},"0208e47f-7d4c-4473-a0f9-4cd193b5c139","8-rag-patterns-demos-into-prod-en","8 RAG patterns that turn demos into prod","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780971552707-qpl7.png","2026-06-09T02:18:36.760049+00:00",{"id":74,"slug":75,"title":76,"cover_image":77,"image_url":77,"created_at":78,"category":13},"b413d484-6786-4c32-abdc-77f010ac7eba","fine-tuning-beats-rag-style-not-facts-en","Fine-tuning beats RAG when the goal is style, not facts","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780924681800-5xji.png","2026-06-08T13:17:25.701649+00:00",{"id":80,"slug":81,"title":82,"cover_image":83,"image_url":83,"created_at":84,"category":13},"57beb8b4-c233-400f-b95b-a97be1cf9d02","openclaw-small-business-ai-staff-en","OpenClaw shows how small businesses use AI staff","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780904882032-yp13.png","2026-06-08T07:47:27.730921+00:00",[86,91,96,101,106,111,116,121,126,131],{"id":87,"slug":88,"title":89,"created_at":90},"03db8de8-8dc2-4ac1-9cf7-898782efbb1f","anthropic-claude-ai-agent-task-automation-en","Anthropic's Claude AI Agent: A New Era of Task Automation","2026-03-25T16:25:06.513026+00:00",{"id":92,"slug":93,"title":94,"created_at":95},"045d1abc-190d-4594-8c95-91e2a26f0c5a","googles-2026-ai-agent-report-decoded-en","Google’s 2026 AI Agent Report, Decoded","2026-03-26T11:15:23.046616+00:00",{"id":97,"slug":98,"title":99,"created_at":100},"e64aba21-254b-4f93-aa21-837484bb52ec","kimi-k25-review-stronger-still-not-legend-en","Kimi K2.5 review: stronger, still not a legend","2026-03-27T07:15:55.385951+00:00",{"id":102,"slug":103,"title":104,"created_at":105},"30dfb781-a1b2-4add-aebe-b3df40247c37","claude-code-controls-mac-desktop-en","Claude Code now controls your Mac desktop","2026-03-28T03:01:59.384091+00:00",{"id":107,"slug":108,"title":109,"created_at":110},"254405b6-7833-4800-8e13-f5196deefbe6","cloudflare-100x-faster-ai-agent-sandbox-en","Cloudflare’s 100x Faster AI Agent Sandbox","2026-03-28T03:09:44.356437+00:00",{"id":112,"slug":113,"title":114,"created_at":115},"04f29b7f-9b91-4306-89a7-97d725e6e1ba","openai-backs-isara-agent-swarm-bet-en","OpenAI backs Isara’s agent-swarm bet","2026-03-28T03:15:27.849766+00:00",{"id":117,"slug":118,"title":119,"created_at":120},"3b0bf479-e4ae-4703-9666-721a7e0cdb91","openai-plan-automated-ai-researcher-en","OpenAI’s plan for an automated AI researcher","2026-03-28T03:17:42.312819+00:00",{"id":122,"slug":123,"title":124,"created_at":125},"fe91bce0-b85d-4efa-a207-24ae9939c29f","harness-engineering-ai-agent-reliability-2026","Harness Engineering: From Bridle to Operating System, The Missing Link in AI Agent Reliability","2026-03-31T06:36:55.648751+00:00",{"id":127,"slug":128,"title":129,"created_at":130},"7a09007d-820f-43b3-8607-8ad1bfcb94c8","mcp-explained-from-prompts-to-production-en","MCP Explained: From Prompts to Production","2026-04-01T09:24:40.089177+00:00",{"id":132,"slug":133,"title":134,"created_at":135},"116d5ee9-a4f1-4b5a-aac5-5d035dd22bbe","amazon-bedrock-agents-multi-agent-workflows-en","Amazon Bedrock Agents Gets Multi-Agent Workflows","2026-04-01T09:30:30.197685+00:00"]