Improving agents over time
To improve an agent over time, you must understand what an agent is, its components, what can be improved, and how to guide and create improvement loops.
To improve an agent over time, you must understand what an agent is, its components, what can be improved, and how to guide and create improvement loops.
An agent consists of three components: the model, the harness, and the context.
Context
Knowledge base, markdown files, tool definitions
Harness
OpenCode, DeepSeek, Codex, Pi, Claude Code
Model
The brain: reasoning and decision-making
The model is the core, or the "brain", possessing various capabilities; it handles reasoning and decision-making.
The harness is the surrounding system, whether it involves OpenCode, DeepSeek, Codex, Pi, or Claude Code. It injects the context the model sees (prompts, memory, skills, conversation), controls the run (compaction, orchestration, Ralph loops), carries out the model's actions (bash, tools, MCP) and brings the results back to the context, persists the work (filesystem, Git, progress files), and observes and verifies it (browser screenshots, test results, logs).
Harness
Context injection
Control
Model
Reasons, decides
Action
Results back to context
Persist
Observe & verify
- Context injection
- Prompts, memory, skills, conversation
- Control
- Compaction, orchestration, Ralph loops
- Action
- Calls bash, tools, MCP
- Results back to context
- Persist
- Filesystem, Git, progress files
- Observe & verify
- Browser screenshots, test results, logs
The context generally takes the form of text, such as a knowledge base, markdown files, or the definitions of the tools connected to the agent.
We can improve the model, the harness, or the context.
There are three ways to achieve this.
You can improve it manually, through a background process involving human approval, or fully automated.
The first method is manual, an AI Engineer analyzes performance and updates the agent, this is the current standard.
The second method, which is gaining increasing popularity, is "human-in-the-loop." This approach automates the entire cycle, execution, analysis, and fixes, while still requiring human approval.
The next stage is complete automation (we are not there … yet!), where the agent identifies issues and independently repairs them or enhances its own performance.
Manually
An AI Engineer analyzes performance and updates the agent
The current standard
Human-in-the-loop
Execution, analysis and fixes run on their own; a human approves
Gaining popularity
Complete automation
The agent identifies issues and repairs them
We are not there … yet!
We can improve the model using two well-known methods, supervised fine-tuning or reinforcement learning.
Models can be improved through weight updates, whether by refining the agent's core, implementing guardrails, or adding evaluation checks. In general, it can be done for classification, extraction, or summarization. The model can also learn from examples, such as the operational harness, the tools and their required formats, or what constitutes an ideal response.
Try: turn the filter off, then on again
Traces
Classification, extraction, summarization
The model learns from examples of what constitutes an ideal response.
Illustration, not measured results.
For more complex tasks, it is reinforcement learning. RL is not about a trajectory, it is about tasks. Put agents in practice real agent tasks and give them rewards for doing them well, like following long instructions, using skills and memories, working with other agents, etc.
Try: train on the rewards and run again, a few times
Real agent tasks
Round 1 · average 0.46 · best 0.92
Illustration, not measured results.
Updating model weights (whether via SFT or RL) is almost always human-initiated because it is time- and capital-intensive—it is not something run continuously on a whim.
Traces and evals are an indispensable foundation of the whole system. Agent failures are rarely runtime errors or traditional crashes; they are semantic and logical failures within text or environment states. Evals replace traditional Product Requirements Documents by defining what "good" looks like across edge cases.
Traces
Every run, step by step
Semantic and logical failures
No crash, no runtime error: the text or the environment state is wrong
Evals
What good looks like across edge cases
Staging
Evals perform write operations, so they run here, not on the real database
Because evals often perform write operations, agents must run in simulated or staging environments to avoid corrupting the database.
The next thing you can update is the harness, which relates to code and logic. You swap out the tools, the code, or the prompts. It's a process that currently requires a "human in the loop." The process isn't complex: you look at the traces, identify issues, and make changes.
The context can be updated at various levels—memory can be expanded and improved, and so on. The process is similar to "improving the harness." You examine a set of traces, identify problems or opportunities, and then implement the necessary changes.
Look at the traces
Identify issues
Make changes
- Harness: the tools, the code, or the prompts
- Context: memory and more
How can agents improve over time? Be simple: run the agent, get feedback, and see what happens. Traces add an eval data point and suggest changes to the agent, update model weights, harness code, or context.
Run the agent
Get feedback
See what happens
The traces
Add eval data point
Suggest changes
- Model weights
- Harness code
- Context
References
Chase, H. (2026, October 27). How to build agents that improve over time: Model, harness, context [Video]. YouTube. https://www.youtube.com/watch?v=xy_7SzwsIjM
The figures in this note are adapted from the slides of this talk, given at LangChain's Interrupt London.