
Understanding AI Agents: Definitions and Mental Models
Master the fundamental shift from static LLM prompts to autonomous AI agents. Learn the core components of agency and how agents differ from traditional software.
What AI Agents Are (and What They Are Not)
Welcome to the start of your journey into production-grade AI agents. Before we write a single line of code, we must align our mental models. The term "Agent" is thrown around loosely in the industry, often used to describe anything from a simple chatbot to a fully autonomous system. In this course, we define an agent with precision.
The Core Definition
At its simplest, an AI Agent is a system that uses a Large Language Model (LLM) as its "reasoning engine" to interact with the world through tools and stateful loops.
Unlike a standard LLM interaction—where you send a prompt and get a response—an agent follows a cycle of Perception, Reasoning, and Action.
graph TD
A[User Goal] --> B{Agent Reasoning}
B --> C[Action: Tool Call]
C --> D[Environment Response]
D --> E[Observation]
E --> B
B -- Goal Achieved --> F[Final Answer]
The Anatomy of an Agent
To build an agent that actually works in production, you must understand its four primary pillars:
- The Reasoning Engine (The Brain): Typically a model like GPT-4o, Claude 3.5 Sonnet, or Llama 3. The model processes input and decides how to proceed.
- Planning: The ability to break down a complex goal ("Analyze this 200-page PDF and find inconsistencies") into smaller, manageable steps.
- Memory:
- Short-term memory: The context window and chat history.
- Long-term memory: Vector databases or persistent state stores that allow the agent to remember things across days or weeks.
- Tool Use (Capabilities): The "hands" of the agent. This includes APIs, database access, web search, or even the ability to execute code.
What AI Agents Are NOT
To design effective systems, you must know where the boundaries lie.
1. Agents are NOT just "Prompt Engineering"
A clever prompt can make an LLM sound smart, but an agent does things. If your system cannot call a function or update a database, it is a chatbot, not an agent.
2. Agents are NOT Deterministic Software
Traditional software follows if/else logic exactly. If x happens, do y.
Agents follow Probabilistic Logic. The LLM "guesses" the best next step based on its training. This is why we need LangGraph—to add structure back to this inherent chaos.
3. Agents are NOT Magical Solvers
Agents are bound by the capabilities of the underlying model. If the model hallucinations on simple math, the agent will fail at accounting tools. Agency adds autonomy, not intelligence.
The Spectrum of Agency
Agency is not binary; it's a spectrum. Understanding where your project sits on this spectrum will determine your architectural choices.
| Level | Name | Description | Example |
|---|---|---|---|
| L1 | Simple Chains | Fixed sequence of steps. | Summarize text -> Translate -> Save to file. |
| L2 | Guided Agents | Branching logic with predefined paths. | A support bot that chooses between 3 help docs. |
| L3 | Autonomous Agents | Open-ended reasoning. | "Research this company and write a report." |
| L4 | Multi-Agent Systems | Collaborative swarms. | A "Manager" agent delegating to "Coder" and "Reviewer" agents. |
Code Example: The Simple Agent Pattern
Let's look at the conceptual transition from a "Chain" to an "Agent" in Python-like logic.
The Chain (Deterministic)
def simple_chain(user_input):
summary = llm.summarize(user_input)
save_to_db(summary)
return "Done"
The Agent (Loop-based)
def autonomous_agent(goal):
state = {"goal": goal, "history": [], "finished": False}
while not state["finished"]:
# The LLM decides what to do next
decision = llm.decide(state)
if decision.type == "TOOL_CALL":
result = tools.execute(decision.tool, decision.args)
state["history"].append(result)
elif decision.type == "FINISH":
state["finished"] = True
return state["final_output"]
Real-World Constraints in Production
When we move from a local script to a product, three constraints dominate the design:
- Reliability: How do you handle a model that occasionally suggests a tool that doesn't exist?
- Latency: Every "loop" in an agent's reasoning cycle adds seconds to the user experience.
- Cost: Autonomous agents can "loop" themselves into a $50 bill if not capped by safety logic.
Summary and Mental Model
Think of an AI Agent as a New Hire.
- You give them a Goal (Role/System Prompt).
- You give them Tools (Access to Slack, Email, DB).
- You give them Standard Operating Procedures (LangGraph workflows).
- You expect them to Report Back when the task is done or if they get stuck.
In the next lesson, we will look at where the famous frameworks (LangChain and LangGraph) fit into this mental model and why "Vanilla" code is rarely enough for production.
Exercise: Identify the Agent
Which of the following describes an AI Agent?
- A script that takes a URL, scrapes the text, and returns a summary.
- A system that receives an invoice email, checks the company database for the vendor, verifies the total matches the PO, and either approves it or asks an admin for clarification.
- A chatbot that uses a vector database to answer questions about a company's HR policy.
Answer: #2 is the only true agent because it multi-steps, uses tools (DB check), and has a conditional logic flow with a "Human-in-the-loop" fallback. #1 is a Chain. #3 is a RAG (Retrieval Augmented Generation) system, which can be part of an agent but isn't necessarily an agent itself.