Dokki Blog logo

What Is Agentic RAG? Architecture and Failure Modes

Agentic RAG is a retrieval-augmented generation architecture in which an agent actively controls retrieval instead of following one fixed search-and-answer pipeline. The agent can decide whether retrieval is needed, decompose a complex request into focused subqueries, choose knowledge sources or tools, inspect intermediate evidence, reformulate weak searches, resolve conflicts, and stop when it has enough support for a grounded result.

Standard RAG remains the right baseline for many applications. A conventional pipeline accepts a query, retrieves a configured number of passages, assembles context, and asks a model to answer. It is fast, testable, and economical when questions map cleanly to one corpus. Agentic RAG adds value when the information need is multi-part, source-dependent, iterative, or impossible to express as one search.

Microsoft describes agentic retrieval in Azure AI Search as a multi-query pipeline that uses a model to break complex questions into focused subqueries, runs them in parallel, semantically reranks the results, and returns merged grounding data, references, and an activity log. Its broader architecture guidance distinguishes this from fixed RAG: retrieval becomes a tool the agent can invoke, evaluate, and repeat. AWS similarly connects agents to managed knowledge bases while emphasizing lineage, permissions, and governance from source documents through retrieval and response.

The important word is not “agentic.” It is controlled. More retrieval decisions create more opportunities to improve coverage—and more latency, cost, permission, citation, and failure paths that must be observed and tested.

Standard RAG compared with agentic RAG, showing a fixed query-retrieve-generate pipeline versus dynamic planning, multi-source retrieval, assessment, and bounded refinement

The short answer

Use agentic RAG when a material question needs one or more of these behaviors:

  • decide whether to retrieve at all;

  • clarify an ambiguous request before searching;

  • split a multi-part question into separate information needs;

  • select among repositories, databases, APIs, web sources, or graph tools;

  • run independent searches in parallel;

  • inspect whether evidence is authoritative, current, and complete;

  • follow entity, dependency, time, or provenance relationships;

  • retrieve a primary source after discovering it through a secondary source;

  • retry with a different query or retrieval method;

  • preserve contradictions rather than flattening them;

  • stop, abstain, or ask a human when support is insufficient.

Keep standard RAG when one well-designed hybrid query over one permission-aware corpus reliably returns enough evidence. Do not add an agent merely to wrap the same vector search call in a reasoning loop.

A production agentic RAG system needs explicit limits: allowed sources, user identity, retrieval budget, maximum steps, wall-clock deadline, citation requirements, evidence threshold, failure categories, and a final validation gate. The agent may plan retrieval; it must not invent authority.

Standard RAG vs agentic RAG

Dimension

Standard RAG

Agentic RAG

Retrieval decision

fixed by application

agent can retrieve, skip, or clarify

Query plan

usually one query or fixed expansion

dynamic decomposition and reformulation

Sources

predefined pipeline

selected tools and sources within policy

Iteration

fixed number of passes

evidence-driven, bounded loop

Parallelism

application-defined

plan can fan out independent subqueries

Validation

often relevance score plus generation

agent or verifier checks coverage and conflict

Latency and cost

relatively predictable

variable and potentially much higher

Observability

query, hits, answer

plan, subqueries, sources, merges, retries, answer

Best fit

focused Q&A over stable corpus

complex investigation across heterogeneous sources

Agentic RAG is not automatically more accurate. A poor planner can generate irrelevant subqueries, choose the wrong source, stop too early, or loop over the same weak evidence. The architecture is useful only when dynamic decisions outperform a strong deterministic baseline on a representative evaluation set.

Reference architecture

1. Intake and identity

Normalize the user request, current conversation context, intended task, audience, time range, and output contract. Resolve the user and agent identities before discovering sources. Attach permission scope, jurisdiction, sensitivity, and purpose constraints to the retrieval mission.

Do not let the model infer access from the question. Authorization must come from the identity and policy layer.

2. Query planner

