Agentic AI & ReAct
1. From Pipelines to Agents
Up until now, we have built Pipelines.
A pipeline (like RAG) is a hardcoded sequence of events:
- User asks a question.
- Embed the question.
- Search the database.
- Generate an answer.
Pipelines are deterministic and highly reliable, but they are rigid. If the user asks a question that requires searching the database twice, or requires searching the database and then using a calculator, a standard RAG pipeline will fail. It only knows how to do exactly what you programmed it to do.
What is an AI Agent?
An AI Agent is a system where the LLM acts as the "brain" or the routing engine. Instead of hardcoding the sequence of steps, you give the LLM a goal and a set of tools, and you let the LLM decide which tools to use and in what order.
- Perception: The agent receives input from the user or its environment.
- Cognition: The agent reasons about the input, breaks down the problem, and decides on a plan.
- Action: The agent uses tools (Function Calling) to execute the plan.
The Shift in Control
When you build an agent, you are surrendering control flow to the LLM.
In a pipeline, your Python or JavaScript code says: if X, then Y.
In an agentic system, your code says: while goal_is_not_met: ask_llm_what_to_do_next().
This shift allows agents to handle incredibly complex, multi-step, and ambiguous requests that would be impossible to hardcode. However, it also introduces unpredictability. The agent might get stuck in an infinite loop, use the wrong tool, or hallucinate a conclusion.
To make agents reliable, we need a structured framework for how they "think." The most famous of these frameworks is ReAct.