Build Your Own AI Agents

Lesson 1 of 7

What Is an AI Agent?

A chatbot answers. An agent acts: it has a goal, can use tools, and loops until the job is done.

🟢 Beginner 50 XP

Learn it

A chatbot replies to one message. An AI agent is given a goal and works towards it in several steps.

Agents can use tools — like a calculator, a web search or a calendar — to do things a language model can't do alone.

Every agent runs a loop: think → act → look at the result → think again, until the goal is reached.

Key terms

AI agent
Software that uses an AI model to pursue a goal over several steps, often using tools.
Tool
A function the agent can call, e.g. search, calculator, send email.
Agent loop
Repeat: reason, act, observe — until done.
Autonomy
How much an agent can do without asking a human.

Spot the agent

Watch how a homework-planner agent handles one request.

  1. 11. Goal: 'Plan my revision for Friday's science test.'
  2. 22. Think: I need the test topics and the student's free time.
  3. 33. Act: Calls the calendar tool → finds free slots Mon–Thu.
  4. 44. Observe: Four 45-minute slots available.
  5. 55. Finish: Creates a plan: one topic per slot, a practice quiz on Thursday.

The agent loop in pseudocode

pythongoal = "Plan my revision"
while not done:
    thought = model.think(goal, history)
    if thought.wants_tool:
        result = tools[thought.tool](thought.input)
        history.append(result)
    else:
        done = True
        print(thought.answer)

The model decides; your code runs the tools and feeds results back in.

Try it

Put the agent loop in order

  • 1Give the final answer
  • 2Call a tool
  • 3Receive a goal
  • 4Reason about the next step
  • 5Observe the result

Challenge

Pick a task at school or home and describe an agent that could help: its goal, two tools it would need, and one thing it should NEVER do alone.

Pick whichever way suits you — every mode earns the same bonus XP.

Write at least 40 more characters to submit.

Mark your own work

Guided walkthrough — 0/2 clues revealed

  1. Clue 1 locked — reveal it only if you get stuck.
  2. Clue 2 locked — reveal it only if you get stuck.

Each clue costs 3 XP (never below 13 XP). You'd earn 25 XP right now.

Quiz time

Question 1 of 2Score 0

What makes an agent different from a basic chatbot?