Lesson 8 of 13

AI that takes actions

A chat assistant writes replies. An agent also acts, searching, editing files, sending email. Play the program around one and see who really acts, why it should ask you first, and what goes wrong.

Novice12 min

Builds on How a chatbot writes and What AI gets wrong

In this lesson you will

  • Tell a chat assistant apart from an agent that takes actions
  • Explain that the model only proposes actions, and ordinary software carries them out
  • Decide which actions deserve a question before they run, and why
  • Recognize two ways an agent goes wrong, honest mistakes and instructions hidden in what it reads

Ask a chatbot to “book a table for Thursday and tell Sam”, and it can write you a polite message to send. Ask an AI agent, and it can try to do the booking and send the message itself. That difference sounds small. It changes who is responsible for each step, and it changes what can go wrong.

Talking versus doing

In the lesson on how a chatbot writes, you saw that a language model does one thing: it continues text, one piece at a time. A chat assistant shows you that text. You read it and decide what to do.

An AgentA system that runs a language model in a loop with tools, letting it take several steps, observe results, and decide what to do next toward a goal. Definitions vary in how much autonomy they imply.Taught in Models that use toolsOpen in glossary uses the same kind of model, but some of the text it writes is a request for an action: “look at the calendar”, “book this table”, “send this email”. A program around the model reads each request, carries it out if it is allowed, and gives the model the result. Then the model writes its next request. Round and round, until the job is done.

What agents can do today

Products change fast, so treat this as a snapshot from October 2026, from each company’s own documentation:

  • Search and read the web. Many chat assistants can now search, open pages, and quote what they find before they answer.
  • Work on software. Coding agents such as Claude Code, OpenAI Codex, and Gemini CLI read and edit the files in a project and run commands, such as the project’s tests, on your computer or a cloud machine.
  • Operate a computer. Some agents work a screen the way you do. Anthropic’s computer use, released as a beta in October 2024, lets a model look at screenshots, move the pointer, click, and type. OpenAI announced ChatGPT agent in July 2025, describing it as working on its own virtual computer and asking permission before actions of consequence.

None of these is perfect. Anthropic called computer use “experimental” and “at times cumbersome and error-prone” when it launched it.

Who actually does it

Here is the part people most often get wrong. The model never acts. It writes a proposal. Software runs it, or does not. You are going to be that software.

In the demo, a scripted assistant (no real model runs) works through a dinner booking for you. Each time it proposes an action, the program either runs it or asks you first, depending on the setting. The pretend world on the right changes only when an action actually runs.

Approve or deny

You are the program around an assistant. It proposes actions; nothing happens unless the program runs them.

Your requestFind an evening next week when Sam and I are both free, book a table for two at Luigi's, and let Sam know.

  1. Assistant (scripted)

    First I'll check your calendar for next week.

    Wants to: Look at your calendar for next week Looks only

Allow the assistant to do this?

Look at your calendar for next week

Looks only

The world (pretend)

Calendar, next week
Free Tuesday and Thursday evenings
Bank account
$600
Bookings
None
Emails sent
None
Ask me before
Questions you answered0
Money spent$0
StatusWaiting for your answer

Challenges

0 of 4 complete

  1. Get the table booked and the right Sam told, without spending any money. (not yet)
  2. Stop the assistant from acting on an instruction it read on a web page. (not yet)
  3. Finish safely while answering as few questions as possible. (not yet)
  4. Let it run with no questions at all, then compare its final message with what actually happened. (not yet)

Try this

  • With Ask me before set to Every action, step through and read each proposal before you answer. Look closely at the email search: there are two people called Sam.
  • When the assistant asks to pay $180, ask yourself: did you request that? Find where the idea came from by reading the result of the step before.
  • Switch to Only changes. Looking at the calendar and the web page now run without a question. Count how many questions are left.
  • Switch to Nothing and press Skip ahead. Compare the assistant’s final message with the world panel.
The program decides what runsPython with the standard library
# The assistant's proposals, written out by hand. In a real agent,
# a language model would write each one after reading the results so far.
PROPOSALS = [
    ("look_at_calendar", "next week"),
    ("book_table", "Luigi's, Thursday 7 pm"),
    ("pay", 180),                              # asked for by text hidden on a web page
    ("send_email", "[email protected]"),   # the wrong Sam
]
LOOKS_ONLY = {"look_at_calendar"}