The planner turns the request into a retrieval plan. It may identify entities, dates, constraints, subquestions, required source types, and dependencies between searches.

For example, “Which enterprise customers are at risk because the July authentication change conflicts with contractual commitments?” may require:

  1. find the authoritative July authentication decision and implementation scope;

  2. identify affected products or services;

  3. retrieve active customer commitments for those products;

  4. retrieve support incidents and exceptions;

  5. compare dates, regions, and contract language;

  6. produce a source-linked risk table.

The plan should be structured and versioned. Record each subquery’s purpose, source candidates, dependency, priority, and completion test.

3. Source and tool registry

Expose a bounded catalog of retrieval capabilities. Each entry should declare:

  • source name and owner;

  • content types and business authority;

  • supported query and filter schema;

  • identity and permission behavior;

  • freshness and deletion guarantees;

  • latency, rate limit, and cost;

  • citation and provenance fields;

  • common failure modes.

Descriptions determine routing quality. “Search company data” is too vague. “Search current approved security policies by control, product, region, and effective date; preserves source ACLs and returns page-level citations” gives the planner a usable contract.

4. Retrieval workers

Workers execute lexical, vector, hybrid, structured, graph, SQL, API, or remote searches. They should not receive broader authority than their subtask requires.

Run independent queries in parallel when they use compatible snapshots and do not compete for scarce downstream resources. Apply per-source timeouts and return typed failures so the orchestrator can distinguish no evidence from an unavailable source.

5. Reranking and evidence normalization

Normalize results into a shared evidence record containing source ID, canonical URL, title, passage or record, version, timestamp, author or owner, permission decision, retrieval method, relevance signals, and provenance.

Reranking should consider more than semantic similarity. Authority, freshness, applicability, specificity, source type, and access context can matter more than wording. A current signed contract should outrank a similar sales note for a contractual claim.

6. Evidence assessment

The orchestrator or a separate verifier evaluates:

  • coverage of every subquestion;

  • support for material claims;

  • source authority and validity;

  • contradictions and version conflicts;

  • missing entities, dates, or required fields;

  • permission and citation integrity;

  • whether more retrieval is likely to change the answer.

This step decides whether to answer, retrieve again, ask for clarification, escalate, or abstain. Use explicit thresholds and rules rather than “the model feels confident.”

7. Grounded synthesis

Generate from the evidence package, not from an opaque mixture of search results. Require citations at the claim or paragraph level for material facts. Preserve uncertainty and conflicting sources.

The synthesizer should distinguish what the sources state, what the system calculated, and what it inferred. Recommendations should identify assumptions and the human or policy authority required for action.

8. Trace and evaluation

Store the retrieval plan, subqueries, tool selections, result IDs, reranking, discarded evidence, conflicts, retries, final citations, latency, and cost. Feed failures into a regression set.

Retrieval strategies an agent can combine

Lexical retrieval

Keyword and phrase search remains essential for identifiers, error messages, policy clauses, names, and exact terminology. An agent should not replace exact search with embeddings when the request contains a stable ID.

Vector retrieval

Semantic similarity helps discover conceptually related passages and paraphrases. It is vulnerable to near-duplicate clutter, generic matches, and topically similar but non-authoritative content.

Hybrid retrieval

Combining lexical and vector candidates, then reranking them, is a strong default. The agent can choose filters and query variants while the retrieval engine handles candidate fusion.

Structured retrieval

Use SQL, APIs, or typed filters for dates, amounts, statuses, permissions, ownership, and other fields that should not be approximated through text similarity. Retrieve the underlying source record for citation.

Graph retrieval

Graph traversal helps with ownership, dependencies, entity aliases, impact paths, and provenance. Bound traversal depth, relationship types, time range, and policy scope. A graph path is context, not proof; cite the source assertions behind its edges.

Whole-object retrieval

After search identifies a decisive contract, policy, code file, or report, the agent may need to read a larger section or entire object. Track this separately because it can add substantial tokens and expose more sensitive content.

External or live retrieval

