Start here
What is an AI agent?
If you’re new to this, start with one idea and let everything else hang off it: an agent is software that decides its own next step. That’s it. The rest is detail.
The loop
A plain program runs the steps you wrote, in the order you wrote them. An agent runs a loop, and the model is in charge of the loop:
$while not done:
- 1. look at the situation (context + memory)
- 2. decide what to do next
- 3. call a tool to act on the world
- 4. observe the result
- 5. repeat
## the model chooses steps 2–3 every time. you don’t.
Agent vs workflow
The most common early mistake is calling everything an “agent.” Most useful AI software is actually a workflow: a fixed chain of steps that may call a model along the way, but where you own the control flow. Workflows are predictable and easy to test.
Reach for a true agent only when the path genuinely can’t be known in advance — when the right next step depends on what the previous step turned up. Agents are more capable and harder to predict. Choosing correctly here saves you weeks.
Workflow
Fixed steps. You decide the path. Predictable, testable, boring in the best way.
Agent
The model decides the path at runtime, in a loop, using tools and memory. Powerful, less predictable.
The four primitives
Whichever way you end up building, every agent is cut from the same four pieces:
- 01The model
- The reasoning engine. It reads context and decides what to do next. Everything else exists to feed it the right input and act on its output.
- 02Tools
- Functions the model can call to act on the world: search, run code, hit an API, read a file. Good tools are the difference between a chatbot and an agent.
- 03Memory
- What the agent carries between steps and sessions. Conversation history, summaries, retrieved facts. Without it, every turn starts from zero.
- 04Prompting
- The system prompt is code. It sets the agent’s role, rules, and how it should use its tools. Treat it with the same rigor as the rest of your stack.
So how do you build one?
That’s the next decision, and there are four honest answers. The right one depends on where ownership should sit — not on what sounds most advanced.