Back to resources
Kind
Guide
Reading time
4 min read
agents

Build AI Agents with Three Fundamentals

A practical framework for designing agent systems around memory, model inference, and the capabilities that make action possible.

Topics

  • agents
  • architecture
  • context windows
  • tool use

Start with a useful mental model

An agent is not a mysterious autonomous employee hidden behind a chat box. It is a software loop that combines a model with context, tools, policies, and feedback. The model proposes the next step. The harness decides what information to provide, which actions are allowed, how those actions run, and whether the result is good enough to continue.

That distinction matters because most agent failures are not solved by simply choosing a larger model. They are solved by improving the information and capabilities around the model.

System map

The capability stack

The capability stack of an AI agent The model predicts the next step, while the harness supplies tools, data, policies, and evaluation that make useful action possible. CAPABILITY STACK 01 / MODEL Predict the next action 02 / HARNESS Assemble context and enforce the loop 03 / CAPABILITIES Tools, data, and permissions 04 / CONTROL PLANE Evaluation, safety, observability INSTRUCTIONS Steer behavior REAL WORLD Take action
The model is one layer. Reliable behavior depends on the harness, capabilities, and control plane around it.

1. Memory: the desk and the filing cabinet

An agent uses at least two different kinds of information. The active context is the limited desk where the current task is processed. Persistent storage is the filing cabinet beside it: documents, prior observations, customer records, or other data that can be retrieved when needed.

The filing cabinet does not help simply because it exists. The harness needs a retrieval strategy that identifies relevant information, puts it into context, and keeps it within the available token budget. As the desk fills, the system may need to trim, summarize, or prioritize content. Each choice can change what the model notices and what it forgets.

System map

Context is a working surface

Active context and long-term memory The active context window is a limited desk where the current task is processed. A larger filing cabinet stores persistent information, but retrieval is required to bring relevant information onto the desk. CONTEXT IS A WORKING SURFACE PERSISTENT STORAGE Filing cabinet Available, but not active Documents & facts Past observations Business records LIMITED CONTEXT WINDOW The desk Current task + retrieved context GOAL RETRIEVED Instructions Relevant facts TOKEN BUDGET / PRUNE OR SUMMARIZE WHEN FULL retrieve write back only if designed
Persistent storage becomes useful only when the harness retrieves relevant information into the active context.

Useful questions for the memory layer include:

  • What information is needed for the current decision?
  • How is relevance measured?
  • What happens when retrieval returns too much or too little?
  • Which facts can become stale, and how are they refreshed?
  • Can a person inspect or delete what was stored about them?

2. Inference: next-step prediction

The model receives the active context and predicts a response. In an agent system, that response may be a user-facing answer, a structured decision, or a tool call. The model does not have direct access to the entire business or codebase. It sees the representation that the harness constructs for that step.

This is why vague instructions create drift. A role description, procedure, tool schema, and output format act as steering tracks for the model’s prediction. They reduce the number of plausible next steps and make behavior easier to evaluate.

goal + rules + retrieved context + tool definitions
  -> model inference
  -> validated response or tool call

Inference still needs boundaries. Validate structured outputs, reject malformed arguments, cap retries, and make failure a visible state instead of silently asking the model to improvise forever.

3. Capabilities: equip the body

The model can suggest an action, but the local system determines what is possible. A read-only search tool, an email sender, and a production database writer represent very different risk profiles. Each should have a narrow contract and an explicit authorization boundary.

Good capability design includes:

  • Small tools with specific names and typed inputs.
  • Permission checks outside the model’s control.
  • Timeouts, retries, and idempotency for external actions.
  • Clear error messages that can be added to the next context.
  • Logs that make the decision and action traceable.
  • Human approval for high-impact or irreversible operations.

System map

The agent execution loop

The agent execution loop An agent assembles context, asks a model for the next action, uses a tool, observes the result, and repeats the loop. Long-term memory feeds context assembly. AGENT EXECUTION LOOP 01 / INPUT Goal & rules What should happen? 02 / ASSEMBLE Active context What is on the desk? 03 / PREDICT Model inference Choose the next step 04 / ACT Tool or response Change the world 05 / OBSERVE Result Learn what happened SIDE CHANNEL Long-term memory Retrieve when useful
Capabilities connect model predictions to actions, while observations feed the next decision.

Make the three fundamentals testable

Before calling a system production-ready, create a small evaluation set that represents real work. Include normal tasks, incomplete information, ambiguous requests, tool failures, permission failures, and attempts to exceed the intended scope.

For each task, record:

  1. What context was assembled.
  2. What action the model proposed.
  3. What the tool actually did.
  4. What result was observed.
  5. Whether the final outcome met the acceptance criteria.

This gives you a way to compare changes to retrieval, prompts, tools, or models without relying on a handful of demos.

A practical build order

Start with a deterministic workflow and one narrow capability. Add retrieval only when the task needs information that cannot fit safely in the initial context. Add additional tools after the first tool has clear contracts and evaluation coverage. Add autonomy gradually, with a human checkpoint wherever an incorrect action would be costly.

The strongest agent systems are usually less magical than their demos. They make the model’s inputs, possible actions, and failure states visible enough for a team to improve them.

Apply the pattern

Have a real system to work through?

I help teams turn useful AI ideas into clear architectures, working prototypes, and production practices.

Start a conversation