← ELI5 · Nestor G Pestelos Jr

How Do AI Agents Work?

From a brain in a jar that only talks, to a robot with hands that gets things done.

Card 1 of 6

A Brain in a Jar vs. A Robot with Hands

A regular AI chatbot is like a brain in a jar. You ask it a question, it thinks for a few seconds, talks back to you, and goes to sleep. It cannot open a browser, click a button, or edit a file for you.

An AI Agent is that same brain, but given eyes to inspect the screen and hands to use tools. Instead of just talking about the work, it actually does it.

💬 Chatbot
"Here are 5 steps to fix your computer..."
🤖 Agent
"I opened terminal, fixed the error, ran tests, and verified it works."
Why this matters
Chatbots produce text for a human to read and act upon. Agents take actions on external systems (filesystems, databases, APIs) and verify the outcome themselves.
Card 2 of 6

The 4-Step Loop: Look, Think, Act, Check

An agent doesn't guess everything at once. It works in a continuous circle called the Agent Loop:

👀 1. Look
Read screen & files
🧠 2. Think
Plan the next move
🛠️ 3. Act
Run a command
🔍 4. Check
Did it work?

Repeat until the entire mission is completed!

If Step 4 finds a compiler error or broken link, the agent doesn't panic. It looks at the error message, figures out why it failed, and tries a new fix in the next turn.

Technical name
Computer scientists call this the ReAct (Reason + Act) loop or an OODA (Observe-Orient-Decide-Act) cycle.
Card 3 of 6

The Tool Belt: How the Brain Touches the World

How does a software program use tools? Whenever the AI decides to act, it emits a structured request (like ordering a dish at a restaurant). The harness computer executes the command and hands the result back.

🔍 Web Search
Fetch latest documentation
💻 Terminal / Shell
Run tests, build code
📝 File Editor
Read and patch files
🌐 APIs & DBs
Query live data
How it works under the hood
Tools are defined using JSON Schema (e.g., Model Context Protocol / MCP). The LLM outputs a JSON payload specifying the tool name and exact parameters.
Card 4 of 6

The Sticky Note vs. The Filing Cabinet

AI models have limited attention spans. If you dump 5,000 pages into their head, they get confused. Agents use two kinds of memory to stay smart:

📌 Sticky Note (Working Memory)
What we are doing right now in this chat turn. Fast, but resets when full.
🗄️ Filing Cabinet (Long-term Store)
Vault notes, past memories, and documentation searched only when needed.
Why memory matters
Without memory tiers, chat history quickly becomes "contaminated" with giant error logs, degrading the agent's reasoning. Long-term memory allows persistent learning across days and weeks.
Card 5 of 6

A Team of Robot Specialists

One agent trying to do everything alone gets overwhelmed. Instead, modern systems spawn a team of mini-agents:

👑 Orchestrator Agent (Manager)

Reads the user goal, writes the blueprint, and assigns tasks.

🔎 Research Agent
Scans repos & web
⚙️ Coder Agent
Writes clean code
🛡️ Reviewer Agent
Hunts for bugs
Why multi-agent works
Each subagent starts with a fresh, clean context window focused strictly on its sub-task, eliminating distractions and memory limits.
Card 6 of 6

Safety: What Stops the Runaway Robot?

What happens if an agent gets confused and runs in circles, or accidentally tries to delete a database?

🛑 Loop Breaker: Stops the agent if it repeats the same error 3 times.
📦 Sandbox: Keeps the agent in a walled playpen so it can't harm the real machine.
🙋 Human Gate: Asks you before running dangerous or irreversible commands.
The Golden Rule of Agents
The human stays in the architect and approval seat. The agents do the heavy lifting, but the human decides the destination.