Step by Step
L
LLM — the reasoning core
The LLM serves as the reasoning core of an agent, deciding what to do at each step based on the current situation and goal.
Example: an LLM reasoning through what action to take next, given the current state of a multi-step research task it's been assigned.
T
Tools — extending capabilities beyond text generation
Tools give the agent capabilities beyond pure text generation: web search, code execution, API calls, and database queries.
Example: an agent using a web search tool to look up current information it needs, rather than relying purely on its own training data.
M
Memory — conversation history and past interactions
Memory includes conversation history within the current session, plus potentially a vector store for retrieving relevant past interactions across sessions.
Example: an agent recalling an earlier step's result from within the same task, rather than losing track of prior context.
⭐
The loop — ReAct: Reason, Act, Observe, repeat
The ReAct pattern interleaves Reasoning and Action: the agent reasons about what to do, selects and calls a tool, observes the result, reasons again based on that result, and repeats this loop until the goal is achieved. Frameworks like LangChain, LangGraph, and AutoGen implement this pattern.
Example: an agent reasoning that it needs current stock price data, calling a financial API tool, observing the returned price, then reasoning about what to do next based on that new information — repeating this reason-act-observe cycle until its task is complete.
Applied Walkthrough
1
An agent is tasked with researching a topic and compiling a summary report, requiring multiple steps and tool uses.
2
Using the ReAct pattern, the agent first reasons about what information it needs, then acts by calling a web search tool.
3
It observes the search results, reasons again about what to do next (perhaps needing to search for additional details), and repeats this reason-act-observe loop multiple times until it has gathered enough information.
4
Because agents can make mistakes or get stuck in unproductive loops during this process, human oversight and sandboxing (restricting what actions the agent can actually take) are critical safeguards, especially for any agent with real-world side effects.
Exam Application
Exams test whether you can name and describe the four agent components (LLM, tools, memory, loop) and whether you understand the ReAct pattern's reason-act-observe cycle. Also expect a question on why human oversight and sandboxing are critical safeguards for autonomous agents.
⚠ Common Trap
The most common trap is assuming agents reliably achieve their goals without any risk of error. Agents can genuinely make mistakes or get stuck in unproductive loops, which is exactly why human oversight and sandboxing (restricting the scope of actions an agent can take) are considered critical safeguards, not optional extras.
✓ Quick Self-Check
1. What role does the LLM play within an agent system?
The reasoning core, deciding what to do at each step.
Tap to reveal / hide
2. Name two examples of tools an agent might use.
Web search, code execution, API calls, or database queries (any two).
Tap to reveal / hide
3. What does the ReAct pattern interleave?
Reasoning and Action — the agent reasons, acts (calls a tool), observes the result, and reasons again, repeating this cycle.
Tap to reveal / hide
4. Name one framework used to build AI agents.
LangChain, LangGraph, or AutoGen (any one).
Tap to reveal / hide
5. Why are human oversight and sandboxing considered critical for agents?
Because agents can make mistakes or get stuck in unproductive loops, so restricting their scope of action and maintaining human oversight are important safeguards.
Tap to reveal / hide