Module 8 of 16

AI Agents & Agentic RAG

Tool calling, memory systems, multi-agent architectures, and LangGraph orchestration

4 hours2 labsFree

Start here

Learning objectives

  • Build AI agents that reason and use tools
  • Implement agentic RAG with dynamic retrieval
  • Design multi-agent systems for complex tasks
  • Use LangGraph for agent orchestration
AGENTIC RAG: REASONING + TOOLS + RETRIEVALAI Agentreason → act → observeVector SearchSQL DatabaseWeb SearchCalculatorMemory (conversation history)Agent DECIDES which tools to use. Not hardcoded pipeline.

Basic RAG retrieves and generates. Agentic RAG reasons about WHAT to retrieve, WHEN to use tools, and HOW to break complex questions into steps. The AI agent decides the retrieval strategy dynamically based on the query.

From Pipeline to Agent

In basic RAG, the pipeline is fixed: embed → retrieve → generate. In agentic RAG, the LLM decides: should I search the knowledge base? Query the database? Search the web? Calculate something? The agent orchestrates tools based on reasoning.

Tool Calling

tools = [
    {"name": "search_docs", "description": "Search internal documentation"},
    {"name": "query_database", "description": "Run SQL query on the product database"},
    {"name": "web_search", "description": "Search the internet for recent information"},
]

# The agent decides which tool to use based on the question
# "What is our refund policy?" → search_docs
# "How many orders last month?" → query_database
# "What is the latest Python version?" → web_search

Multi-Agent Architectures

Complex tasks are split across specialized agents: a Research Agent retrieves information, an Analysis Agent processes data, a Writing Agent generates the final response. LangGraph orchestrates the flow between agents.

Memory Systems

  • Short-term memory: Conversation history within a session
  • Long-term memory: Persistent storage of user preferences, past interactions
  • Working memory: Intermediate results during multi-step reasoning

Common mistakes

What usually breaks

  • Building agents without reliable basic RAG first
  • Not limiting agent tool calls (runaway agents are expensive)
  • Not implementing guardrails for tool access (agent with SQL access can drop tables)
  • Using agents for simple questions (overkill adds latency and cost)

Key terms

Vocabulary used in this module

Agentic RAG

RAG where the AI decides retrieval strategy dynamically

Tool Calling

LLM capability to invoke external functions (search, SQL, APIs)

LangGraph

Framework for building stateful multi-agent workflows

Multi-Agent

Architecture with specialized agents collaborating on tasks

Labs

Hands-on labs

40 minAdvanced

Build a Multi-Tool Agent

Create an AI agent that reasons about tool selection.

  1. Define tools: search, database, calculator
  2. Implement the agent loop (reason → act → observe)
  3. Test with queries requiring different tools
  4. Handle multi-step queries requiring multiple tools
View lab on GitHub
45 minAdvanced

Multi-Agent Orchestration with LangGraph

Build a multi-agent system for complex tasks.

  1. Design agent roles: researcher, analyst, writer
  2. Build a LangGraph workflow connecting agents
  3. Test with complex questions requiring collaboration
  4. Add memory for conversation continuity
View lab on GitHub

Recap

Key takeaways

  • Agentic RAG decides WHAT to retrieve dynamically — not a fixed pipeline
  • Tool calling gives agents access to databases, search, APIs, and calculators
  • Multi-agent systems split complex tasks across specialized agents
  • LangGraph orchestrates agent workflows with state management
  • Memory systems enable context-aware multi-turn interactions

Related resources

Keep learning across CodersSecret