Week 01 — What is an Agent?

Special Topics in Machine Learning: LLM Agents · 2026

Graduate School · PKNU/PNU

Part 0 · Course Orientation

What this course is

One sentence: you will learn how LLM agents work by building one, piece by piece, for 15 weeks — and by reading the papers that invented each piece.

  • Topic: LLM agents — systems where a language model doesn’t just answer, but acts: searches, calls tools, plans, retries.
  • Method: every week = one concept, one paper presentation, one lab that adds a working part to your agent.
  • Final deliverable: a research-assistant agent that searches and synthesizes answers over this course’s own paper corpus (RAG over ~38 papers).

Why this course exists

The AI systems that matter in 2026 are not chatbots.

  • Deep Research reads dozens of web pages on its own and writes a report.
  • Claude Code / coding agents take a bug report, read the code, fix it, run the tests, and retry on failure.
  • The models inside are the same models you can call from a Python script.

The difference is the structure wrapped around the model — and that structure is exactly what this course teaches you to build.

ELI5

A racing engine on a workbench doesn’t go anywhere. Put the same engine in a chassis with wheels, steering, and a fuel line — now it’s a car. This semester we build the car; the engine (the LLM) we rent through an API.

Weekly rhythm (3 hours)

Block Time Who
Theory lecture 30 min instructor
Paper presentations ×2 (25 min each) 50 min students
Break 10 min
Lab (build-from-scratch notebook) 80 min students
Wrap-up · next-week preview 10 min instructor
  • Theory gives the frame; depth comes from the presentations and the lab.
  • Labs accumulate: each week’s part plugs into one growing system.

The 15-week map

Wk Topic Wk Topic
1 Course intro · What is an agent? 9 Context engineering · Memory
2 Prompting & reasoning 10 Multi-agent + LangGraph + MCP
3 Reasoning models & RL 11 Inference economics
4 Tool use 12 Evaluation & benchmarks
5 The agent loop (ReAct) 13 Trust & security · retrospective
6 Retrieval augmentation (RAG) 14 Final presentations (full day)
7 Planning & search · Self-reflection 15 Final exam (written)
8 Midterm exam (written)

Ordering principle: concept dependency — every week is understandable using only what came before it.

Grading

Component Weight What it measures
Midterm (W8) 20% written — system structure & principles
Final (W15) 30% written — integrated understanding
Assignments 30% weekly lab notebooks (auto-checked + code correctness + prompt/metric review)
Presentation & participation 20% team oral paper presentation + discussion
  • Exams are essay-style: explain why a mechanism exists and what fails without it. No trivia.
  • Labs are graded on working code and on whether your prompts hit the stated metric targets.

Paper presentations — the rules

Goal: prove you understood it — not summarize it.

  • 25 min per paper: 15 min talk (hard stop, timer shown) + 8 min cold-question Q&A + 2 min transition.
  • 6 slides maximum. Going over time or over 6 slides costs points.
  • Slide 3 must contain a mechanism figure you drew yourself — pasting the paper’s figure is not allowed.
  • After the talk, slides go off and the instructor asks cold questions; a designated discussant also asks one.

Why so strict?

Forcing compression forces understanding. Anyone can fill 40 slides; only someone who understood the paper can survive 6.

The 6-slide template

# Slide Time
1 One-sentence contribution — “This paper solves [problem] with [idea]” 1 min
2 Problem & motivation — why now, what prior work couldn’t do 2 min
3 Core mechanism — your own hand-drawn figure 5 min
4 One key result — what the single most important experiment proves 3 min
5 Weakest assumption / limitation — your critique 3 min
6 Connection — to follow-up work or your own research 1 min

The full rubric, cold-question types, and a worked example are in the presentation guide on the course site — read it before your slot. The W2 presenter goes first, next week, on Chain-of-Thought.

Today’s schedule (Week 1 exception)

