Agents: AI that takes action
Lesson 17 of 23 in the course “AI basics”. Free, with animations and a quiz.
It doesn't just answer, it acts
A regular chat writes text, and then you do the rest. An agent is a model that has been given tools, meaning programs it can run by itself: search, a calculator, running code, a calendar. Example for this whole lesson: “Find a train to the beach this weekend for the four of us, work out how much each person pays, and add the trip to my calendar.” The agent does it step by step.
How the model calls a tool
Example: tickets for four cost $240. The model doesn't press any buttons itself. It writes a special request: “calculator: 240 / 4”. The app runs the tool and puts the result back in the chat: 60. The model reads it and writes: “$60 per person”. Why bother: the model is weak at exact math and fresh facts, while a calculator and search are reliable at exactly that.
The loop: think, act, look
An agent works in a loop. It thinks: what should happen next. It acts: it calls a tool. It looks at the result. It decides: is the task done, or is another round needed. Example: it searches for Saturday trains, sees they're sold out, decides to try Sunday, finds one, works out the price and adds the trip to the calendar. Every new round builds on what the agent saw in the last one.
Mistakes add up
The trap is that each step builds on the one before. If the agent mixes up two towns with similar names, everything after is wrong: prices, times, the calendar entry. Example: if each step is right 9 times out of 10, five steps in a row are all right with a chance of 0.9 × 0.9 × 0.9 × 0.9 × 0.9 ≈ 0.59, so about 6 times out of 10. So watch the steps and correct it along the way.
Safety rules for agents
Money, messages, deleting things: only after your “yes”. Let the agent first show you what it's about to buy or send, and you confirm. Give narrow permissions, meaning access only to what the task needs. Example: the calendar is fine, your bank card and your whole inbox are not. Texts on websites the agent reads can also be traps: more on that in the safety lesson.
Check yourself
- What is a tool for an AI agent?
Correct answer: A program the model can run: search, a calculator, code. The model writes a request, the app runs the program and returns the result. That's how an agent does exact math and gets fresh data. - Why do an agent's mistakes pile up?
Correct answer: Each step builds on the last, so an early mistake carries on. Example: a step is right 9 times out of 10, but five such steps in a row are all right only about 6 times out of 10. So long tasks need checking. - The agent found tickets and is ready to buy them. What's the right way?
Correct answer: Have it show you the purchase, and you confirm it. Actions with money, messages and deleting are confirmed by you alone. Undoing a purchase later is harder than not making it.
← Images, voice, video Safety: your data and prompt injection →