Skip to main content

📝 Agentic AI System

Description

< What is it? >

  • [Agentic AI System]
    • An agentic AI system is a type of artificial intelligence that can autonomously perform tasks, make decisions, and interact with its environment. Unlike traditional AI systems that require human intervention for every action, agentic AI systems can operate independently, adapting to new situations and learning from their experiences.
    • Agentic AI systems are designed to exhibit characteristics of agency, such as goal-directed behavior, decision-making capabilities, and the ability to perceive and respond to changes in their environment. These systems can be applied in various domains, including robotics, autonomous vehicles, virtual assistants, and more.
  • [ReAct]
    • ReAct ("Reasoning + Acting") is a prompting framework for LLMs where the model interleaves explicit reasoning steps with actions (tool calls), rather than just producing an answer directly or just calling tools blindly. It's the core loop underlying most agentic systems.
    react
  • [LangGraph]
    • LangGraph is a Python library designed to build stateful, multi-step applications that integrate LLMs with external tools. It uses a graph-based approach to define workflows, where each step (or node) represents a specific operation. LangGraph also supports:
      1. Conditional edges: Directing workflows dynamically based on conditions.
      2. Persistent states: Retaining context across workflow executions.
      3. Tool integration: Seamless interaction between LLMs and external tools or APIs.
    • LangGraph State
      • A LangGraph state is a structured representation of the current knowledge, context, and goals of an agentic AI system => the information/data being passed around the graph.
    tool nodes
  • [Tool]
    • A tool is an external resource or API that an agentic AI system can call to perform specific actions or retrieve information. Tools can include search engines, databases, calculators, code execution environments, and more. By leveraging tools, agentic systems can extend their capabilities beyond text generation and interact with the real world.
    • Each tool is described with:
      • Name - identifier for the tool
      • Description - what the tool does and when to use it (LLM use the description to decide if the tool is relevant to the task)
      • Parameters - what inputs are needed, their types, and descriptions
      • Expected Output - what the tool returns
      {
      "name": "get_weather",
      "description": "Get current weather for a specific city. Use this when users ask about weather conditions.",
      "parameters": {
      "city": {
      "type": "string",
      "description": "Name of the city to get weather for"
      }
      }
      }
    • Agent Decision-Making process
      1. Parse the user request - Understand what's being asked
      2. Review available tools - Check descriptions to see which tools might help
      3. Select appropriate tools - Based on description matches with the task
      4. Generate tool calls - Format the call with proper parameters (Extracts parameters from user input based on tool parameter descriptions)
      5. Execute and process results - Use the output to continue the task

Key points

< Main advantages >

RAG vs LLM call

  1. [Autonomy] it decides what to do next rather than following a fixed script. Given a goal like "book me a flight to Tokyo under $800," it figures out the steps itself.
  2. [Tool use] it can call external tools/APIs (search, code execution, databases, calculators) to gather information or take actions in the world, not just generate text.
  3. [Multi-step reasoning / planning] it breaks a complex goal into subtasks, executes them in sequence (or parallel), and adapts the plan if something fails or new information appears.
  4. [Memory / state] it tracks what it's already done and what it's learned across steps, so it doesn't repeat work or lose context mid-task.
  5. [Self-correction / reflection] many agentic systems evaluate their own intermediate outputs and retry or revise if something looks wrong.

Basic RAG vs Agentic RAG

An Agentic RAG builds on the basic RAG concept by introducing an agent that makes decisions during the workflow:

  1. Basic RAG: Retrieves relevant information from a database and uses a Language Model (LLM) to generate a response.
  2. Agentic RAG: Adds dynamic decision-making by enabling the LLM to decide whether additional steps, like using external tools or fetching more data, are needed before generating a response.

Architecture

The LangChain ecosystem

  • LangSmith: debug, evaluation, monitoring - A platform for debugging, evaluating and monitoring LLMs and agentic systems.
  • LangGraph: agent customization - A Python library for building agentic systems with LLMs and external tools.
  • LangGraph Platform: agent deployment - A cloud-based service for deploying and managing LangGraph applications.
langgraph rag

Crash course

Reference