AI Agents: Start Here
After this lesson, you will be able to:
- Say the difference between a chatbot that answers and an agent that acts
- Tell a fixed recipe (a workflow) from an agent by asking who chooses the next step
- Name the five parts of an agent: brain, loop, hands, notebook and goal
- Run a small agent by hand on paper and say what it saw and chose at each step
- Decide when a plain recipe is a better choice than an agent
#Answering Versus Doing
In one sentence: a chatbot writes an answer, and an agent uses tools, reads what comes back and keeps going until the goal is done.
#A Recipe or a Decider
Now picture a cook with no card, only a goal: "feed six guests with what is in the fridge." This cook looks, decides, cooks one thing, tastes it, and decides again. If there is no rice, the plan changes. That is an agent: the program itself chooses the next step, using what it has seen so far.
Neither one is better in every case. The recipe is cheaper, faster and easier to check. The agent can handle jobs where you cannot list the steps in advance, because the right steps depend on what turns up along the way.
Every morning you want three article titles turned into a short email with the same layout. Which system fits best?
In one sentence: if you can write the steps on a card before you start, build a recipe; if the next step depends on what turns up, an agent may be worth it.
#The Five Parts
Every agent, from a toy to a large product, is built from the same five parts. Think of a helpful intern.
- Brain. The language model, often shortened to LLM (large language model). It reads the situation and decides what to do next. It is the part that thinks.
- Loop. The repeat. The agent does not answer once and stop. It goes round again and again: look, decide, act, look at the result. The loop is what makes it keep going.
- Hands. The tools. A calendar, a search box, a calculator. Without hands the intern can only talk.
- Notebook. The memory. The notes of what has been tried and what came back. Without a notebook the intern forgets the last step and repeats it.
- Goal. The job to be done, in plain words. Without a goal the loop has no reason to stop or to start.
Read the picture as a circle. The brain picks an action, the tool does it, the result goes into the notebook, and the brain reads the notebook before it picks again. The circle repeats until the brain decides the goal is met, or until a limit stops it.
An intern has a goal, a notebook and a phone to call people, but no loop. They make one call and write one note, then stop. What do you have?
In one sentence: an agent is a brain, a loop, hands, a notebook and a goal, and remove any one of them and you get something less than an agent.
#Run an Agent on Paper
The goal is: "Book a room for 4 people on Friday at 3 pm." The sample rooms below are made up for the exercise.
| Round | Think | Act (tool and input) | Observe |
|---|---|---|---|
| 1 | I need to know which rooms are free. | check_rooms("Friday 3pm") | Room A (2 seats) and Room B (6 seats) are free. |
| 2 | Room A is too small. Room B fits 4. Book B. | book("Room B") | Failed: Room B was just taken. |
| 3 | The plan failed. Look at the calendar again. | check_rooms("Friday 3pm") | Room C (8 seats) is free. |
| 4 | Room C fits 4. Book C. | book("Room C") | Booked: Room C. |
| 5 | The goal is met. Tell the user. | none | Final answer: "Room C is booked for Friday at 3 pm." |
Count what happened: 5 rounds, 4 tool calls, and 1 failure that the agent recovered from. A fixed recipe of "check, then book the first big enough room" would have stopped at round 2 with an error. Round 3 is the whole point of an agent: the failed result changed what it did next.
Notice also what the notebook held at round 4. It contained the first check, the failed booking and the second check. The brain used all three to choose Room C. Take away the notebook and it might try Room B again.
At round 2 the booking fails because Room B was just taken. What should an agent do next?
Now watch a drawn version of the same loop. It uses made-up example tasks and fixed scripted steps. It is not a real model.
Do: Choose the Weather Lookup task. Step forward one frame at a time and read the title of each frame before you advance.Notice: The phase names repeat: observe, think, plan, act, then observe again. The loop goes round more than once, and each tool result is the input to the next think.Why: The repeat is what separates an agent from a single question and answer. Drawn stand-in with scripted steps, not a trained model.
In one sentence: each round is think, act, observe, and the observation feeds the next round, so a failure can change the plan.
#Know When Not to Use One
An agent has a cost that a recipe does not. Every round uses the brain again, so more rounds mean more time and more money. And the rounds can go wrong in ways a recipe cannot.
Here is the sum that matters. Suppose each round is right 9 times out of 10. The chance that all 5 rounds are right is 0.9 multiplied by itself 5 times, which is 0.59049. That is about 59 times in 100. A task with 10 rounds falls to about 35 in 100. Small mistakes pile up as the loop gets longer. This is why builders keep agents short and add checks.
Three things commonly go wrong:
- It never stops. Confused, the agent keeps calling tools and spending. The cure is the step limit, plus a rule that it must give an answer or ask for help when the limit is reached.
- It picks the wrong tool, or a good tool with the wrong input. The cure is clear tool descriptions and returning a plain error message as the observation, so the brain can fix its mistake.
- It does something you did not want. An agent with a "send email" tool can send an email. The cure is to give it only the tools it needs, and to ask a person before any action that cannot be undone.
In one sentence: agents cost more and fail in more ways than recipes, so use one only when the next step depends on what you just saw, and always give it a step limit.
#Where to Go Next
You now have the words and a picture. The next lessons make them real.
- Next, in code: Your First Agent Loop. You will write the loop above in plain Python with a scripted stand-in for the brain, and run it in your browser.
- A deeper look at the same ideas: Agent Fundamentals, which assumes you know how language models work.
- If words like "token" or "prompt" are new: read GPT and Decoders and Prompt Engineering first.
- If you want to see why a model can make things up: Why AI Makes Things Up.
This track has levels. This is Level 0, Start here. Foundations, Core, Advanced and Expert follow.
In one sentence: read Your First Agent Loop next to see these ideas as a short, running program.
A program that reads your words and writes words back. It does not use tools or act on its own.
A program that works towards a goal by choosing actions, using tools and reading the results, in a loop.
A program whose steps and their order are fixed in advance by the person who built it.
A small piece of ordinary software, such as a calendar lookup or a calculator, that an agent is allowed to use.
The repeat of think, act, observe until the goal is met or a limit is reached.
What a tool sent back after the agent used it.
Short for large language model: the program that reads text and writes text, used as the agent's brain.
A number that stops the loop after that many rounds, so a confused agent cannot run for ever.
#Key Takeaways
- A chatbot writes an answer. An agent uses tools, reads what comes back and keeps going until the goal is done
- Ask who chooses the next step: the builder in advance means a workflow, the model while running means an agent
- The five parts are brain, loop, hands, notebook and goal, and none of them can be dropped
- One round is think, act, observe, and a failed result can change the next plan
- Agents cost more and compound small mistakes, so start with the plainest tool and always set a step limit
#Quick Check
What is the clearest difference between a workflow and an agent?