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.

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.

Important papers for this section

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.

Search

Find current or external information.

Database

Retrieve structured records.

Code

Run tests, scripts, or calculations.

Files

Read, edit, or transform documents.

Maps

Route, geocode, or inspect spatial data.

Messaging

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.

User goal: Summarize papers on household evacuation decision-making.

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.

Important papers for this section

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.

Weak plan

Research the topic.

Write the report.

Make it good.

Better plan

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.

Important papers for this section

4. Memory Is Not One Thing

Agent systems often talk about memory, but there are several different kinds.

Context memory

Messages and tool results currently inside the prompt.

Working memory

Temporary notes, plans, and task state.

Long-term memory

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.

Important papers for this section

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.

Useful multi-agent design

Different tools, permissions, or evaluation criteria.

Clear handoffs and stopping rules.

Outputs checked against evidence or tests.

Weak multi-agent design

Several personas chatting without new information.

No execution or verification.

Longer traces with little extra reliability.

Example: Multi-agent literature review

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.

Important papers for this section

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.
Risk budget example
Read files
Edit draft
Run tests
Publish

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.

Use a prompt

The task is short and self-contained.

Use RAG

The task needs external evidence.

Use an agent

The task needs actions, feedback, and adaptation.

9. A Practical Agent Checklist

Before building an agent, I would write down:

  1. Goal: What outcome counts as done?
  2. Tools: What actions can the system take?
  3. Permissions: Which actions require approval?
  4. State: What must be remembered during the task?
  5. Memory: What, if anything, persists afterward?
  6. Stopping rule: When should the loop end?
  7. Fallback: When should it ask a human?
  8. Evaluation: How will success, cost, and risk be measured?
  9. 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.

Exercises and Discussion Questions
  1. 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.
  2. 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?
  3. 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.