Web and remote APIs can supply current public facts, inventories, telemetry, or market data. Record retrieval time and source. Treat untrusted content as data, not instructions, to reduce prompt-injection risk.

Bounded agentic RAG evidence loop from planning through retrieval, normalization, assessment, refinement, and cited answer with explicit stop conditions

The evidence loop

A useful bounded loop is:

plan → retrieve → normalize → assess → refine or answer

At each cycle, record a progress signal. Examples include newly covered subquestions, higher-authority evidence, resolved contradiction, or reduced uncertainty. Stop if the loop repeats the same sources, fails to improve coverage, exceeds budget, or reaches the maximum iteration count.

Query refinement should address a diagnosed gap:

  • add an exact identifier;

  • narrow or widen a date range;

  • choose a more authoritative source;

  • switch lexical, vector, graph, or structured method;

  • search an alias or source-native ID;

  • retrieve the primary document referenced by a summary;

  • ask the user to resolve an ambiguous entity.

Blind paraphrasing can create more queries without adding information.

Permission-aware agentic retrieval

Agentic RAG increases the security surface because planning can touch multiple sources and intermediate evidence can influence later searches.

Apply authorization to:

  • source discovery and descriptions;

  • query planning and filters;

  • candidate generation;

  • document, record, passage, field, and graph-edge access;

  • reranking features and aggregates;

  • cached evidence and session state;

  • generated claims and citations;

  • exports, traces, and downstream actions.

Preserve the requester’s identity across every tool call. If a source uses a service account for technical access, apply an authoritative user policy before returning or using results. Do not let inaccessible content influence query expansion or answer structure.

Test indirect leakage. An unauthorized project name might appear in autocomplete, a result count, a graph neighbor, an error, or an explanation of why another source was searched. Fail closed when identity mapping or source permissions are unknown.

Long-running investigations need reauthorization after waits or resumptions. A user’s team, group membership, source sharing, or employment status may have changed.

Provenance and citation integrity

Every evidence item should retain:

  • source system and object ID;

  • canonical URL or retrievable reference;

  • version and observed time;

  • passage, field, query result, or graph assertion used;

  • author, owner, or source authority;

  • retrieval query and method;

  • transformation or summary lineage;

  • access decision;

  • relationship to each supported claim.

Citation correctness has three tests:

  1. Entailment: does the source actually support the claim?

  2. Authority: is the source appropriate for that claim?

  3. Applicability: is it current and relevant to the entity, region, product, or time in question?

A citation can be openable yet still fail all three.

Do not cite the retrieval agent’s summary as if it were the primary evidence. Link claims to original records or documents. If a calculation combines sources, cite the inputs and expose the calculation.

Agentic RAG failure control room detecting query drift, source roulette, evidence laundering, permission contamination, endless search, and prompt injection

Failure modes

Over-decomposition

The planner splits a simple query into many subqueries, increasing cost and introducing inconsistent interpretations. Route simple factual questions to the standard RAG path.

Query drift

Repeated reformulation moves away from the original information need. Preserve the mission and validate each subquery against it.

Source roulette

The agent chooses a convenient source rather than the authoritative one. Encode source authority and use-case boundaries in the registry and reranker.

Premature stopping

One relevant passage appears and the system answers before checking all constraints. Define coverage requirements for multi-part tasks.

Endless search

The system keeps retrieving because uncertainty never reaches zero. Use diminishing-progress checks, budgets, and acceptable abstention.

Evidence laundering

An unsupported statement from one generated summary becomes “evidence” for another agent. Preserve provenance and reject model-generated text as primary evidence unless explicitly labeled.

Contradiction collapse

The synthesizer chooses one source without exposing disagreement. Preserve conflicting versions, authority, and time, then request adjudication when necessary.

Permission contamination

Restricted evidence influences planning or generation even though the final citation is removed. Enforce policy before evidence enters the agent context.

Duplicate and stale content

Near-duplicates dominate retrieval, while an obsolete page outranks the current policy. Deduplicate by source identity and version; include freshness and supersession in ranking.