def run_errand(ask_person):
    world = {"money": 600, "booking": None, "emails_sent": []}
    for action, value in PROPOSALS:
        # The program, not the model, decides whether an action runs.
        if action not in LOOKS_ONLY and not ask_person(action, value):
            print(f"  skipped {action}: {value}")
            continue
        if action == "book_table":
            world["booking"] = value
        elif action == "pay":
            world["money"] -= value
        elif action == "send_email":
            world["emails_sent"].append(value)
        print(f"  ran {action}: {value}")
    print(f"  afterwards: {world}")

print("Never asking:")
run_errand(lambda action, value: True)

print("Asking, and saying no to payments and to the wrong Sam:")
run_errand(lambda action, value: action != "pay" and value != "[email protected]")
Never asking:
  ran look_at_calendar: next week
  ran book_table: Luigi's, Thursday 7 pm
  ran pay: 180
  ran send_email: [email protected]
  afterwards: {'money': 420, 'booking': "Luigi's, Thursday 7 pm", 'emails_sent': ['[email protected]']}
Asking, and saying no to payments and to the wrong Sam:
  ran look_at_calendar: next week
  ran book_table: Luigi's, Thursday 7 pm
  skipped pay: 180
  skipped send_email: [email protected]
  afterwards: {'money': 600, 'booking': "Luigi's, Thursday 7 pm", 'emails_sent': []}

You just played the role of an agent’s program, which people who build agents call the harness. The assistant could propose anything it liked. Nothing happened in the world unless the program ran it, and the program ran it only if its rules, or you, said yes.

Why good agents ask first

Not every action needs a question. Two things decide how risky an action is:

  • Does it only look, or does it change something? Reading a calendar or a web page leaves the world as it was. Booking, paying, and sending change it.
  • Can the change be taken back? A booking that is free to cancel can be undone. A payment or a sent email cannot.

A sensible program lets looking happen freely and asks before changes, especially ones that cannot be undone. That is what Only changes did: four questions instead of seven, and nothing slipped through. Ask too often and the questions become noise you approve without reading. Ask too rarely and mistakes reach the world.

What can go wrong

Honest mistakes. The assistant picked the most recent email from someone called Sam, which was the wrong Sam. Models make mistakes for the reasons you saw in the last lesson. In a chat, a mistake is a wrong sentence you can ignore. In an agent, a mistake can become an action.

Instructions hidden in what it reads. The restaurant’s page had text hidden in it, addressed to AI assistants, telling them to pay a deposit. The assistant reads everything as text, and it has no reliable way to tell your instructions from instructions planted in a web page, an email, or a document. This attack is called Prompt injectionAn attack in which text a model reads changes what it does against its developer's intent. Direct injection comes from the person typing; indirect injection hides in what the model reads, such as a web page, email, picture, or memory.Taught in Prompt injectionOpen in glossary, and no current model is reliably immune to it.

Reports that do not match what happened. With no questions asked, the assistant ended by saying it had let Sam know. It had emailed a different Sam and spent $180. What an agent says it did and what it did can differ. The record of actions is what counts.

There is much more to how agents are built. The frontiers track covers the loop between the model and its tools in detail (models that use tools), and everything else a real agent’s program handles, from permissions to memory (inside an agent harness).

Key ideas

  • A chat assistant writes replies. An agent also requests actions, and a program around the model carries them out.
  • The model only proposes. The program, and the permissions you give it, decide what actually happens.
  • Looking is low risk. Changes that cannot be undone, like payments and sent messages, are where a question pays off.
  • Agents can act on honest mistakes and on instructions hidden in what they read, and their summaries can differ from what they did.

Check yourself

Pick an answer to see why it is right or wrong. Nothing is graded. Your first answer is saved in this browser so the question can come back for review.

1An AI assistant "sends an email for you". What actually sends it?
2Which action most deserves a question before it runs?
3In the demo, why did the assistant try to pay a deposit you never asked for?

Progress is saved in this browser only.

Up nextWhere your AI runs
Next
AI from zero
  1. 1What is AI, really?
  2. 2Turning things into numbers
  3. 3Getting less wrong
  4. 4The artificial neuron
  5. 5Networks of neurons
  6. 6How a chatbot writes
  7. 7What AI gets wrong
  8. 8AI that takes actions
  9. 9Where your AI runs
  10. 10Safety in AI products
  11. 11Open and closed models
  12. 12How AI sees, hears, and makes pictures
  13. 13When someone attacks an AI app

Try "embedding", "softmax", "overfitting", or "backpropagation".