Agentic RAG: Chunking

Classic RAG retrieves once and hopes for the best. Agentic RAG lets the model plan, choose tools, check its own evidence, and try again. This post walks through why that matters and how to design it for production.

The problem: one-shot retrieval breaks on real questions

A standard RAG pipeline embeds the question, pulls the top-k chunks, and generates an answer. That works for simple lookups. It fails when the question is messy or the answer lives in more than one place.

  • Multi-hop questions. Which contracts renewed after the pricing change, and what changed? needs several retrievals, each depending on the last.
  • Ambiguous or underspecified queries. A single embedding of a vague question retrieves vague context.
  • Mixed sources. The answer may sit in a vector store, a SQL table, and a live API. Top-k over one index cannot reach all three.
  • No self-check. If retrieval returns weak or irrelevant chunks, the model still answers, confidently and wrongly.

Core idea: treat retrieval as a decision loop rather than a pipeline step. The system plans, retrieves, grades what it found, and either answers or tries again.

System design: the pipeline, step by step

The first two stages are the same as classic RAG and run offline. The rest is where the agent lives.

01. Chunking: Split documents into small, searchable pieces before indexing. Respect headings and tables, and add overlap so ideas are not cut in half.

Long document --> Split with overlap --> Small chunks

02. Embedding & Indexing: Turn each chunk into a vector and store it with metadata (source, date, ACL). Also keep a keyword index so exact terms like IDs and error codes still match.

Chunks --> Embedding model --> Vector + keyword index

03. Query Planning: The agent reads the question and decides what to do: answer directly, rewrite it, break it into sub-questions, or pick a source.

User question --> Planner / router --> Sub-queries

04. Tool-Based Retrieval: Each sub-query goes to the best tool: hybrid vector search, a SQL query, a web or internal API. Merge results, then rerank to keep the best few.

Vector search, SQL, APIs --> Rerank

05. Grade & Reflect: The agent judges whether the evidence is relevant and sufficient. If not, it rewrites the query or switches tools and loops, within a step budget.

Evidence --> Enough --> No: rewrite and retry

06. Grounded Generation: Write the answer only from the retrieved evidence, with citations. If the evidence is thin, say so instead of guessing.

Top evidence –> LLM –> Cited answer


Classic RAG vs. Agentic RAG

DimensionClassic RAGAgentic RAG
RetrievalSingle pass, top-kIterative, planned, multi-tool
Query handlingEmbedded as writtenRewritten, decomposed, routed
Quality controlNoneEvidence grading and retry
Latency and costLow, predictableHigher, variable (cap it)
Best forFAQs, simple lookupResearch, analytics, multi-source questions

Key takeaways

  • Retrieval is a decision, not a step. Let the model plan and choose sources instead of always searching the same index.
  • Grade before you generate. A relevance check on retrieved evidence is the cheapest way to cut hallucinations.
  • Foundations still decide quality. Good chunking, hybrid search, and reranking matter more than any agent loop on top of them.
  • Autonomy needs guardrails. Budgets, permissions, and tracing keep latency, cost, and risk under control.
  • Use it where it pays off. Start with classic RAG, and add the agent loop for questions that need multiple hops or sources.

Classic RAG retrieves once and hopes for the best. Agentic RAG lets the model plan, choose tools, check its own evidence, and try again. This post walks through why that matters and how to design it for production. The problem: one-shot retrieval breaks on real questions A standard RAG pipeline embeds the question, pulls the…

Leave a Reply

Your email address will not be published. Required fields are marked *