Tool-output prompt injection

Retrieved text attempts to redirect the agent or trigger actions. Treat source content as untrusted data, isolate instructions, restrict tools, and validate the plan after retrieval.

Unbounded cost and latency

Fan-out, reranking, whole-file reading, and iterative synthesis multiply consumption. Apply per-step and per-mission budgets and expose them in traces.

Evaluation framework

Evaluate the deterministic baseline and agentic architecture on the same cases.

Layer

Metrics

Planning

correct decomposition, necessary subquery rate, source-selection accuracy

Retrieval

recall at k, authoritative-source rate, freshness, permission violations

Evidence

coverage, contradiction detection, provenance completeness

Synthesis

claim support, citation entailment, applicability, abstention quality

Operations

latency, queries per mission, loop count, failures, repair time

Economics

retrieval, reranking, model, review, and total cost per accepted answer

Include single-hop questions that should not trigger agentic behavior. A system that makes every request expensive should lose points even if complex-query performance improves.

Create adversarial cases for ambiguous names, outdated policies, duplicate pages, restricted sources, contradictory records, missing evidence, malicious retrieved instructions, rate limits, partial source outages, and no-answer questions.

Review traces, not only answers. A correct final answer produced through unauthorized evidence or an unsafe tool path is a failed run.

A practical routing policy

Send a request to standard RAG when:

  • one domain and source set are sufficient;

  • the query has one clear information need;

  • one hybrid search normally retrieves authoritative evidence;

  • latency matters more than exhaustive coverage.

Send it to agentic RAG when:

  • the question has several dependent parts;

  • the right source cannot be known before inspecting results;

  • evidence must be compared across systems or time;

  • the task needs iterative investigation or relationship traversal;

  • the cost of missing evidence is materially higher than additional retrieval.

Ask for clarification before either path when the entity, time range, jurisdiction, or intended action is ambiguous.

A 90-day implementation plan

Days 1–30: establish the baseline

Build a strong permission-aware hybrid RAG pipeline. Preserve source identity, version, authority, citations, and deletion. Create a gold set of simple and complex questions with forbidden and no-answer cases.

Days 31–60: add controlled planning

Introduce structured decomposition and a limited source registry for the complex cases. Record plans, subqueries, results, costs, and evidence gaps. Keep generation behind a support validator.

Days 61–90: iterate and operate

Add bounded refinement, parallel retrieval, conflict handling, and selected structured or graph tools. Compare against the baseline. Ship only where accepted-answer quality improves enough to justify latency, cost, and operational burden.

Frequently asked questions

What is agentic RAG?

It is RAG in which an agent dynamically plans, selects, evaluates, and may repeat retrieval before generating a grounded result.

How is it different from standard RAG?

Standard RAG usually follows a fixed query-retrieve-generate pipeline. Agentic RAG can decide when and how to retrieve, decompose the request, use several tools, inspect evidence, and iterate.

Does agentic RAG require multiple agents?

No. One agent can orchestrate several retrieval tools. Multiple agents are useful only when they create clear specialization, isolation, ownership, or parallelism.

Is agentic RAG always more accurate?

No. It can improve complex-query coverage, but planning errors, source selection, query drift, and premature stopping can make it worse. Compare it with a deterministic baseline.

How do you stop an agentic retrieval loop?

Use maximum steps, time and cost budgets, coverage thresholds, progress checks, and explicit abstention or escalation conditions.

What is the biggest production risk?

Allowing unauthorized, stale, or unsupported evidence to influence planning and synthesis without an inspectable trace. Permission and provenance controls must apply throughout the loop.

Official and primary sources

Where Dokki fits

Dokki can serve as the governed workspace around an agentic RAG system: source material, retrieval evidence, task state, human decisions, and approved outputs remain reviewable in one place. Begin with a bounded research or operations mission, make every retrieval step cite its evidence, and require confirmation before high-impact actions.

Sources

_Last verified: July 21, 2026._