What Are AI Agents, Really? A Plain-English Guide (With Working Code)
A no-BS guide to how AI agents actually work - with working Python code you can run today.
TL;DR:
What AI agents are: Not sentient robots, not AGI - just a simple formula: Brain (an LLM like Claude) + Hands (tools like search or a calculator) + Loop (the ability to keep trying until the job is done).
How AI agents work vs. chatbots: The difference isn't tools - modern chatbots like Claude already use them. It's who drives the loop: with a chatbot, you prompt every step. An agent takes a goal, chains its own steps, checks its own work, and finishes the task without you prompting it each time.
When you actually need one: Use Claude for quick answers. Build a custom AI agent when you want to automate a multi-step process using your own data - something that runs in the background while you sleep.
Welcome👋🏻
I am a Software Engineer with 10+ years of experience. My goal is to close the gap between the technical and the non-technical, making AI accessible to everyone, regardless of their background.
Everyone’s talking about AI agents. Your LinkedIn feed is likely drowning in posts about “autonomous AI agents that will replace your entire team.” VCs are throwing money at anything with the word “agent” in the pitch deck. Every second tutorial starts with: “In this revolutionary guide...”
Let me save you some time: An AI agent is not magic.
It’s not “AGI” (Artificial General Intelligence). It’s not a some sort of a robot living in your cloud drive. And despite the hype, it’s not going to replace your entire department by Tuesday.
At its core, an AI agent is just three things: a brain, a set of tools, and a loop.
That’s it. Once you understand this simple recipe, 90% of the hype evaporates, and you’re left with something actually useful.
You're Already Using AI Agents (And Didn't Know It)
If you ask a modern AI like Claude, “What’s the weather in Amsterdam?” it will give you a real-time answer.
But here’s the secret: The AI doesn’t actually “know” the weather. That information wasn’t in its original training data. To give you that answer, the AI has to stop being a “chatbot” for a second and act like an agent.
Here is what’s happening under the hood:
The Prompt:
what is the current weather in Amsterdam? show me your thinking processAnswer:
Thinking process:
- Tool selection — Weather is real-time data that changes constantly, so I can't rely on my training knowledge. I used the weather_fetch tool with Amsterdam's coordinates (52.3676°N, 4.9041°E).
- Unit conversion — The API returned temperature in Fahrenheit (52.9°F). Since you're based in Amsterdam, I converted to Celsius: (52.9 - 32) × 5/9 ≈ 11.6°C.
- Data interpretation — The response included current conditions + a 5-day forecast. I surfaced the most relevant bits: current temp, sky condition, and notable changes ahead.
Result: It's currently sunny, ~11.6°C in Amsterdam. The week stays mild (around 13°C highs), with rain probability picking up on Wednesday (~40%).The difference is this: A “Standard” AI is like a library. It’s a massive collection of books. It can tell you what’s inthe books, but it can’t leave the building.
An AI Agent is the librarian who can actually walk out the front door, check the mail, make a phone call, and come back with an answer that isn’t in any of the books.
When you see an AI “browsing the web” or “checking a live price,” you aren’t just seeing a smarter chat, you are seeing an agent in action.
The Three Ingredients Every AI Agent Needs: Brain, Hands, Loop
Every agent, from a simple calendar bot to a complex coding assistant, is built from the same three pieces:
The Brain (The Language Model): Your Agent's Reasoning Engine
This is the “thinking” part (like Claude or Gemini). It reads your request and decides what to do. Its key skill is reasoning. You tell the AI, “You have access to these tools,” and it figures out which one to grab and when.
The Hands (The Tools): What Your Agent Can Actually Do
Without tools, an AI is just a brain in a jar. Tools are things the AI can actually do: search the web, read a spreadsheet, send an email, or check a database. The more tools you give it, the more “capable” it becomes.
The Loop (The Autonomy): What Makes It an Agent
This is what makes it an agent. The loop allows the AI to say: “Okay, I finished Step 1. Does the answer look right? No? Let me try Step 2.” It keeps going until the task is complete.
Brain + Hands + Loop = Agent. That’s the formula.
How to Build an AI Agent in Python (30 Lines of Code)
Enough theory. Let’s build a “Date & Deadline Agent.” It will be able to check today’s date and calculate exactly how many days are left until a specific deadline.
Even if you aren’t a developer, look at the code below. You’ll see it reads almost like English.
What you’ll need:
Python installed.
An Anthropic API key (from
console.anthropic.com).In your terminal, run:
pip install pydantic-ai
Create a file called my_agent.py to give the AI its instructions in VS Code and paste this in:
Do you want me to explain this part in more detail? Let me know in the comments!
from pydantic_ai import Agent
from dotenv import load_dotenv
import datetime
load_dotenv() # Pulls your API key from a .env file
# 1. THE BRAIN: Give it a model and a personality
agent = Agent(
model="anthropic:claude-sonnet-4-5",
system_prompt="You are a helpful assistant. Use the available tools when you need current information."
)
# 2. THE HANDS: Define what the agent can actually DO
@agent.tool_plain
def get_current_time() -> str:
"""Returns the current date and time."""
return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@agent.tool_plain
def calculate_days_until(target_date: str) -> str:
"""Calculates days until a date (format: YYYY-MM-DD)."""
target = datetime.datetime.strptime(target_date, "%Y-%m-%d")
delta = target - datetime.datetime.now()
return f"{delta.days} days until {target_date}"
# 3. THE RUN: Give it a task and let the loop take over
result = agent.run_sync(
"What is today's date, and how many days until 2026-12-31?"
)
print(result.output)When you run the code above, you will see a result like this:
Today's date is **March 8, 2026**, and there are **297 days** until December 31, 2026.What just happened?
You didn't tell the agent which tool to use first. You just gave it a goal. The "Brain" saw your question, realized it didn't know the date, used the "get_current_time" tool, then used the "calculate_days_until" tool, and finally summarized the answer for you.
What AI Agents Can't Do: Cutting Through the Myths
Now that you’ve seen the “engine,” let’s kill some common myths:
“Agents think for themselves.” Not really. They are pattern-matching engines with superpowers. They don’t have “desires”; they just follow the loop you set up.
“Agents are dangerous.” An agent is only as powerful as the tools you give it. If you give it a calculator, it can do math. If you give it your credit card and a login to Amazon... well, that’s on you. You set the boundaries.
“I need to be a genius to use them.” If you can follow a recipe, you can build an agent. The ecosystem is getting simpler every single day.
AI Agent vs. Claude: When Do You Actually Need One?
If Claude and Gemini can already check the weather, search the web, and run code, why do you need to know how to build your own?
Think of it like the difference between a Smartphone and a Smart Home System.
1. Use the “Built-in” AI (The Smartphone) when:
You have a one-off question (”What’s the best flight to Tokyo?”).
You need a quick summary or a brainstorm session.
You’re using tools manually - you open the app, you take the photo, you send the text.
The Vibe: “I just need a quick assist while I’m at the controls.”
2. Build a Custom Agent (The Smart Home) when:
It needs to follow “Your Rules”: A smart home doesn’t just have a lightbulb; it knows to turn that light on only when you walk into the room after 6:00 PM. A custom agent follows your specific business logic.
It needs to be “Always-On”: You want something running in the background - monitoring your emails, updating a spreadsheet, and pining your Slack - without you having to manually prompt it every ten minutes.
It needs to connect “Hidden” Data: You want the AI to look at your private project files or your specific customer history, not just the general internet.
The Vibe: “I want to build a system that works for me while I sleep.”
The Rule of Thumb: If you are the one typing every step and waiting for the answer, a regular AI chat is perfect. The moment you want the AI to orchestrate a process - connecting different apps and making decisions based on your specific “house rules”; that’s when you need a custom agent.
Which part clicked for you? Or which part still feels fuzzy? Drop it below; your question might be the next article!
PS: If you're new here and wondering why a software engineer is writing about all this - here's why I started Becoming with AI."



Loved the way you explained it!
Great explanation from a tech person 👏🏼