Lesson 1 - What Is an Agent?

Welcome to What Is an Agent?

“Agent” might be the most overused word in AI right now. It gets attached to chatbots, prompt chains, and anything that calls an API twice. So before you build one, let’s pin down what an agent actually is — because the definition is simple, precise, and it shapes every decision you’ll make in this course. The short version: an agent is a language model placed inside a loop, where the model itself decides what to do next, takes an action (usually by calling a tool), looks at the result, and repeats — until it judges the goal is met. The defining feature isn’t intelligence or size. It’s that the model, not your code, chooses the path.

By the end of this lesson, you will be able to:

  • Define an AI agent in one sentence and explain the key idea behind it
  • Describe the agent loop: decide → act → observe → repeat
  • Contrast an agent with a single LLM call
  • Recognize the role of tools, goals, and stopping conditions

Let’s begin with the loop at the heart of every agent.


A Single Call vs. a Loop

You’ve almost certainly made a single call to a language model: you send a prompt, you get back text, and that’s the end of the interaction. That’s powerful — it can classify, summarize, draft, and answer — but it’s one shot. The model can’t check a fact it doesn’t know, run a calculation it can’t do in its head, or take an action in the world. Whatever it produces, it produces in a single pass from the information you gave it.

An agent breaks out of that single pass. Instead of one prompt-and-done, you put the model in a loop and give it tools — functions it can ask to run, like “search the web,” “look up a price,” or “save this note.” Now the interaction can span many steps: the model can call a tool, read what comes back, decide what to do with it, and call another. It keeps going until it has what it needs to finish. The single call answers from what it already has; the agent can go get what it’s missing.


The Agent Loop

Here’s the cycle that defines an agent. It’s worth committing to memory, because the rest of this course is really just this loop with more capable pieces plugged into it:

The agent loop. A 'Goal' (what to accomplish) feeds into 'Claude decides' (the model asks itself whether it has the answer or should call a tool). One branch, labeled 'needs a tool', goes to 'Act: run the tool' (your code executes it), then to 'Observe' (the result), and a dashed arrow feeds the result back to 'Claude decides' to loop again. The other branch, labeled 'done', goes to 'Final answer' which stops the loop. A caption notes the model, not your code, chooses each next step.
The agent loop: the model decides whether to act or finish; if it acts, your code runs the tool and feeds the result back, and the loop repeats until the model produces a final answer.

Read it as four beats that repeat:

  1. Decide. Given the goal and everything seen so far, the model decides the next step — either “I can answer now” or “I need to call a tool.”
  2. Act. If it chose a tool, your code executes that tool and produces a result. (The model never runs anything itself — it only requests actions.)
  3. Observe. The tool’s result is fed back to the model as new information.
  4. Repeat. The model decides again, now better informed. The loop continues until the model decides it’s done and returns a final answer.

Two things make this work, and they’re easy to miss. First, the model drives — it picks each action based on what it has learned, rather than following steps you hardcoded. Second, your code is the hands — the model proposes, but your program is what actually calls the tool, checks the result, and decides whether to keep looping. You’ll build exactly this loop, for real, in the next module.


What an Agent Is Made Of

Every agent, no matter how fancy, is assembled from the same small set of parts. We’ll devote whole modules to most of these later; for now, just learn the vocabulary:

  • A model — the “brain” that does the deciding. In this course that’s Claude.
  • A goal (and instructions) — what you want accomplished, plus a system prompt describing how the agent should behave.
  • Tools — the actions the model can request: search, calculate, look something up, write a file. Tools are what let an agent affect the world beyond text.
  • The loop — the code that runs the decide-act-observe cycle and knows when to stop.
  • Memory — what the agent carries forward: the conversation so far, and (later) longer-term notes.

An agent is the combination of these in a loop. Take away the tools and the loop, and you’re back to a single, one-shot call.

The model proposes; your code disposes