Block Time
Orientation + presenter assignment 35 min
Theory: What is an agent? ← we are here
Break 10 min
Lab: environment setup + first prompt 90 min
Wrap-up 10 min

No paper presentation this week — presentations begin in Week 2 with the first student slot.

Lab prerequisite: your own API key (or Ollama) — guide: labs/API_SETUP.md. If you haven’t set it up, do the account signup during the break.

Part 1 · From Chatbots to Agents

2022 vs now

2022 — the chatbot: you ask, it answers, conversation over.

Now — AI that works: give it a goal, walk away, come back to a finished report or a passing test suite.

The uncomfortable observation:

The models are nearly the same. What made the difference?

This single question runs through all 15 weeks.

Same model, different job

flowchart LR
    subgraph C["Chatbot (2022)"]
        Q[question] --> L1[LLM] --> A[answer]
    end
    subgraph G["Agent (now)"]
        T[goal] --> L2[LLM] --> ACT[action] --> R[result]
        R -->|"fed back in"| L2
        L2 -->|"done"| OUT[final answer]
    end

  • Chatbot: called once, says what it knows, wrong answers are final.
  • Agent: called many times, touches the world through tools, sees the result of its own actions and decides the next move.

The loop on the right is the subject of this course.

What an LLM call actually is

LLM (large language model) = an autoregressive generative model trained on next-token prediction: given the tokens so far, it computes a probability distribution over the next token, samples one, and repeats.

Consequences — an LLM call, by itself:

  • takes text in, gives text out — no other input/output channel exists
  • cannot open a file, cannot run a search, cannot execute code
  • cannot check whether its own output is true
  • produces probable token sequences, not actions in the world

ELI5

Picture a brilliant scholar locked in a sealed room. You slide a note under the door; a note comes back. The scholar has read almost everything ever written — but can’t leave the room, can’t pick up a phone, can’t look anything up. Every capability an agent has beyond “write a good note back” must be built outside the room, by us.

So who does the rest?

Everything the model cannot do — opening files, running searches, verifying output — is done by code around the model.

That code decides:

  • what action to run next
  • when to loop again
  • when to stop

Control flow = the totality of these decisions: what to execute, when, and how many times.

The whole distinction between a chatbot and Deep Research comes down to one question:

Who holds the control flow?

Part 2 · The Definition

Workflow vs. agent

Workflow = a system whose control flow is fixed in advance by the developer’s code. The LLM does a set job at a set place.

Agent = a system whose control flow is decided by the LLM’s own output. The model chooses the next action.

Source: Anthropic, Building Effective Agents (2024) — the de-facto standard distinction.

ELI5

A workflow is a recipe: step 1, step 2, step 3 — written before cooking starts, followed exactly, even by someone who can’t cook. An agent is a chef: tastes the dish, decides it needs salt, decides when it’s done. Same kitchen, same ingredients — the difference is who decides the next step.

The test is decision rights, not capability

A common mistake: “it can search, so it’s an agent.” Wrong axis.

System Has search? Who decides whether/what to search? Verdict
translate → summarize → search → store pipeline yes developer (hard-coded order) workflow
model outputs “SEARCH: transformer scaling laws” and code obeys yes the model agent

Same tool. Same capability. The verdict flips on where the decision is made.

The agent loop

Executing the definition produces one specific program shape:

flowchart TD
    IN[input / goal] --> M["model reads everything so far,<br/>generates output"]
    M --> D{output is...}
    D -->|an action request| X["code executes the action<br/>e.g. run search, open file"]
    X --> APP[append result to the input]
    APP --> M
    D -->|a final answer| OUT[return answer, stop]

  1. Model reads the accumulated input and generates output.
  2. Code interprets it: action request → execute it; final answer → stop.
  3. Execution result is appended to the input.
  4. Model reads the updated input and generates again (back to 1).

This is the agent loop. We build it with our own hands in Week 5.

One loop, every product

