Course

AI agents from the ground up

Loops that act, stop and stay inside their permissions

  • Intermediate
  • 10 chapters
  • 157 min read

What an agent actually is: a loop of observe, decide and act with a budget and three exits. Build one from scratch — tools with schemas, planning and replanning, working and long-term memory, permission checks the model cannot edit, delegation with a contract, and a capstone research agent with a trace.

What You'll Learn

  • Explain the loop that makes a program an agent
  • Design a small action space with validated arguments
  • Bound a loop with step, time and progress exits
  • Plan a task, and replan only the unfinished tail
  • Separate scratchpad, transcript and long-term memory
  • Write a policy that decides who may call what, and when a human must approve
  • Delegate to a sub-agent with a contract, a budget and no escalation
  • Build a bounded research agent with a readable trace

Prerequisites

  • Comfortable with Python functions, dictionaries and classes
  • The LangChain course is useful but not required
  • No API key is needed — every example uses a scripted model

Vocabulary

The terms the chapters assume, in plain words.

action space
The full set of moves an agent can choose from, usually the list of tools it is given.
agent
A program that repeats a loop: read the state, choose a move, look at the result, then decide again.
budget
A hard limit on how many steps, seconds or moves a run may spend before it must stop.
delegation
Handing a smaller task to another agent, with its own instructions, tools, budget and required result shape.
guardrail
Code that checks a proposed move against the rules before it runs, and can refuse it or ask a person.
loop
The repeated cycle of choosing a move, carrying it out and reading the result, which makes a program an agent.
model
The trained program that reads text and chooses what to say or do next.
observation
What came back from a tool or a step, added to the state for the next decision.
plan
A written list of steps for the task, which can be revised when a step fails or the facts change.
scratchpad
The working notes for one run: the plan, what was tried and what came back, discarded when the run ends.
state
The record of the question, the plan and the observations so far, passed to the model on every turn.
sub-agent
A separate agent given one bounded job, its own tools and its own budget, whose answer returns to the caller.
tool
A named function an agent may ask to run, with declared inputs and a result the loop can read.
trace
The ordered record of every decision, tool use and result in a run, used to explain what happened.

Course Content

  1. 01
    What an agent is

    A chain answers once. An agent acts, looks at what happened, and decides again. The difference is a loop and a budget, not a smarter model.

    Beginner · 13 min read

    Not started
  2. 02
    Tools and the action space

    The tool list is what an agent can do, and therefore what an attacker can make it do. Every tool needs a name, a schema, a validation rule and a failure path.

    Beginner · 14 min read

    Not started
  3. 03
    The loop and its limits

    Every agent loop needs three exits: answered, out of budget, and going nowhere. The third one is the one people forget.

    Intermediate · 15 min read

    Not started
  4. 04
    Planning and replanning

    A plan is a list of steps with a check after each one. Its value is not the list — it is knowing which step failed and being able to change only that step.

    Intermediate · 15 min read

    Not started
  5. 05
    Memory for agents

    Three kinds of memory, three jobs: the scratchpad for this run, the transcript for this conversation, and a store for facts that outlive both.

    Intermediate · 15 min read

    Not started
  6. 06
    Permissions and guardrails

    An agent with a tool can be talked into using it. The guardrail is a policy the model cannot edit: who may call what, with which values, and when a person must approve.

    Advanced · 16 min read

    Not started
  7. 07
    Delegation and handoffs

    A sub-agent is a function call with a prompt. It earns its cost when the subtask has its own tools and its own context — and it needs a contract, a budget and a way to fail.

    Advanced · 15 min read

    Not started
  8. 08
    Agent evaluation

    An agent is judged by its trajectory as well as its answer. Score the tools it chose, the steps it took and the budget it used, then watch the pass rate over time.

    Advanced · 16 min read

    Not started
  9. 09
    Failure recovery

    Tools time out and providers rate-limit; that is ordinary weather, not an exception. Classify the error, retry only what is safe, then replan or stop with a trace that says what happened.

    Advanced · 16 min read

    Not started
  10. 10
    Capstone: a bounded research agent

    A complete agent in one file: tools with schemas, a plan, three exits, a permission check, an approval, a budget and a trace. Every idea in the course, once.

    Advanced · 22 min read

    Not started