AI Engineer World's Fair 2026
Giving AI Agents Memory That Learns — Jake Broekhuizen, LangChain
Loading slides…
Read the talk
Giving AI Agents Memory That Learns
Jake Broekhuizen explains how a financial assistant’s tone failures can become instructions for its next run—and why selecting lessons, refreshing context and reviewing rule changes matter as much as storing them.
From a talk by Jake Broekhuizen
At a glance
Ideas worth remembering
A trace becomes memory when a selected lesson is written into persistent context that future runs actually read.
Behavioral corrections such as advisory tone belong in procedural memory: rules and skills that guide how the agent engages with users.
Keep most execution evidence as history or evaluation data; promote only the subset useful for future behavior.
Memory updates need a working read path. Caching and retained runtime state can leave an agent using stale guidance.
Surface consequential procedural changes for human review before loading them into execution, and use evaluations to protect important behavior.
A budgeting assistant starts telling users what to do
A financial assistant can offer sensible budgeting advice and still fail its product requirements. Jake Broekhuizen, who leads LangChain’s labs team, opens with a company building an agent for spending, budgeting and non-investment advice. Its tone needs to remain advisory and helpful. Yet some interactions become pointed and directive: the assistant starts telling users to cancel subscriptions and move money into savings.
The distinction concerns the relationship the assistant establishes with the user. Offering a spending cap as an option leaves room for the user’s judgment; directing the user to change their finances crosses the company’s tone guidelines. Those guidelines live in the context, rules and policies the agent references. Correcting the response therefore requires changing what guides the agent’s behavior.
Initially, that correction is manual. Someone reads the traces, identifies where the tone slipped, edits the relevant context and checks for regressions. Each failure can teach a useful lesson, but the work of carrying that lesson into future runs is hard to scale. The question for the rest of the talk is how the system around the agent can perform that learning loop.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
A stored trace does not change the next run
Observability makes an agent’s execution inspectable. A trace can show the tools it called, the artifacts it referenced and the recorded steps leading to its decision. That information helps explain a bad result. But if the next run receives the same misguided instruction, storing the trace gives the agent no reason to behave differently.
Memory, in this account, is persistent context that guides future runs. Logs, transcripts and traces are evidence of an experience. They become memory when a lesson from that experience is converted into context the agent can actually reference later. The consequential step is the conversion: a record of a tone failure must become guidance about how to respond.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Facts, experiences and rules change behavior in different ways
A taxonomy borrowed from cognitive science separates three kinds of agent memory:
- Semantic memory: what the agent knows. Facts and preferences provide information that guides a response.
- Episodic memory: what the agent has experienced. Past interactions, examples and learned patterns preserve useful experience.
- Procedural memory: how the agent should behave. Instructions, skills and rules guide its actions.
For the financial assistant, the useful correction belongs in procedural memory. A new financial fact would not address the tone problem, and a banned-word list would miss the broader behavior. The agent needs a rule governing how it engages with users: keep the advice measured and avoid directing their decisions. Broekhuizen identifies procedural updates as the source of most visible gains in this example.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Separate the current workspace from what survives the run
Memory type answers what the context contains. A second distinction answers when it is available. Working memory is the context used in the current run: intermediate scratchpads, tool results and retrieved files. Long-term memory holds instructions, skills and other context that remains available across future turns and runs.
The agent harness determines how long-term context enters the current task. It may inject context into the prompt, retrieve it through tools, read it from a store, load files or change runtime state. These approaches differ in implementation, but they all need to connect persistent information to the agent’s current working context.
A trace can therefore be read as a record of how working memory changed during execution, rather than merely a record of the final answer. That history contains more than the agent should carry forward. Some details explain this particular attempt; others reveal a lesson useful for later attempts. Selecting between those two uses is the core design problem.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Read context, run the agent, filter evidence, write a lesson
The connection between working and long-term memory forms a read/write cycle. At the beginning of a run, the agent reads relevant skills and instructions into its working context. Progressive disclosure—loading the skills relevant to a particular task—is one way to perform that read. The agent then executes and produces a trace of retrievals, tool calls, decisions and any sub-agent activity.
The filter step decides which parts of that evidence deserve to influence future behavior. Copying everything into long-term memory would burden later tasks with material they do not need and make reasoning harder. The selected signal is written back as persistent context. For the financial assistant, that signal becomes a rule to remain measured rather than pointed or directive.
Where does one run affect the next, and where does ordinary history leave the loop? The diagram follows the financial assistant’s tone correction through the read/write cycle. The return path carries a selected behavioral lesson; the history branch keeps the remaining evidence available without making it part of every future task.
This also explains the role of background work sometimes called sleep-time compute or dreaming. Memory processing can happen while the agent is working or while it is idle. The simpler implementation model is to capture what happened, analyze what matters and update the context future runs will use. Those three responsibilities remain useful even as frameworks differ in how they perform them.
A tone failure becomes guidance for the next run
Read the diagram as text
- Long-term context. Instructions and skills, including the rule to keep financial advice measured.
- Read and run. Load relevant context into working memory and execute the task.
- Execution evidence. Record retrieved context, tool calls and decisions.
- Select a useful lesson. Identify evidence worth turning into a behavioral rule.
- Keep as history. Retain evidence that should not guide every future run.
- Long-term context → Read and run: Read relevant skills and instructions.
- Read and run → Execution evidence: Produce a trace.
- Execution evidence → Select a useful lesson: Analyze evidence.
- Select a useful lesson → Keep as history: Leave most evidence outside memory.
- Select a useful lesson → Long-term context: Write the selected lesson.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Context Hub carries the correction into the financial assistant
LangSmith supplies one concrete implementation of this loop. Its observability captures the execution trajectory, including tool calls, sub-agent calls and retrieved context. A background analysis process extracts signal from traces according to the behaviors the team cares about. LangSmith’s Context Hub provides the remote store where updated context can be kept for the agent to retrieve on its next run.
The financial assistant begins by loading instructions, skills, relevant Markdown files, policies and rules from Context Hub. Its run produces a trace that can expose failed tool calls, user corrections or, in this case, a tone violation. The analysis engine looks for patterns and identifies which skill Markdown files need changing. It then updates those files so the correction is available to subsequent runs.
The observable change comes after the revised context is loaded: Broekhuizen reports that the assistant’s tone changes in later user interactions. The causal sequence is specific—a directive response supplies evidence, analysis turns that evidence into a procedural correction, and the next run reads the correction. This is a reported behavioral improvement; the recording does not quantify its size or explain the pattern detector well enough to establish a general success rate.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Keep the loop selective, fresh and reviewable
The first operational lesson is restraint. Agents produce substantial execution “exhaust,” and most of it should remain referenceable history. Some traces can become datasets for offline evaluations. Only a small subset should change memory. These are different destinations for the same evidence: preserving an attempt for inspection or testing does not require promoting it into instructions.
The second lesson is about freshness. A memory store can contain the right update while a long-running background agent continues using old context. Cached data or retained runtime state may prevent the change from reaching later work. Broekhuizen describes struggling to understand why behavior was not changing before recognizing this access problem. The practical decision is what can be cached while still ensuring that future runs receive memory updates.
The third lesson is to distinguish what may update itself from what deserves human review. Procedural memory contains instructions, policies and tone guidelines, so changing it can affect a large share of the agent’s behavior. Broekhuizen estimates about 75% for his agent; that is his estimate rather than a measured general proportion. Proposed changes to these rules should be surfaced for review before they are committed and loaded into active execution, with evaluations protecting important behavior.
These lessons qualify the opening ambition that the next run should be better. Storing more information does not achieve it by itself. Experience must produce a useful correction, that correction must reach the next run, and consequential rule changes need review and regression checks. Memory gives the next run a chance to improve by changing the context from which it acts.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Resources
Related talks
- Beating RL With Reflection: GEPA and Optimize Anything
Extends the trace-to-lesson idea into reflective optimization: diagnostic feedback drives changes to prompts, agent programs and repository skills, while evaluation guides which changes survive.
Full transcript
Loading transcript…