What is an Agent?

Subpage of Building Agents

SWE Principles for Building Out Agents

At its core, an AI agent is a system where a Large Language Model (LLM) acts as the “brain” to dynamically direct its own processes and tool usage to accomplish a goal. Unlike a standard chatbot that simply responds to a prompt, an agent maintains control over the execution path, often operating in a loop until the task is complete.

The Claude Definition

“Agents are systems where LLMs dynamically direct their own processes and tool usage, maintaining control over how they accomplish tasks.” — Anthropic (Claude)

The 4 Components of an Agent

To build a robust agent, a software engineer must consider four distinct architectural components:

1. Intelligence (The LLM)

The LLM serves as the central reasoning engine. It interprets the user’s intent, breaks down complex goals into sub-tasks, and decides which tools to call. * Key Consideration: Not all LLMs are “agentic.” An agentic model requires strong instruction-following capabilities, low “hallucination” rates when generating tool arguments, and the ability to handle long-context reasoning.

2. Reasoning Loop (The Trigger/Controller)

The loop is the “runtime” of the agent. It governs how the agent thinks and acts. The agent observes the current state, plans the next step, executes an action, and then evaluates the result. * ReAct Pattern: Most modern agents follow the Reason + Act (ReAct) framework. * Thought: The agent reasons about the current state (“I need to find the user’s latest invoice”). * Action: The agent calls a tool (“SearchInvoiceAPI”). * Observation: The agent sees the result of the tool (“Invoice #123 found”). * Update: The agent updates its internal state and decides if more steps are needed.

3. Memory (The State)

Memory allows an agent to maintain context over time. It is divided into two types: * Short-term Memory: The current conversation history or the trace of thoughts and actions within a single task execution. * Long-term Memory: Often implemented using a Vector Database (RAG), this allows the agent to recall information from past interactions or access a massive external knowledge base. * Engineering Challenge: Managing “State Drift”—ensuring the agent doesn’t get lost in its own reasoning loop as the context grows.

4. Tools (The Execution Layer)

Tools (or “Actions”) are the agent’s “hands.” They allow the agent to interact with the real world—calling APIs, reading files, executing code, or searching the web. * Tool Definition: In software terms, a tool is usually a JSON schema that describes a function’s name, description, and required parameters. * MCP (Model Context Protocol): A new standard for how agents discover and use tools across different platforms (discussed in detail in the Agents section).

The ReAct Framework: The Core Heuristic

The ReAct framework (Yao et al., 2022) was a breakthrough in agentic engineering. It proved that by prompting an LLM to “think out loud” before acting, the model significantly improves its success rate on complex tasks.

Why it matters for Software Engineers: Deterministic software relies on explicit branching (if result == x). In an agentic system, the ReAct loop handles the branching. The developer’s job shifts from writing the logic to designing the environment (the tools and the memory) in which the agent operates.

The ReAct Loop in Action:

  1. Input: “Calculate the 10% tax on the total of my last three Amazon orders.”
  2. Thought: I need to retrieve the last three orders first.
  3. Action: get_amazon_orders(limit=3)
  4. Observation: [{"id": 1, "total": 50}, {"id": 2, "total": 20}, {"id": 3, "total": 30}]
  5. Thought: The total is 100. Now I need to calculate 10%.
  6. Action: calculate_math("100 * 0.10")
  7. Observation: 10
  8. Final Response: “The 10% tax on your last three orders is $10.”

/ Continue

Follow the technical trail.

Use the dense notes as the source material, then move through the guided route, writing, or project proof when you want a cleaner entry point.