Deep Research and Claude Code look nothing alike on screen. Internally they are the same loop

  • different tools in step 2 (web search vs. file edit + test run)
  • different instructions guiding the decisions

…but an identical control skeleton.

ELI5

It’s the same reason a GPS navigator and a thermostat feel related once you see it: sense → decide → act → sense again. The products differ; the loop doesn’t. Learn the loop once and every agent product becomes readable.

Part 3 · Anatomy of an Agent

The four components

Each step of the loop needs a part to run it. Every framework names them roughly the same way:

Component Why it must exist Standard name Week
a model that decides someone must choose the next action Model now
instructions that frame decisions choices are meaningless without a goal & rules Instructions (system prompt) W1 lab
a way to execute decisions text alone changes nothing in the world Tools W4
a record of what happened so far each turn must build on the last Memory / Context W9–10

ELI5

It’s a new employee’s first day. The model is the employee’s mind. Instructions are the job description on their desk. Tools are their computer, phone, and key card. Memory is their notebook — without it, every morning is their first day again. This table is also, quite literally, the course syllabus.

The conversation format

The model’s input is not one string — it is a list of messages, each tagged with a role:

[
  {"role": "system",    "content": "You answer only from the given document."},
  {"role": "user",      "content": "What does the paper claim?"},
  {"role": "assistant", "content": "It claims that..."}
]
  • system — the operator’s standing instructions (highest authority)
  • user — the person’s turn
  • assistant — the model’s own previous turns
  • (tool — results of executed actions; arrives in W4)

This vocabulary appears verbatim in every API, framework, and paper this semester. Today’s lab: you write your first system message and measure how it changes the model’s behavior.

Part 4 · Autonomy — a Dial, Not a Switch

Autonomy is a spectrum

Autonomy = the degree to which control-flow decisions are handed from the developer’s code to the LLM.

Real systems don’t split into two camps — they sit on a dial:

← less autonomous more autonomous →
fixed pipeline router bounded loop autonomous agent
translate→summarize→store classify a ticket, branch once fix code until tests pass (≤5 tries) “research this topic”
LLM decides: nothing one branch repeat & stop the whole plan

ELI5

Think driving automation. Cruise control holds one number. Lane-assist makes one kind of decision. A full self-driving car plans the entire route. Nobody asks “is this car autonomous, yes or no?” — they ask which decisions it makes. Same question for agents.

What the dial costs

Moving right on the dial buys flexibility — the system can handle problems you couldn’t script in advance.

It pays for it with:

  • Predictability — you no longer know the execution path before running
  • Cost & latency — more model calls, longer chains
  • Debuggability — failures hide inside decisions you didn’t write

Working principle of this course (and of the industry):

Hand over only as much autonomy as the task requires — and not one notch more.

We meet this principle again, with a price tag attached, in Week 11 (inference economics).

Workflow patterns — the standard vocabulary

On the left side of the dial, five compositions of LLM calls recur so often they have standard names. You will implement every one of them this semester:

flowchart LR
    subgraph P1["Prompt chaining · W7"]
      a1[call] --> a2[call] --> a3[call]
    end
    subgraph P2["Routing · W6"]
      b0[classify] --> b1[path A]
      b0 --> b2[path B]
    end
    subgraph P3["Parallelization · W2–3"]
      c0[input] --> c1[call] & c2[call] & c3[call] --> c4[aggregate / vote]
    end

flowchart LR
    subgraph P4["Orchestrator–workers · W10"]
      d0[orchestrator] --> d1[worker] & d2[worker]
      d1 & d2 --> d3[combine]
    end
    subgraph P5["Evaluator–optimizer · W7"]
      e1[generate] --> e2[evaluate]
      e2 -->|"feedback"| e1
      e2 -->|"good enough"| e3[done]
    end

Part 5 · Form Factors

A chatbot is one shape, not the definition

Form factor = how an agent meets people and systems. The definition (who holds control flow) says nothing about the interface — so one engine ships in many bodies:

