Module 5: LLM Agents
An LLM prompted to answer a question is a calculator. An LLM given tools, memory, and the ability to take actions is an agent - a system that can observe its environment, reason about what to do next, and execute multi-step plans toward a goal.
This module takes you from first principles (what is a tool call?) through production-grade concerns (how do you safely deploy an agent that can execute code and send emails?). By the end, you will understand not just how agents work, but when they are the right tool and when they are not.
The Agent Loop
Every LLM agent, regardless of framework or complexity, runs some version of this loop:
The loop terminates when either the agent produces a final answer, reaches a maximum iteration limit, or encounters an unrecoverable error.
Module Map
| # | Lesson | Core Question |
|---|---|---|
| 01 | Tool Use and Function Calling | How does an LLM call external functions? |
| 02 | ReAct Agent Pattern | How do we interleave reasoning and action? |
| 03 | Planning and Reasoning | How do agents handle complex multi-step tasks? |
| 04 | Memory Systems | How do agents remember across turns and sessions? |
| 05 | Multi-Agent Architectures | When and how do multiple agents collaborate? |
| 06 | Agent Evaluation | How do we measure whether an agent actually works? |
| 07 | LangChain Deep Dive | What does LangChain actually do and when should you use it? |
| 08 | LlamaIndex Deep Dive | How does LlamaIndex handle data-heavy agent applications? |
| 09 | Agent Safety and Guardrails | How do we prevent agents from doing harmful things? |
Prerequisites
Before this module, you should be comfortable with:
- Transformer architecture - attention, tokenization, context windows
- Prompt engineering - system prompts, few-shot, chain-of-thought
- API basics - calling LLMs via REST or SDK, handling responses
- Python - async/await, dataclasses, basic type hints
Key Concepts Glossary
| Term | Definition |
|---|---|
| Agent | An LLM system that can take actions, observe results, and iterate toward a goal |
| Tool | An external function the LLM can invoke (search, calculator, API, code runner) |
| ReAct | Reasoning + Acting - the pattern of interleaving thought traces with tool calls |
| Orchestrator | An agent that coordinates other agents or tools |
| Context window | The finite token budget available in a single LLM call |
| Episodic memory | Stored records of past interactions, retrieved when relevant |
| Function calling | The API mechanism for getting structured JSON tool invocations from an LLM |
| Guardrails | Safety checks on agent inputs and outputs |
| Trajectory | The full sequence of thoughts, actions, and observations in one agent run |
| HITL | Human-in-the-loop - requiring human approval for high-stakes actions |
:::tip Where Agents Shine Agents are most powerful for tasks that are: (1) too long for a single prompt, (2) require external data or actions, (3) have multiple valid paths to the answer, or (4) require iteration and self-correction. :::
:::warning Where Agents Fail Agents are often the wrong choice for: simple Q&A, tasks that can be handled with one RAG retrieval, or anything where latency and cost predictability are critical. :::
