PHASE 3 ← Back to Course
15 / 23
🤖

What Are AI Agents?

Understand the paradigm shift from chatbots to autonomous agents that plan, reason, and act. Discover how agents differ from traditional chatbots and why they represent the future of AI applications.

1

From Chatbots to Agents — The Evolution

For years, AI systems worked like this: you ask a question, the model thinks for a moment, and returns an answer. This works well for many tasks — writing emails, explaining concepts, generating code snippets. But what happens when you ask it to do something that requires multiple steps?

❌ Traditional Chatbot
User: "Research AI agents and write a summary"
Model: Tries to generate full answer from memory
Result: Outdated info, no real research, hallucinations
✅ AI Agent
User: "Research AI agents and write a summary"
Agent: Plan → Search web → Read articles → Synthesize → Write
Result: Current, accurate, cited information
💡

The Core Difference

A chatbot is a question-answering machine. You ask, it responds. An agent is a goal-seeking system. You set an objective, it figures out the steps, takes action, observes results, and adjusts. Agents have loops; chatbots have one-shot responses.

2

The Agent Definition: Perceive, Reason, Act, Learn

An AI agent is fundamentally an LLM equipped with the ability to interact with the world beyond just text. Here are the four core capabilities:

👁️

Perceive

Read inputs: user requests, tool outputs, sensor data, files, web pages. The agent gathers information about its environment.

🧠

Reason

Plan next steps: break down goals into subtasks, decide which tool to use, evaluate options. This is where the LLM's reasoning shines.

⚙️

Act

Use tools: call APIs, run code, modify files, send messages. The agent takes concrete actions in the world.

🔄

Learn & Adapt

Process results: incorporate tool outputs, handle errors, adjust strategy. The loop continues until the goal is reached.

Conceptual Pseudocode — The Four Phases
while not goal_achieved:
    # 1. Perceive: gather information
    observations = read_inputs()
    previous_results = get_last_action_result()

    # 2. Reason: decide what to do
    thought = llm.generate(
        "Given these observations, what should I do next?",
        context=observations + previous_results
    )

    # 3. Act: use a tool
    action = parse_tool_choice(thought)
    result = execute_tool(action)

    # 4. Learn: process the result
    goal_achieved = check_goal(result)
3

Agent vs. Chain: The Key Difference

You might have heard of "prompt chains" — these are similar to agents, but fundamentally different in one crucial way.

⛓️ Prompt Chain (Rigid)
Step 1 → Step 2 → Step 3 → Step 4
Predefined sequence.
Model executes each step in order.
No branching or adaptation.
Works for linear workflows.
🤖 Agent (Flexible)
Step 1 → Decide → Step 2 or 3?
Agent decides what's next.
Loop continues until goal reached.
Can branch, retry, skip steps.
Adapts to unexpected results.
🎯

Analogy: GPS Navigation

A chain is like reading turn-by-turn directions: "Turn left at Main, go straight 2 miles, turn right on Oak." If the road is blocked, you're stuck. An agent is like having a real GPS with real-time traffic: it re-routes, finds alternatives, and adapts. Agents have agency — they respond to their environment.

4

Real-World Agent Examples

Agents are already everywhere. Here are some real systems you can use or learn from:

💻

Coding Assistants (Cursor, Claude Code)

Read your codebase, understand the architecture, modify files, run tests, and iterate. They don't just suggest code — they understand context and make decisions about what to fix.

🔬

Research Agents

Search the web, read papers, extract key info, cross-reference findings, and write reports. Agents solve the "hallucination problem" by grounding their answers in real sources.

📊

Data Analysis Agents

Load datasets, generate SQL queries, run analysis, visualize results, and write insights. They bridge the gap between natural language questions and data-driven answers.

🎧

Customer Support Agents

Handle tickets, retrieve customer history, execute actions (refunds, cancellations), and escalate when needed. They reduce response time from hours to seconds.

5

The Agent Loop: Observe → Think → Act → Repeat

At the heart of every agent is a simple but powerful loop. Understanding this loop is everything.

Observe
Agent gathers current state: user query, tool outputs, memory, environment. "What do I know right now?"
Think
LLM generates reasoning: "Given what I observe, what should I do next? Which tool should I use?"
Act
Agent executes the chosen action: calls a tool, modifies state, sends a message. Takes a concrete step.
Result
Tool returns output. Agent updates its knowledge. Loop continues or terminates based on goal status.
🔑

Loop Termination

The loop stops when one of these is true: (1) the goal is achieved, (2) max iterations reached (safety), (3) an unrecoverable error occurs, (4) the user explicitly stops it. Without termination conditions, agents can loop forever.

6

When to Use Agents vs. Simple Prompts

Not every task needs an agent. Agents add complexity. Here's a decision framework:

Use an Agent When:

The task requires multiple steps, decision-making, or tool use. You need real, current information (web search). The path to the goal isn't predetermined. You want error recovery and retries. Example: "Research the latest AI funding trends and write a 500-word report."

Use a Simple Prompt When:

One-shot generation is enough. The task is well-defined and linear. You're not calling external tools. Latency is critical (agents are slower). You want predictability and cost control. Example: "Write a haiku about the moon."

💡

The Complexity Tradeoff

Agents are powerful but slower and more expensive than simple prompts. If your task can be solved with a direct prompt, do that. Use agents for genuinely complex, multi-step, adaptive work. Don't over-engineer.

Check Your Understanding

Quick Quiz — 4 Questions

1. What is the core difference between a chatbot and an agent?

2. Which of these is NOT a core capability of an AI agent?

3. How do agents differ from prompt chains?

4. When should you use an agent instead of a simple prompt?

Topic 12 Summary

You now understand what AI agents are and why they represent a paradigm shift from traditional chatbots. Agents are autonomous systems that perceive their environment, reason about it, take actions, and learn from results. They follow a loop-based architecture (Observe → Think → Act → Repeat) rather than one-shot question-answering. Agents vs. Chains: agents decide their own path; chains follow predefined steps. Not every task needs an agent — use them for multi-step, adaptive work with real-time tools.

Next up → Topic 13: Agent Architecture
Now you'll dive deep into the technical architecture: planning, memory, tools, and state management.

← Topic 11 Topic 15 of 23 Topic 13 →