A crucial safety and design point: the model never executes anything on its own. When Claude “calls a tool,” it really just emits a structured request — “please run search with this input.” Your program decides whether and how to honor that request, runs the actual function, and returns the result. That separation is what lets you validate inputs, require approval for risky actions, log everything, and stay in control — themes we’ll return to throughout the course.


Knowing When to Stop

A loop that never ends is a bug, not an agent. Every agent needs stopping conditions, and getting them right is part of the craft. The natural stop is when the model decides it has finished and returns a final answer instead of a tool call. But you also need guardrails for when it doesn’t converge: a maximum number of steps, a budget cap, or a timeout, so a confused agent fails safely instead of looping forever or running up a bill.

For now, just hold the idea: an agent runs until it’s done or until a limit you set says “stop.” We’ll implement both the natural stop and the safety limits when we build the loop in Module 2.


Practice Exercises

Exercise 1: One-sentence definition

In your own words, define an AI agent in a single sentence — and name the one feature that most distinguishes it from a plain LLM call.

Hint

An agent is a language model placed in a loop where it chooses its own next action, uses tools, observes the results, and repeats until the goal is met. The distinguishing feature is that the model decides the path step by step, rather than running a single fixed pass like a plain LLM call.

Exercise 2: Trace the loop

A user asks an agent, “What’s the weather in the city where our next conference is?” The agent has two tools: lookup_conference() and get_weather(city). Walk through the decide-act-observe steps the agent would likely take.

Hint

Decide → call lookup_conference(); Observe → “the conference is in Lisbon”; Decide again → call get_weather("Lisbon"); Observe → “18°C and clear”; Decide again → it now has everything, so it returns a final answer. Two tool calls, each chosen based on the previous result.

Exercise 3: Who runs the tool?

When Claude “calls a tool” in an agent, does Claude execute the function itself? Explain what actually happens.

Hint

No. The model only emits a structured request to run a tool with certain inputs. Your code receives that request, executes the real function, and feeds the result back to the model. The model proposes the action; your program performs it — which is what keeps you in control.


Summary

An AI agent is a language model placed in a loop where the model itself chooses each next action, calls tools, observes the results, and repeats until the goal is met. That’s the whole idea — and the distinguishing feature is that the model, not hardcoded steps, drives the path. The agent loop is decide → act → observe → repeat: the model decides whether to answer or call a tool, your code runs any tool it requests and feeds the result back, and the loop continues until the model returns a final answer or a safety limit stops it. Every agent is built from the same parts — a model, a goal and instructions, tools, the loop, and memory — and crucially, the model only requests actions while your code actually performs them.

Key Concepts

  • Agent — a model in a loop that chooses its own actions with tools until a goal is met.
  • The agent loop — decide → act → observe → repeat.
  • Tools — actions the model can request; your code executes them.
  • Stopping conditions — the natural finish, plus limits (max steps, budget, timeout).

Why This Matters

This single mental model — a model driving a decide-act-observe loop — is the foundation everything else in the course builds on. Get it right and the rest (tool design, memory, planning, multi-agent systems) is just adding better pieces to a loop you already understand. Get it wrong — treating “agent” as a synonym for “smart prompt” — and you’ll reach for an agent when a simple call would do, or build a loop with no idea why it misbehaves. Next, you’ll sharpen the most important judgment call this model enables: knowing when you actually need an agent, and when a plain workflow is the better tool.


Next Steps

Continue to Lesson 2 - Agents vs. Workflows

Learn when an agent is the right choice — and when a simpler, predictable workflow wins.

Back to Module Overview

Return to the Agent Foundations module overview


Continue Building Your Skills

You now have the one mental model that the whole course rests on: an agent is a model in a decide-act-observe loop, choosing its own actions with tools. Next you’ll learn the judgment that separates good agent builders from the rest — deciding when that loop is worth it, and when a plain workflow is the smarter choice.