AI agents are everywhere. Cursor writes your code. Perplexity researches for you. ChatGPT browses the web, runs Python, and books your calendar. Devin supposedly does the work of a junior developer.
They seem like magic. They're not.
Under the hood, these tools use the same five patterns. Once you understand them, you'll see how every AI agent actually works. No code required. No PhD needed.
Here's how they work.
What Makes an Agent "Agentic"?
First, a quick distinction.
A chatbot responds once. You ask, it answers, done.
An agent loops. It thinks, acts, observes the result, and adjusts. It keeps going until the task is complete.
The core loop looks like this: Perceive → Think → Act → Observe → Repeat.
An agent doesn't just generate text. It takes action in the world and adapts based on what happens. That's what makes it "agentic."
The five patterns below are the building blocks of that loop.
Pattern 1: Reflection
What it is: The agent reviews its own output and improves it before showing you the result.
Think of it like writing a first draft, then editing it yourself before hitting send. Most of us do this naturally. Agents can too.
How it works: The agent generates an initial response, then asks itself: "Is this correct? Is this complete? Can I do better?" If the answer is no, it revises and checks again.
Where you've seen it: Cursor generates code, then reviews it for bugs before presenting it to you. Claude can critique its own reasoning when asked to "think step by step." Coding agents run their code, see the error, and fix it automatically.
Why it matters: Catches mistakes without human intervention. The agent becomes its own editor.
One-liner: "Think twice, respond once."
Pattern 2: Tool Use
What it is: The agent decides which external tools to call: search engines, calculators, APIs, databases, code execution.
You don't memorize everything. You Google things. You use a calculator. You check your calendar. Agents do the same.
How it works: The agent recognizes when it needs information or capabilities it doesn't have. It selects the right tool, calls it, and uses the result to continue.
Where you've seen it: ChatGPT searching the web to answer a question about today's news. Perplexity pulling from multiple sources and citing them. Claude running Python code to do math. Any agent that "browses" a URL.
Why it matters: Without tools, agents are limited to what's in their training data. With tools, they can act in the real world.
One-liner: "Don't know it? Look it up. Can't do it? Use a tool."
Pattern 3: Planning
What it is: The agent breaks a complex task into subtasks before executing.
You don't build a house in one step. You create a plan: foundation first, then framing, then electrical, then plumbing. Agents handle complex tasks the same way.
How it works: Given a big goal, the agent first outlines the steps needed. Then it executes each step in order, adjusting the plan if something goes wrong.
Where you've seen it: "Book me a trip to Tokyo" becomes: search flights, compare prices, check hotel availability, check calendar conflicts, book both, send confirmation. Devin breaks "build this feature" into: understand requirements, write code, test it, fix bugs, submit PR.
Why it matters: Complex tasks become manageable steps. Without planning, agents get lost or miss steps.
One-liner: "Plan the work, then work the plan."
Pattern 4: Multi-Agent Collaboration
What it is: Multiple specialized agents work together, each handling a different role.
One person can't do everything well. A team works better: one researches, one writes, one reviews, one edits. Agents can be organized the same way.
How it works: Instead of one "super agent," you create several focused agents. A researcher agent finds information. A writer agent drafts content. A critic agent reviews and suggests improvements. An orchestrator coordinates them.
Where you've seen it: Devin uses separate agents for planning, coding, and testing. CrewAI lets you build teams of agents with defined roles. AutoGen creates multi-agent conversations where agents debate and refine ideas together.
Why it matters: Specialization beats generalization. A focused agent does its job better than a jack-of-all-trades.
One-liner: "Hire a team, not a hero."
Pattern 5: Memory
What it is: The agent remembers past interactions and context across sessions.
Imagine if every conversation with a colleague started from zero. "Hi, I'm Pranay, I work on the newsletter, we talked yesterday about..." Exhausting.
How it works: The agent stores relevant information from past conversations. When you return, it retrieves that context and picks up where you left off. Some memory is short-term (within a session), some is long-term (across sessions).
Where you've seen it: ChatGPT's memory feature remembering your preferences. Notion AI understanding your workspace because it has indexed your pages. Cursor knowing your codebase because it has embedded your files.
Why it matters: Without memory, every interaction starts cold. With memory, agents get more useful over time.
One-liner: "Remember yesterday, work smarter today."
How These Patterns Work Together
No agent uses just one pattern. The magic happens when they combine.
Perplexity: Tool Use (searches multiple sources) + Reflection (verifies information) + Planning (handles multi-step research queries)
Cursor: Reflection (reviews its code) + Tool Use (runs code, accesses docs) + Memory (knows your codebase)
Devin: All five. Plans the work, uses tools, reflects on output, coordinates multiple agents, remembers project context.
ChatGPT with tools: Tool Use (web, code, files) + Memory (your preferences) + Reflection (can self-correct when you point out errors)
The more patterns an agent uses, the more capable it becomes. But also more complex to build and debug.
Agents in the Wild
You're already using agentic AI. Now you know how it works.
| Tool | Primary Patterns |
|---|---|
| ChatGPT | Tool Use, Memory, Reflection |
| Perplexity | Tool Use, Planning, Reflection |
| Cursor | Reflection, Tool Use, Memory |
| GitHub Copilot | Tool Use, Memory |
| Devin | All five |
| Notion AI | Tool Use, Memory |
Next time an AI tool feels like magic, ask yourself: which patterns is it using? You'll probably spot them.
Building Your Own Agent? Start Here
If you're looking to build an agent for your project, you don't need all five patterns. Start with what your use case actually requires:
| Your Use Case | Patterns You Need | Why |
|---|---|---|
| Customer support bot | Tool Use + Memory | Needs to fetch answers from your docs, remember conversation history |
| Research assistant | Tool Use + Planning + Reflection | Searches multiple sources, structures findings, verifies accuracy |
| Code generation tool | Reflection + Tool Use | Writes code, runs it, catches errors before showing you |
| Content pipeline | Planning + Multi-Agent + Reflection | One agent researches, one writes, one edits: coordinated workflow |
| Personal assistant | Memory + Tool Use + Planning | Remembers your preferences, accesses calendar/email, handles multi-step requests |
| Data extraction / processing | Tool Use + Reflection | Pulls from APIs or files, validates output before returning |
| Internal knowledge assistant | Tool Use + Memory | Searches company docs (RAG), remembers user's role and past queries |
The rule: Start with one or two patterns. Get it working. Add more only when you hit limits.
Most failed agent projects try to do everything at once. The successful ones start focused, then expand.
Wrapping Up
Five patterns. That's what powers every AI agent:
- Reflection: Check your own work before submitting
- Tool Use: Call external tools when you need help
- Planning: Break big tasks into smaller steps
- Multi-Agent: Let specialists collaborate
- Memory: Remember context across interactions
These patterns aren't new. They're borrowed from how humans work effectively. The breakthrough is that LLMs are now good enough to execute them.
Understanding these patterns helps you see through the hype. You'll know what's possible today, what's genuinely hard, and what's just marketing.
As agents get more sophisticated, these five patterns will stay the same. The implementations will improve. The concepts won't change.
I break down AI concepts like this every week. No hype, just practical insights. Subscribe to the Infolia AI newsletter to get them in your inbox.