In LLM 103, we treated Retrieval-Augmented Generation (RAG) as an evidence pipeline. The model receives a question, the system retrieves relevant documents, and the model answers from those sources. That is already more than a plain chatbot.
This post goes one step further: LLM agents. An agent is an LLM-powered system that can choose actions, call tools, observe results, keep state, and continue working toward a goal. Agents can be useful, but they are also easy to overbuild. Most problems do not need a fully autonomous loop. They need a small, reliable workflow.
1. What Makes Something an Agent?
An ordinary LLM call takes an input and returns an output. An agent has a loop. It can decide what to do next, call a tool, inspect the result, update its plan, and continue.
What needs to be done?
Choose a next step.
Call a tool or produce work.
Read the result.
Continue, stop, or ask.
The five cards above are not a one-shot sequence. In practice they form a loop: after observing a result, the agent revises its plan and acts again until the goal is met.
┌─────────────────────────┐
│ GOAL │
└────────────┬────────────┘
│
▼
┌───────────┐
┌────▶│ PLAN │
│ └─────┬─────┘
│ │
│ ▼
│ ┌───────────┐
│ │ ACT │─── call tool, write, search
│ └─────┬─────┘
│ │
│ ▼
│ ┌───────────┐
│ │ OBSERVE │─── read result
│ └─────┬─────┘
│ │
│ ▼
│ ┌───────────┐
└──────┤ REVISE │─── done? continue? ask human?
└───────────┘This loop is powerful because it lets the model interact with the world instead of only describing it. It is risky for the same reason. A bad answer is one thing. A bad action can change files, send messages, spend money, leak data, or corrupt a workflow.
Working definition: an LLM agent is a system where the model helps choose actions over time, usually with tools, memory, and feedback.
- Yao et al. (2022), "ReAct": a central paper for interleaving reasoning traces with actions and observations.
- Wang et al. (2023), "A Survey on Large Language Model based Autonomous Agents": a broad overview of LLM agent components, applications, and challenges.
2. Tools Are Where Agents Become Useful
Tools let the system move work out of language generation and into reliable operations. A calculator should calculate. A database should query. A search engine should search. A code runner should execute tests. The LLM’s job is often to decide which tool is needed and how to use the result.
Find current or external information.
Retrieve structured records.
Run tests, scripts, or calculations.
Read, edit, or transform documents.
Route, geocode, or inspect spatial data.
Draft, send, or schedule communication.
A useful tool call is structured. The model should not vaguely say “I searched.” The system should record the tool name, arguments, result, and whether the result was used in the final answer.
Tool call: search_papers(query=“household evacuation decision making risk perception”, limit=10)
Observation: 10 candidate papers found.
Next step: Filter for empirical transportation or disaster behavior studies.
- Schick et al. (2023), "Toolformer": explores how language models can learn to decide which APIs to call and how to use the results.
- Karpas et al. (2022), "MRKL Systems": frames tool-using LLM systems as modular combinations of language, knowledge, and reasoning components.
- Nakano et al. (2021), "WebGPT": an early browser-assisted question-answering system trained with human feedback and source citation.
3. Planning Is Useful, but Fragile
Many agent demos start with a big goal and ask the model to make a plan. Planning helps when a task has dependencies: gather sources before writing, run tests before reporting, inspect data before modeling.
But LLM plans can be brittle. They can skip necessary steps, invent progress, or keep looping after the useful work is done. Planning works better when the system has clear stopping conditions and observable state.
Research the topic.
Write the report.
Make it good.
Find 12 candidate papers.
Select 6 empirical studies.
Extract methods and findings.
Draft a 900-word synthesis with citations.
For complex tasks, the agent should not merely plan. It should check whether each step has actually been completed.
- Yao et al. (2023), "Tree of Thoughts": generalizes chain-of-thought prompting into search over alternative intermediate reasoning paths.
- Ahn et al. (2022), "Do As I Can, Not As I Say": shows why action selection should consider both language intent and what actions are actually feasible.
4. Memory Is Not One Thing
Agent systems often talk about memory, but there are several different kinds.
Messages and tool results currently inside the prompt.
Temporary notes, plans, and task state.
Saved facts, preferences, documents, or prior outcomes.
Context memory disappears when it leaves the context window. Working memory is task-specific. Long-term memory persists, which means it needs stronger rules: what is saved, who can see it, when it expires, and how it can be corrected.
Memory can make agents more useful, but sloppy memory can make them worse. If the system saves bad assumptions, private information, or stale preferences, it will retrieve them later with undeserved authority.
- Park et al. (2023), "Generative Agents": describes agents with memory streams, reflection, and planning for simulated social behavior.
- Shinn et al. (2023), "Reflexion": uses verbal feedback and self-reflection as a memory-like mechanism for improving future attempts.
- Wang et al. (2023), "Voyager": an embodied agent with a skill library and iterative self-improvement in Minecraft.
5. Single-Agent vs Multi-Agent Systems
A single-agent system has one model-driven loop. A multi-agent system creates several roles, such as planner, researcher, coder, reviewer, or critic. These roles can be useful when they create real checks and division of labor.
They can also become theater. If three agents are all the same model with different names and no tools, tests, or external evidence, the system may only produce more confident conversation.
Different tools, permissions, or evaluation criteria.
Clear handoffs and stopping rules.
Outputs checked against evidence or tests.
Several personas chatting without new information.
No execution or verification.
Longer traces with little extra reliability.
Agent 1 (Researcher): Tools: paper search, PDF reader Task: Find 15 papers on evacuation behavior modeling. Output: Ranked list with abstracts and relevance scores.
Agent 2 (Analyst): Tools: text extraction, table parser Task: Extract methods, sample sizes, and key findings from top 8 papers. Output: Structured comparison table.
Agent 3 (Reviewer): Tools: citation checker, fact verifier Task: Verify that the synthesis draft cites only claims present in the source papers. Output: Flagged unsupported claims.
Why this works: each agent has different tools, a defined output, and the reviewer checks the analyst’s work against real sources.
Multi-agent systems are most defensible when separation creates a concrete benefit: one agent writes code, another runs tests, another reviews the diff; one retrieves sources, another drafts, another checks citation support.
- Wu et al. (2023), "AutoGen": introduces a multi-agent conversation framework for building LLM applications.
- Wang et al. (2023), "A Survey on Large Language Model based Autonomous Agents": useful for situating single-agent and multi-agent designs in the broader agent literature.
6. Guardrails: The Boring Part That Matters
An agent with tools needs boundaries. Guardrails are not just content filters. They are system constraints that make bad actions harder.
Useful guardrails include:
- tool permissions;
- read-only modes;
- approval gates for risky actions;
- input validation;
- output schemas;
- rate limits and budgets;
- audit logs;
- rollback plans;
- restricted memory access;
- human review for high-impact decisions.
Higher bars mean lower risk or less required approval. Publishing should usually require explicit human control.
The best agent systems make safe actions easy and risky actions explicit. If a tool can send an email, move money, delete files, or change public content, the agent should not casually call it in an unreviewed loop.
7. Evaluation for Agents
Evaluating an agent is harder than evaluating a single answer. You need to inspect the path, not only the final output.
Ask:
- Did the agent choose appropriate tools?
- Did it use tool results correctly?
- Did it stop when the task was done?
- Did it ask for help when blocked?
- Did it avoid actions outside its permission scope?
- Could a human audit what happened?
- Did the workflow improve over a simpler non-agent baseline?
The baseline question: would this task be better handled by one prompt, a deterministic script, or a RAG answer? If yes, do that first.
Agent evaluation should include success rate, cost, latency, number of tool calls, failure recovery, and human review burden. A system that succeeds 5 percent more often but costs 10 times as much and creates unreadable traces may not be an improvement.
8. When Not to Build an Agent
Not every LLM workflow needs agency. Many useful systems are deliberately boring:
- a summarizer with a carefully designed prompt;
- a RAG assistant with citations;
- a script that extracts fields from documents;
- a classifier with human review;
- a dashboard that uses an LLM only to explain selected results.
Build an agent when the task truly requires multiple steps, tool use, state tracking, and adaptive decisions. Avoid an agent when the task is stable, repeatable, and better expressed as a deterministic pipeline.
The task is short and self-contained.
The task needs external evidence.
The task needs actions, feedback, and adaptation.
9. A Practical Agent Checklist
Before building an agent, I would write down:
- Goal: What outcome counts as done?
- Tools: What actions can the system take?
- Permissions: Which actions require approval?
- State: What must be remembered during the task?
- Memory: What, if anything, persists afterward?
- Stopping rule: When should the loop end?
- Fallback: When should it ask a human?
- Evaluation: How will success, cost, and risk be measured?
- Audit: Can someone reconstruct what happened?
Agents are not magic autonomy dust. They are workflows where an LLM helps choose actions. The engineering challenge is to make those actions observable, reversible when possible, and worth the added complexity.
- You are considering building an agent that automatically emails weekly project summaries to stakeholders. Using the guardrails section, list three controls you would put in place before deploying this.
- A demo shows three LLM "agents" debating a topic with different persona names. All three use the same model, have no tools, and produce no verifiable output. Is this a useful multi-agent system? Why or why not?
- An agent is tasked with updating a project schedule. It makes 14 tool calls, edits 3 files, and reports success. How would you evaluate whether this was actually good work?
In the next post, we can focus on evaluation: benchmarks, human review, automated checks, hallucination tests, and how to measure whether an LLM system is actually useful.