What Is an AI Agent? The Think-Act-Observe Loop
You have probably chatted with an AI model: you type a question, it types an answer, done. An AI agent is one step beyond that. Instead of just answering, the model is allowed to take an action in the world, look at what happened, and decide what to do next. It keeps going until the job is finished.
That small change is what turns a chatbot into an assistant that can actually get something done for you, like looking up a fact, doing a calculation, or checking the weather before it answers.
In this short course you will build a tiny but real agent in Python from scratch. No big framework, no jargon. By the end you will understand the one pattern that every agent (and every agent framework) is built on.
What You'll Learn
- The difference between a plain chatbot and an agent
- The think-act-observe loop, the core idea behind every agent
- The ReAct pattern in plain English
- Why a "tool" is just a function the model is allowed to ask for
A chatbot answers; an agent acts
Picture asking, "What is 4,891 times 736?" A plain language model will try to answer from memory and may get it slightly wrong, because it is predicting text, not running a calculator.
An agent handles it differently. It thinks, "I should use a calculator for this," asks for the calculator tool, reads the exact result, and then gives you the answer. It used an action to get a fact it could trust.
The thing the agent is allowed to use, the calculator here, is called a tool. A tool is simply a function you write that the model is permitted to ask you to run on its behalf. We will build one in Module 2.
The loop at the heart of every agent
Every agent runs the same simple cycle, over and over, until the task is done:
- ThinkDecide the next step
- ActCall a tool
- ObserveRead the result
- Repeat or finishLoop until done
Read it as a sentence: the model thinks about what to do, acts by calling a tool, observes the result that comes back, then loops, thinking again with that new information. When it has everything it needs, it stops looping and writes the final answer.
That is the whole idea. A weather agent, a research helper, a coding assistant, and a giant autonomous system all run this exact loop. The fancy ones just have more tools and more turns around the circle.
The ReAct pattern, in plain English
You will often hear this loop called the ReAct pattern. The name is just Reasoning plus Acting stuck together. It describes an agent that alternates between reasoning ("I need the current price, so I should search") and acting (actually running the search), using each observation to inform the next thought.
Before ReAct, people tried to make a model reason through a whole problem in one shot. The insight of ReAct is that letting the model take a real action and then react to the real result is far more reliable than asking it to imagine the result. Your agent does not have to guess what the weather is; it can go and check.
You do not need to memorize the term. Just remember the rhythm: reason, act, observe, repeat.
Why this matters for what you build
Because the loop is so simple, you can build a useful agent without any special library. Everything you will write in this course is plain Python plus one call to an AI model. The frameworks you may have heard of, like LangChain or CrewAI, are convenience wrappers around this same loop. Understanding the loop first means those frameworks will make sense later instead of feeling like magic.
It also means you can build an agent for your situation: a study helper that looks things up for you, a small research assistant, or a task automator for a chore you repeat. You are not learning to become an "agent engineer." You are learning a pattern you can point at your own work.
A concrete example to keep in mind
For the rest of the course we will build a small research helper: an agent that can answer questions and, when it needs a fact it cannot reliably know, calls a tool to fetch it. We will start with a calculator tool because it is easy to verify, then you will see how to swap in any tool you like.
Here is the shape of a single turn, told as a story:
- You ask: "If I save 35 dollars a week, how much is that in a year?"
- The model thinks: "I should multiply 35 by 52 with the calculator rather than guess."
- The model acts: it asks to run
calculator("35 * 52"). - Your code observes: it runs the function, gets
1820, and hands that back. - The model finishes: "Saving 35 dollars a week comes to 1,820 dollars a year."
Notice that your code did the actual running of the tool. The model only asked for it. That division of labor, the model decides, your code executes, is the key safety idea we will return to.
Key Takeaways
- A chatbot answers from memory; an agent can take actions, observe results, and continue until the task is done.
- Every agent runs the same think-act-observe loop, repeated until it has what it needs.
- The ReAct pattern is just reasoning and acting in turns: reason, act, observe, repeat.
- A tool is a normal function the model is allowed to ask your code to run.
- The model decides which tool to use; your code is what actually runs it. This split is what keeps you in control.

