Free lesson · Module 1, lesson 1 of 7

What an agent is: a model, tools and a loop

Define an agent as a model that chooses its own next step using tools, in a loop, until the task is done, and pick the agents out of six everyday AI products.

Lessons in this module

Lesson notes

For the student

An agent is a model that chooses its own next step, using tools, in a loop, until the task is done. This lesson gives you the three parts and two questions that sort any AI product. Through the course you will build one agent part by part: the Campus Helpdesk, which answers fee, timetable, notice and hostel questions for a college.

The three parts

  • Model: reads text and writes text. In an agent it also decides what to do next
  • Tools: functions in your program that the model can ask to run, such as get_fee or find_notice. Tools let it find facts and act
  • Loop: the model decides a step, the program runs the tool, the model reads the result and decides again, until the task is done

Three designs

  • Chatbot: a model alone. It only answers from what it knows and what you typed. You choose the next step by typing the next message
  • Workflow: a fixed set of steps the programmer decided in advance. The model fills in each step but never chooses what comes next
  • Agent: the model chooses each next step itself, using tools, in a loop

One question, two ways

  • Asha, in CSE year 2, asks for her semester fee and the last date to pay
  • A model alone has never seen her college's records, so it cannot know, or it guesses
  • With tools and a loop, the model calls get_fee and reads ₹85,000, her fee for the year, then chooses find_notice and reads 30 November. It answers ₹42,500 (half the yearly fee) by 30 November, and stops

Two questions that sort a product

  • Can it act, or only answer? Only answer: a model alone, a chatbot
  • Who chooses the next step? The programmer: a workflow. The model, step after step, until the task is done: an agent
  • Judge by what the product does, not by what it is called

Autonomy is a scale, not a switch

  • Autonomy is how much the agent decides without asking a person
  • An assistant that acts only after you approve is still an agent, with less autonomy
  • Chat turns and fixed steps are not an agent's loop: in a loop, the model reads a result and then makes a fresh choice

Try it

  • Sort these six products into chatbot (a model alone), workflow or agent, and say which part each one is missing
  • 1: a phone keyboard that suggests the next word
  • 2: a chat app that explains any topic you type
  • 3: a college app that summarises each new notice, translates it and sends it
  • 4: a support agent for a shopping site that looks up your order, reads the refund policy and raises a refund after a person approves
  • 5: a shop's bill reader that reads each bill, checks the total and saves it
  • 6: a research agent that searches, reads what it finds, searches again and writes a report with its sources
  • Check yourself: 1 and 2 are a model alone (no tools, no loop); 3 and 5 are workflows (the model never chooses the next step); 4 and 6 are agents (nothing missing; 4 has less autonomy because a person approves)

Lesson quiz

Checked in your browser. Nothing is sent or saved.

5 questions

Question 1 · easy

What are the three parts of an agent, as this lesson defines it?

Question 2 · easy

In an agent, who chooses the next step?

Question 3 · medium

A college app summarises each new notice, translates it and sends it, always in that order. Which design is it?

Question 4 · medium

Asha's fee for the year is ₹85,000 and a notice says to pay by 30 November. The agent reads both with its tools and answers with her semester fee. What does it answer?

Question 5 · hard

A shopping site's support agent looks up your order, reads the refund policy and raises a refund only after a person approves. What is true of it?

Next: Chatbot, workflow or agent: three ways to build one feature