Skip to content

What is an agent?

Read · 1 of 3

Chatbot, workflow, agent

A chatbot answers once: your message in, its message out.

A workflow runs steps you wrote in advance: fetch the page, then summarise it, then email it. The model fills in each step, but the order is fixed.

An agent decides the steps itself. It looks at the goal, picks a tool, looks at the result, and picks again, in a loop, until it decides it's done.

That loop is the whole idea. Everything else in this course (tools, memory, planning, safety, evals) is about making that loop useful and trustworthy.

Read this lesson as text

A model that chooses its next step in a loop, using tools, until the job is done.

Chatbot, workflow, agent

A chatbot answers once: your message in, its message out.

A workflow runs steps you wrote in advance: fetch the page, then summarise it, then email it. The model fills in each step, but the order is fixed.

An agent decides the steps itself. It looks at the goal, picks a tool, looks at the result, and picks again, in a loop, until it decides it's done.

That loop is the whole idea. Everything else in this course (tools, memory, planning, safety, evals) is about making that loop useful and trustworthy.

The loop

  1. Goal: What the user wants.
  2. Model: Decides: answer now, or use a tool?
  3. Tool: Your code runs it: search, calculate, read a file.
  4. Result: Goes back to the model. Repeat.
  5. Answer: When the model says it's done.

A loop you can read

plan = ["search", "read", "answer"]
steps = 0
for action in plan:
    steps += 1
    if action == "answer":
        break
print(steps, action)

What does this print?

  • 3 answer
  • 2 read
  • 4 answer
Show the answer

3 answer The loop runs search, read, then answer, where it stops. Three steps. A real agent works the same way, except the model picks each action.