Form Example Unit of interaction
Conversational ChatGPT, support bots exchanging messages
Delegated (background) Deep Research, coding agents hand over a task, review the artifact
Embedded IDE copilots assistance inside the workplace
Headless a component in a pipeline; an agent inside an agent API calls — no human present
  • The chatbot was merely the first form; the center of gravity is shifting to delegated & embedded.
  • This course teaches the engine common to all four. Your final project wears a conversational shell — but the engine underneath would fit any of them.

Part 6 · When (Not) to Use an Agent

Adoption criteria

Autonomy is a trade — so choosing “agent or workflow” means asking when the trade pays.

An agent is worth it when:

  • the solution path cannot be scripted in advance (open-ended problems)
  • the task is multi-step across several tools
  • intermediate feedback can improve the outcome (tests, retrieved evidence, critiques)

A workflow (or a single call) wins when:

  • the procedure is fixed — a workflow is cheaper and more reliable
  • errors are costly and you have no way to verify the output — handing over decisions is then pure risk
  • it’s a one-shot Q&A — a loop adds nothing but latency

The one-line judgment

Autonomy is not free. It buys flexibility and sells predictability and cost. Give the task exactly the autonomy it needs — and prefer the boring solution when it suffices.

ELI5

You don’t hire a consultant to reorder printer paper — there’s a button for that. You do hire one when the problem is “figure out why sales are down.” Hiring the consultant for the paper order isn’t just wasteful; it makes a simple thing unpredictable.

Part 7 · How the Semester Builds It

Deficiencies → syllabus

We established: an LLM call is text-in, text-out, nothing more. Each missing capability becomes a week of this course:

The model… So we build… Week
cannot act tools · the agent loop W4–5
doesn’t know recent or private data retrieval (RAG) · memory W6, W9–10
doesn’t know when it’s wrong planning · self-reflection · evaluation W7, W12
accumulates unbounded input as it loops context engineering W9
can be too weak alone multi-agent systems W10
gets expensive as it gets capable inference economics W11
becomes an attack surface once it acts trust & security W13

Nothing on this list is arbitrary — every week is a patch for a specific, demonstrable failure, and each week starts by demonstrating that failure on our own agent.

Your agent, week by week

The lab thread: one system, growing weekly — docqa, a research assistant over this course’s paper corpus.

  • W1 (today): connect the brain — first API call, first system prompt, measure its effect
  • W5: first complete agent runs (the loop, assembled from W2–4 parts)
  • W6 & W9–10: it gains retrieval and memory 📦
  • W11+: rebuilt on LangGraph; routing, evaluation harness, guardrails
  • W14: you present it

Falling behind is recoverable by design: each week’s reference solution is published afterward (labs/checkpoints/), so any week can start from a known-good state.

Today’s lab (after the break)

W1_lab_setup.ipynb — 75 minutes:

  1. Environment: Python 3.10+, aisuite, your API key (guide: labs/API_SETUP.md) or Ollama
  2. Observe: a raw call is text-in/text-out; roles; sampling
  3. Write: the DOCQA_SYSTEM prompt — your assistant’s standing instructions
  4. Measure: reduce fabricated answers on a trap-question set below the target rate

The point is not the plumbing (provided in docqa/agent_lib.py) — it is seeing, with numbers, that instructions change behavior.

Summary

  1. The chatbot→agent difference is not the model — it is the structure around the model.
  2. Definition: an agent is a system whose control flow is decided by the LLM’s output; fixed by the developer → a workflow. The test is decision rights, not capability.
  3. Autonomy is a dial, and it isn’t free: flexibility ↔︎ predictability & cost. Use the minimum that works.
  4. A chatbot is one form factor of many; the engine — the loop — is what this course builds.

Next week (W2 · Prompting & Reasoning): how far you can push a fixed model with prompts and inference-time computation alone — plus our first student presentation (Chain-of-Thought).