Agentic AI

Agentic RAG Architecture

Multi-hop query decomposition, dynamic query reformulation, and autonomous citation critique for high-complexity enterprise research.

By Bhavin Mistry, Senior Engineering Manager at Commonwealth Bank Published: 2026-08-05 Last updated: 2026-09-18 10 min read
Table of Contents (9 sections)
SYSTEM TOPOLOGY & DATA FLOW ENTERPRISE SPECIFICATION
Client Application RBAC Context Security & Gateway PII Sanitization Semantic Cache Check Rate & Token Budget Inference & Rerank BM25 + Vector Fusion Cross-Encoder Top-5 Grounded Synthesis Telemetry OpenTelemetry

The Core Problem Solved

Traditional one-shot RAG fails when a user question requires aggregating information across disparate systems, comparing temporal periods, or reconciling conflicting data.

When To Deploy This Architecture

Complex enterprise analytical research, multi-document financial audit reconciliation, and cross-system policy verification.

Architectural Components

  • Plan-and-Solve Query Decomposer
  • Tool Registry (Vector DB, SQL Database, REST APIs, Web)
  • Reflection & Self-Correction Evaluator
  • State Management & Memory Store
  • Deterministic Guardrails & Timeout Fence

Data Flow Narrative

Ambiguous query -> Query Decomposition into sub-goals -> Selective Tool Calling -> Reflection check (Is evidence sufficient?) -> Optional recursive refinement -> Final synthesis.

Security & Perimeter Control

Strict sandboxing of all tool execution environments; read-only credentials on data connectors; explicit approval steps before any state-mutating action.

Governance & Telemetry

Graph-based trace recording (LangSmith / OpenTelemetry) capturing each agent reasoning step and decision branch.

Identified Failure Modes & Mitigations

Recursive loop death spirals; tool schema drift; semantic divergence where agent answers a different question than asked.

Production Code Implementation

Copy-paste ready implementation snippet demonstrating the core architectural boundary logic:

agentic_rag_workflow.py
# Bounded Agentic RAG State Graph with Deterministic Fences
from typing import TypedDict
from langgraph.graph import StateGraph, END

class AgentState(TypedDict):
    query: str
    sub_queries: list[str]
    retrieved_chunks: list[dict]
    iteration: int
    final_answer: str

def plan_node(state: AgentState):
    return {"sub_queries": decompose_query(state["query"]), "iteration": state["iteration"] + 1}

def retrieve_node(state: AgentState):
    chunks = []
    for sq in state["sub_queries"]:
        chunks.extend(hybrid_retrieve(sq, top_k=3))
    return {"retrieved_chunks": deduplicate_and_trim_rbac(chunks)}

def evaluate_gate(state: AgentState):
    if state["iteration"] >= 3:
        return "synthesize"  # Deterministic loop fence
    return "synthesize" if evaluate_groundedness(state) > 0.85 else "refine"

workflow = StateGraph(AgentState)
workflow.add_node("plan", plan_node)
workflow.add_node("retrieve", retrieve_node)
workflow.add_conditional_edges("retrieve", evaluate_gate, {"refine": "plan", "synthesize": "synthesize"})
Architectural Q&A

Frequently Asked Questions

When should an enterprise use Agentic RAG instead of one-shot RAG?
Use Agentic RAG when queries require multi-hop research across disparate data stores, dynamic query reformulation, cross-system reconciliation, or self-critique of generated citations. For simple factual lookup, one-shot RAG is 5x faster and 10x cheaper.
How do you avoid infinite reasoning loops in multi-hop agent workflows?
By enforcing deterministic cycle limits (max 3-4 iterations), timeout fences, state checkpointing with StateGraph, and automated fallbacks to one-shot hybrid search if groundedness evaluation does not converge.
Engineering Resource

The Enterprise AI Production Checklist

A rigorous 50-point engineering, security, and FinOps verification gate before promoting Generative AI and Agentic systems to live enterprise traffic.

Zero spam. Fortnightly dispatches. Unsubscribe anytime.
Author & Engineering Leader

Bhavin Mistry

Senior Engineering Manager at Commonwealth Bank based in Melbourne, Australia. Focusing on enterprise AI architecture, hybrid RAG, agentic reliability, and technology economics.

Connected Tools & Frameworks

Cross-Referenced Production Resources

Methodology

5-Stage Maturity Framework

Stage gates from exploration to hardened multi-region deployment.

Assessment

AI Readiness Diagnostic

Benchmark organizational readiness across 12 operational dimensions.

FinOps

RAG Cost Calculator

Model vector storage, query volume, and caching ROI accurately.