- Ali's Newsletter
- Posts
- Agentic Search: Rewriting the Architecture of AI Systems 🚀
Agentic Search: Rewriting the Architecture of AI Systems 🚀
For two years, Retrieval-Augmented Generation (RAG) has been the default pattern for building LLM applications. It worked—until it didn’t. RAG retrieves, but it does not think. Agentic search changes that.
From Pipeline to Loop 🧠
🔹 Traditional RAG Architecture
Traditional RAG systems operate as a one-pass pipeline, lacking iteration and correction mechanisms. A user query triggers a vector search, retrieving top-K chunks of information, which are then fed directly into a Large Language Model (LLM) to generate a response.

➡️ One-pass system. No iteration. No correction.
🔹 Agentic Search Architecture
In contrast, agentic search introduces a multi-step, iterative, and goal-driven approach. A user goal is processed by a planner, which then interacts with various components like search, tools, and files. The output from these interactions is then synthesized, allowing for continuous refinement until the goal is achieved.

➡️ Multi-step. Iterative. Goal-driven.
The Core Loop 🔁
The fundamental principle behind agentic systems is an iterative loop, often described as the engine of intelligence:
Python
while not solved: plan() act() # search / tool / code observe() evaluate() refine()
This loop enables dynamic problem-solving and continuous improvement, moving beyond the static retrieval of RAG.
Multi-Document Reasoning 📂
Traditional RAG often suffers from the "Flattening Problem," where the structural integrity of documents (e.g., PDFs, slides, code) is lost when converted into chunks for retrieval. This destruction of structure limits the LLM's ability to reason effectively across documents.
Agentic systems, however, employ an "Agentic Navigation Model" that can decompose queries and navigate various indices (PDF, Codebase, Database) while preserving context and structure. This allows for more sophisticated multi-document reasoning.

➡️ Structure is preserved. Context is maintained.
System Design Approaches 🧩📦
Agentic systems can be implemented using various frameworks, such as LangGraph and LlamaIndex, each offering distinct architectural patterns for orchestrating agents and tools.
LangGraph Style:
Plain Text
[User Input] ↓ [Planner Node] ↓ [Router Node] ├── Retriever Node ├── Tool Node ├── Code Executor ↓ [Evaluator Node] ↓ [Loop Controller] ↓ [Final Synthesizer]
LlamaIndex Style:
Plain Text
QueryEngine ↓ RouterRetriever ├── VectorIndex ├── KeywordIndex ├── GraphIndex ↓ ResponseSynthesizer ↓ LLM
Codebase Search (Real Agent Behavior) 💻
Agentic systems can perform complex codebase searches by iteratively using tools like grep to read files, follow imports, and refine searches. This approach relies on pure navigation rather than embeddings, enabling a deeper understanding of code structure and dependencies.
➡️ No embeddings. Pure navigation.
Tradeoffs ⚖️
While agentic systems offer significant advantages, it's important to consider the tradeoffs compared to traditional RAG:
Dimension | RAG | Agentic |
Speed | ⚡ Fast | 🐢 Slower |
Cost | 💲 Lower | 💲💲 Higher |
Accuracy | Medium | High |
Complexity | Low | High |
Final Thought ✨
RAG retrieves. Agentic systems decide. And that difference is everything. The shift from retrieval-based to decision-making AI architectures marks a significant evolution in how we build and interact with intelligent systems.