What Is an AI Agent, Really?
A chatbot talks. An agent does. Here's the simple loop that turns a language model into something that gets work done.
More Than a Chatbot
A chatbot is a thing you ask a question and it answers. It waits for you to type, replies, and stops. An AI agent is different. You give it a goal — "book me a flight to Toronto under $400" — and it figures out the steps, uses tools, and keeps going until the job is done or it runs into something it can't solve.
Under the hood, an agent is just a large language model (the "brain") wrapped in a loop. The loop lets the model look at what's happening, decide what to do, take an action, check the result, and decide whether to keep going. The same model that powers a chatbot can power an agent — what changes is the loop around it.
Think of it this way: a chatbot is a calculator. An agent is a personal assistant. Both are useful — but the assistant can run a whole chain of tasks while you do something else.
Work That Chains Together
Most real work isn't one big task — it's a chain of small ones. Research a topic, summarize it, draft an email, send the email, log it in a spreadsheet. A human does those steps one at a time. A chatbot can help with one step. An agent can run the whole chain, end to end.
That's why companies are rushing to build them. Customer support agents answer questions and update tickets. Coding agents read files, write code, run tests, and fix bugs. Research agents browse the web, gather sources, and write reports. Marketing agents check analytics, draft posts, and schedule them. The list keeps growing.
For regular people, agents mean less time on busywork. Tell an agent to plan a week's meals around what you already have in the fridge, and it can check recipes, build a list, and add ingredients to your grocery order — without you babysitting each step.
💡 Key Insight
The same LLM that powers a chatbot becomes ten times more useful when you give it three things: a goal, a set of tools, and a loop that lets it keep trying until the goal is met. That's the whole trick.
The Agent Loop in Four Steps
Every agent, no matter how fancy, runs on a small loop. The model looks at what's going on, decides what to do, does it, and checks the result. If the goal isn't met yet, it loops back and tries again. If it is met, it stops.
Here's the loop in plain English:
The "tools" are the secret sauce. An agent is nothing without them. Tools are how it touches the real world — running a search, calling an API, writing a file, sending an email, executing code. The LLM doesn't do any of those things itself. It just picks which tool to use and reads back the result.
A Tiny Agent in Python
Here's the simplest possible agent you can build. The LLM is just a function we call decide(). In real life, that function would call out to GPT, Claude, or any other model. The agent loop feeds it context and lets it pick a tool — over and over, until the goal is done.
# A minimal agent loop — observe, think, act, check def run_agent(goal, tools): history = [] while True: # 1. Observe — give the model everything it knows context = { "goal": goal, "history": history, "tools": [t.name for t in tools], } # 2. Think — ask the LLM what to do next decision = llm.decide(context) # If the model says "I'm done", stop the loop if decision["action"] == "finish": return decision["answer"] # 3. Act — run the chosen tool with its arguments tool = find_tool(tools, decision["tool"]) result = tool.run(**decision["args"]) # 4. Check — remember what happened, then loop back history.append({ "action": decision, "result": result, }) # Example: ask the agent to look up a fact tools = [web_search, read_page, send_email] answer = run_agent( goal="What year was the Eiffel Tower built?", tools=tools, )
That's the whole idea. The model reads context, picks a tool, reads the tool's output, and repeats. The loop is what turns a "thing that talks" into a "thing that does."
Knowledge Check
Test what you learned with this quick quiz.