Agent
Understand This First
- Model – the agent’s intelligence comes from the model.
- Tool – tools give the agent the ability to act.
- Harness (Agentic) – the harness provides the loop and tool management.
Context
At the agentic level, an agent is a model placed in a loop: it can inspect state, reason about what to do, call tools, observe the results, and iterate until it reaches an outcome or is stopped. An agent is more than a model answering questions. It’s a model acting in the world, making changes, and responding to feedback.
This is the central pattern of agentic software construction. Everything else in this section (tools, harnesses, verification loops, approval policies) exists because agents exist. When people talk about “agentic coding,” they mean directing an agent to build, modify, test, and maintain software on your behalf.
Problem
How do you take a model’s ability to generate text and code and turn it into the ability to accomplish real tasks that require multiple steps, decisions, and interactions with the outside world?
A model on its own can produce a single response to a single prompt. But real tasks (“fix this bug,” “refactor this module,” “add this feature”) require reading files, making changes, running tests, interpreting results, and trying again if something fails. A single prompt-response cycle isn’t enough. What you need is a loop.
Forces
- Single-turn limitations mean a model can’t accomplish multi-step tasks in one response.
- Environmental interaction (reading files, running commands, checking test results) requires capabilities beyond text generation.
- Iterative refinement is natural for complex tasks: the first attempt rarely works perfectly.
- Autonomy vs. control: the more capable the agent, the more important it is to define boundaries.
Solution
An agent is constructed by placing a model inside a loop with access to tools. The basic structure is:
- The agent receives a task (from a human or from another agent).
- It examines the current state by reading files, checking test results, or querying systems.
- It decides what to do next: write code, run a command, ask a clarifying question.
- It executes that action using a tool.
- It observes the result.
- It returns to step 2 until the task is complete or it needs human input.
The harness provides this loop structure, manages tool access, and enforces approval policies. The model provides the reasoning and decision-making within each iteration.
What makes an agent different from a simple automation script is judgment. A script follows a fixed sequence. An agent reads a test failure, reasons about the cause, considers multiple possible fixes, chooses one, and verifies it worked, adapting its approach based on what it finds. This judgment is powered by the model’s training but guided by the context you provide.
An agent is only as good as its tools and context. A model with no tools is a chatbot. A model with file access, a shell, and a test runner is an agent that can build software. The tools define what the agent can do; the prompt and context define what it should do.
How It Plays Out
A developer tells an agent: “The login page shows a blank screen on Safari.” The agent reads the relevant component file, identifies a CSS property that Safari handles differently, proposes a fix, applies it, runs the browser test suite, and reports that the fix works. The developer reviews the change and approves it. What would have been a thirty-minute debugging session took three minutes of agent work and one minute of human review.
A more complex scenario: a developer asks an agent to migrate a database schema. The agent reads the current schema, generates a migration file, applies it to a test database, runs the application’s test suite, discovers that two tests fail because of a renamed column, updates the application code, reruns the tests, and reports success. Each step informed the next. No single prompt-response could have accomplished this.
“The checkout flow is returning a 500 error when the cart has more than 50 items. Reproduce the bug by reading the relevant test, find the root cause, fix it, and run the test suite to confirm. Show me what you find before making changes.”
Consequences
Agents multiply developer productivity for well-defined tasks. They excel at tasks with clear success criteria (fixing bugs, implementing features to specification, refactoring, writing tests) where the loop of try, check, iterate converges reliably.
Agents struggle with ambiguous tasks, novel architectural decisions, and situations requiring understanding of business context that isn’t in their context window. They can cause real damage if given too much autonomy without appropriate approval policies and least privilege constraints. The discipline is learning which tasks to delegate and which to handle yourself, setting clear boundaries around what the agent can touch, and maintaining a verification loop backed by tests for everything the agent produces.
Related Patterns
- Depends on: Model – the agent’s intelligence comes from the model.
- Depends on: Tool – tools give the agent the ability to act.
- Depends on: Harness (Agentic) – the harness provides the loop and tool management.
- Enables: Subagent – agents can delegate to more specialized agents.
- Enables: Verification Loop – agents naturally work in verify-and-iterate cycles.
- Refined by: Approval Policy – policies define the agent’s boundaries of autonomy.
- Uses: Prompt – the prompt steers the agent’s behavior within the loop.
- Constrained by: Least Privilege – agents should have only the permissions their current task requires.
- Scoped by: Boundary – boundaries define where an agent’s work begins and ends.
- Informed by: Test – tests provide the oracle an agent checks against in its verification loop.
Sources
- Stuart Russell and Peter Norvig defined an agent as “anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators” in Artificial Intelligence: A Modern Approach (1995). Their perceive-reason-act loop is the conceptual ancestor of the agentic loop described here.
- Shunyu Yao and colleagues formalized the interleaving of reasoning and acting for language models in the ReAct paper (2022, published at ICLR 2023). ReAct demonstrated that models perform substantially better when they can reason about observations before choosing their next action — the same loop structure this pattern describes.
- Timo Schick and colleagues showed that language models can learn to use external tools (calculators, search engines, APIs) in Toolformer (2023), establishing tool use as a practical capability rather than a theoretical one.
- Andrew Ng popularized the term “agentic” in its current sense during 2024, helping the AI community converge on shared vocabulary for systems where models act autonomously within loops.