From Stochastic Parrots to Autonomous Loops
The Anatomy of an Agent
From Stochastic Parrots to Autonomous Loops
Day 1 · Phase 1
Where We Just Were
You can use an LLM. You've typed prompts and gotten answers.
But a chat model is a brain in a jar — brilliant, and completely unable to do anything.
Today we give it a body.
The Question This Hour Answers
What turns a model that talks into a system that acts?
The answer is a loop with four parts. Once you see them, you'll see them in every agent ever built.
First: Three Stages of Getting Help from AI
A quick map of how we got here.
Chat → You ask, it answers. You do everything in between.
RAG → It reads your documents first, then answers. Better informed, still just talking.
Agent → It answers and acts — and then looks at what happened and goes again.
Chat and RAG end after one reply. An agent doesn't end. It loops.
The Parrot vs. The Worker
A stochastic parrot predicts the next word convincingly. Ask it to paint your house and it describes painting beautifully — and your house stays the same color.
A worker picks up the brush, paints a stroke, looks at the wall, and adjusts.
The difference isn't intelligence. It's the loop between acting and looking.
The Four Components
Every agent, no matter how complex, is this loop:
Perception → Reasoning → Action → Memory → (repeat)
Think of a person doing any task:
- See what's in front of you
- Decide what to do
- Do it
- Remember what happened
- Look again
That's it. That's an agent.
Component 1 — Perception
Analogy: opening your eyes at the start of a task.
WHY — The agent can only reason about what it can see; blind action is just guessing.
WHAT — A snapshot of the current state of the world: files present, the last command's result, the error that appeared, what the user asked.
HOW — The relevant state is gathered and placed into the model's context as the input for this turn.
Bad perception → the agent acts blind.
Component 2 — Reasoning
Analogy: the moment of "okay, so I should…"
WHY — Something has to choose the next move; perception alone doesn't decide anything.
WHAT — A decision, not an answer: which action to take, with which inputs, given the goal and what was just perceived.
HOW — The LLM weighs the goal against the current state and outputs an intended action.
Reasoning is the brain — but a brain with no hands changes nothing.
Component 3 — Action
Analogy: the hands — picking up the brush and painting.
WHY — Without acting, the agent only talks; action is the line between a chatbot and an agent.
WHAT — Something that changes the world: a tool call, a command, a written file, an API hit.
HOW — The decided action is executed against a real system, and the world is now different than it was a second ago.
No action, no agency.
Component 4 — Memory
Analogy: remembering you already checked that drawer, so you don't check it again.
WHY — Without it the agent is an amnesiac, repeating the same mistake forever.
WHAT — A record of what happened: past results, decisions, and context carried forward.
HOW — Each loop's outcome is stored and fed back into perception, so the next loop builds on the last.
Memory is what makes a sequence of actions feel like progress.
The Loop, In One Breath
Perceive the world → Reason about the goal → Act on it → Remember the result → and look again.
Stop the loop when the goal is met. That stopping condition is part of the design — not an accident.
Why "Loop" Is the Whole Point
A chatbot runs once: in, out, done.
An agent runs until the job is done: act → check the result → correct → act again.
Self-correction isn't a feature bolted on. It's just the loop running more than once.
How Far Does the Loop Scale?
The same loop, given more, climbs a ladder (Google's agent taxonomy):
- L0 — model alone, no tools (a plain chatbot)
- L1 — model + tools (what you build today — StackLog)
- L2 — strategic, multi-step planning over many tools
- L3 — a team of agents, each other's tools (Day-2 "personas as subagents")
- L4 — agents that build their own tools and agents
Everything in this workshop is L1 → L2. Same anatomy; the loop just runs richer.
The Other Half of the Skill: Restraint
Knowing how to build an agent is half the job. Knowing when not to is the other half.
The most senior engineering instinct: "Does this actually need an LLM at all?"
When NOT to Use an LLM
Reach for plain code — not an agent — when:
- The task is deterministic (same input, same output, every time)
- A simple rule or formula already solves it
- You need guaranteed correctness (math, validation, money)
- Speed and cost matter and the logic is fixed
If an
ifstatement can do it, anifstatement should do it.
When an LLM Earns Its Place
Use a model when the task involves:
- Ambiguity — fuzzy input, no single right parse
- Language — understanding or generating natural text
- Judgment — weighing messy options with no clean rule
- Open-endedness — the steps aren't known in advance
LLMs are for the problems rules can't pin down. Everything else is just engineering.
The Architectural Filter
Before adding an agent to anything, ask:
- Is the task ambiguous or open-ended? (If no → use code)
- Does it need to act in a loop, or just answer once?
- What is the smallest set of actions it needs?
- How will I know when it's done?
An agent is a powerful, expensive tool. Use it where it's the right tool — not everywhere.
What This Means for Today
For the rest of Day 1, we build the part that makes the loop real:
- The model gives us Reasoning
- We must build Perception and Action safely
- That bridge — model to real world — is the harness (MCP)
Next: how do we give the agent hands without letting it break everything?
Anchor This
A chatbot answers. An agent perceives, reasons, acts, remembers — and repeats.
The loop is the agent. Everything else this workshop is about is making that loop safe and directed.