Giving AI Agents Memory That Learns — Jake Broekhuizen, LangChain
Description
Most teams are great at watching what their agents did. Far fewer turn that into lessons for the next run. Jake Broekhuizen from LangChain's Labs team explains how to give agents memory that actually changes their behavior. Using a real financial services agent whose tone kept slipping from advisory to pushy, he shows why traces and logs are only evidence: they become memory only when a lesson turns into durable context the agent reads next time. He breaks memory into semantic, episodic and procedural types, separates working memory from long-term memory, and walks through the read-write cycle: read context, run, filter the evidence for signal, and write it back. He shows how LangSmith and Context Hub capture, analyze and update that context, and shares three hard-won lessons about what to keep, caching, and when a human should review changes. In this talk: • Why observability alone doesn't make an agent improve • Semantic, episodic and procedural memory, and which one moves behavior most • The read-write cycle: run, filter evidence for signal, update context • Lessons: most traces stay history, watch caching, review procedural changes SPEAKER Jake Broekhuizen, LangChain Labs LinkedIn: https://www.linkedin.com/in/jake-broekhuizen/ LINKS LangChain Labs: https://www.langchain.com/blog/introducing-langchain-labs LangChain on X: https://x.com/LangChain CHAPTERS 0:00 Intro 0:37 Agents that improve every run 1:02 Example: a finance agent's tone slips 2:42 Observing isn't learning 3:07 Traces are everywhere 4:02 From logs to signal 4:22 What memory really is 4:47 Semantic, episodic and procedural memory 5:42 Procedural memory drives behavior 6:22 Working vs long-term memory 8:12 The read-write cycle 9:27 Deciding what's worth keeping 10:22 Capture, analyze, update 10:52 LangSmith and Context Hub 12:02 The finance agent, fixed 13:17 Lesson 1: most traces stay history 13:42 Lesson 2: caching and the hot path 14:47 Lesson 3: human review for key rules 15:27 Wrap-up Reco
Summary
Generated by gpt-5.6-terraAt-a-Glance
- Verdict: Watch fully
- Core thesis: Agent memory should be treated as a governed read-write learning loop that converts a small, validated subset of execution traces into durable context—especially procedural instructions and skills—that improves future runs.
- Why it matters: This is a practical control-plane pattern for making agents improve from production experience without blindly accumulating logs, stale context, or unsafe self-modifications.
- Best use: Use it to design or audit an agent-memory pipeline: trace capture, signal extraction, memory promotion, runtime retrieval, evaluation, and human approval for high-impact behavioral changes.
Executive Summary
Jake Broekhuizen argues that observability alone does not make an agent better: traces only record what happened. They become useful memory when a system extracts a lesson from them and writes that lesson into durable context that the agent will retrieve on subsequent runs. His operating goal is simple: the next run should be better than the prior one.
The talk distinguishes semantic memory (facts and preferences), episodic memory (past interactions, examples, and learned patterns), and procedural memory (instructions, skills, policies, and behavior rules). Broekhuizen says procedural memory tends to create the most visible gains because it directly governs how an agent acts; in his financial-services example, the remedy for overly directive advice was a revised behavioral rule, not a fact lookup or banned-word list.
The proposed architecture is a read-write cycle: retrieve relevant long-term memory into the agent's working context, execute and capture a trace, filter the trace for meaningful signal, then write only selected lessons back into long-term memory. The decisive design problem is the filter: most trace exhaust should remain historical data or feed offline evaluation datasets rather than become memory.
The operational cautions are as important as the loop itself. Memory updates must actually be visible to later runs despite caches and long-lived runtime state, and self-updating procedural memory should generally be gated by human review and evals because instructions, policies, and tone rules can drive most of an agent's behavior. LangSmith Context Hub is presented as LangChain's implementation of the durable-context store and promotion workflow, but the architectural pattern is framework-independent.
Key Takeaways
- Claim: A trace is not memory by default; it becomes memory only when an extracted lesson is converted into durable context that guides future agent runs. | Evidence: Broekhuizen defines memory as durable context referenced on future runs, while a trace, transcript, or log is evidence of what happened during one run. | Implication: Design a separate memory-promotion layer rather than equating observability storage, chat history, or vector retrieval with learning. | Caveat: Treating raw logs as memory is counterproductive: indiscriminate promotion makes future reasoning harder.
- Claim: The reusable agent-memory control loop is retrieve context, run the agent, capture evidence, filter for signal, and write validated signal back into long-term memory. | Evidence: The speaker frames memory as a read-write cycle: long-term context enters short-term/working memory, execution produces a trace, selected signal is then written back to durable context. | Implication: Agent systems need explicit read paths, write paths, and promotion criteria; a memory store alone does not create adaptation.
- Claim: Procedural memory—skills, instructions, policies, and rules for behavior—is often the highest-leverage memory category. | Evidence: The talk separates semantic memory (facts/preferences), episodic memory (patterns and prior examples), and procedural memory (how the agent should behave), and states that procedural memory produces most visible gains. | Implication: Prioritize versioned, testable behavioral artifacts such as skill files and policy instructions, but govern their modification more tightly than ordinary factual or episodic records. | Caveat: Because procedural memory can drive roughly 75% of agent behavior in the speaker's framing, it is also the riskiest category to allow an agent to update autonomously.
- Claim: Production corrections can be generalized into behavioral rules instead of being repaired manually case by case. | Evidence: A regulated financial spending and budgeting assistant drifted from advisory language into directives such as telling a user to cancel subscriptions and move money to savings; the corrective lesson was to be measured rather than pointed or directive. | Implication: Use traces, user corrections, and failure patterns to identify systematic behavior gaps, then update the underlying reusable instruction or skill rather than patching individual outputs. | Caveat: In regulated or high-impact workflows, the resulting policy or tone change requires regression checks rather than immediate automatic deployment.
- Claim: Most agent exhaust should remain history or evaluation data; only a small, relevant subset should alter long-term memory. | Evidence: Broekhuizen says traces include tool calls, retrieved artifacts, sub-agent activity, decisions, and working-memory changes, but that most should stay as referenceable history and some should become offline evaluation datasets. | Implication: Create explicit promotion thresholds and categories—for example, recurring failures, confirmed user corrections, and evaluator-detected regressions—rather than writing all interactions into a shared store. | Caveat: The talk does not prescribe a universal filtering algorithm; teams must define what signals matter for their own quality, safety, and business objectives.
- Claim: Memory correctness depends on runtime freshness: a valid update is ineffective if caching or long-running agent state prevents later runs from reading it. | Evidence: The speaker describes debugging behavior that failed to change because updates made early in a long-running background agent's operation were not accessible later due to runtime state and memory-access patterns. | Implication: Specify cache invalidation, memory versioning, reload behavior, and which execution boundaries must see new policy or skill versions before relying on adaptive behavior. | Caveat: Reducing caching indiscriminately can harm latency and cost, so freshness boundaries need deliberate design.
- Claim: Self-updating agents need a deployment gate for important memory changes, particularly procedural changes. | Evidence: Referencing OpenClaw and Hermes Agent as examples of self-update patterns, Broekhuizen recommends surfacing proposed changes to instructions, policies, and tone guidelines for human involvement before placing them on a hot-reload path, and protecting behavior with evals. | Implication: Treat memory promotion like a controlled software/configuration deployment: proposed diff, provenance from traces, targeted eval suite, approval rule, rollback, and post-deployment monitoring. | Caveat: The transcript advocates human review for consequential behavior but does not define the exact approval policy or which lower-risk memory classes can be fully automated.
Detailed Brief
Working memory versus long-term memory
- Claims: Working memory is the temporary context needed for the current run; long-term memory is durable context retained for future turns and continuous behavior.; A trace records not merely the final answer but the evolution of working context across an execution.; Long-term memory can be injected through several mechanisms, including direct prompt insertion, retrieval tools, a remote store, files, or runtime state.
- Evidence: Examples of working memory include intermediate scratchpads, tool results, and files retrieved for the current task.; The speaker identifies progressive disclosure—loading only skills relevant to a task—as an example of moving appropriate long-term context into the current run.; He connects the write side of the loop to ideas often called 'sleep-time compute' or 'dreaming,' where memory can be updated during or outside active agent work.
- Caveats: The implementation mechanism is not the core principle; different agent harnesses may retrieve and inject memory differently.; The talk offers a systems model rather than benchmark data showing the magnitude of improvement from any particular memory strategy.
- Implications: Separate transient execution state from durable policy, knowledge, and learned patterns in both storage design and governance.; Use task-aware retrieval/progressive disclosure to prevent durable memory from overwhelming the active context window.
LangSmith implementation described
- Claims: LangChain maps the generic capture-analyze-update pattern to LangSmith observability, an analysis process that extracts relevant signal, and LangSmith Context Hub as the durable context store.; For the financial agent, the store can hold instructions, skills, policy/rule artifacts, and relevant Markdown files; analysis identifies which static skill files should be modified or promoted.
- Evidence: Captured traces expose retrieved context, tool calls, sub-agent calls, failed tool usage, and user corrections.; The stated outcome is that subsequent invocations load the revised context and exhibit the corrected tone.
- Caveats: This is a vendor-specific example and product framing, not evidence that Context Hub is required to implement the architecture.; No technical detail is provided on the analyzer's confidence thresholds, conflict resolution, version model, or rollback mechanics.
- Implications: Evaluate any memory-control-plane product against the full loop: trace provenance, configurable signal extraction, versioned context artifacts, review/eval gates, retrieval freshness, and rollback—not merely storage or observability features.
Notable Concepts & Terms
- Durable context: The speaker's operative definition of agent memory: context retained and referenced to guide future runs, rather than a record of a past run.
- Semantic memory: What an agent knows, including facts and preferences that shape responses.
- Episodic memory: What an agent has experienced, including prior interactions, examples, and learned patterns.
- Procedural memory: How an agent should behave: skills, instructions, policies, tone constraints, and rules; presented as the main source of visible behavioral improvement.
- Read-write memory cycle: The architecture in which agents read relevant long-term context into the active run and later write selected lessons from execution back to durable memory.
- Progressive disclosure: Loading only task-relevant skills or context into the current agent run, rather than putting the entire memory corpus into every prompt.
- Sleep-time compute / dreaming: Terms for updating or consolidating memory outside the immediate active task, used here to frame background analysis and memory promotion.
- LangSmith Context Hub: LangChain's described remote store for durable agent context such as instructions, skills, rules, and Markdown artifacts that can be updated from trace-derived analysis.
Operator Notes / Why Ken Should Care
- Define a memory-promotion policy with explicit eligible signals, confidence/recurrence thresholds, artifact owners, and a default rule that raw traces remain historical data.
- Represent procedural memory as versioned deployable artifacts with provenance links to the traces or evaluator failures that prompted each proposed change.
- Require a targeted regression-eval suite and an approval/rollback path for policy, instruction, tool-permission, and tone updates; automate only lower-risk memory classes after validating the gate.
- Test memory freshness in long-running agents: verify precisely when a run reloads durable context, which layers cache it, and how a newly approved update propagates.
- Instrument the learning loop itself: measure proposal volume, promotion rate, evaluator pass rate, regression rate, rollback rate, and whether revised memory changes the target behavior on future tasks.
Source/Metadata
- Title: Giving AI Agents Memory That Learns — Jake Broekhuizen, LangChain
- Transcript words: 5366
- Duration seconds: 998
- Timestamp note: No usable timestamps or chapters were present in the supplied transcript; the latter portion substantially repeats the earlier material.
Transcript
Music Testing. Awesome. Good morning everybody. I know it's the last day of the conference, so super excited to have you here. Hopefully I can keep you engaged for the next 15 to 18 minutes or so. My name's Jake and I lead our labs team here at Langchain. And today I want to talk to you about a topic that I have been speaking a lot about with our team and with a lot of teams that I speak with who are building agents, and that's how to give your agents memory. Whether you're building a coding agent, a support agent, a research agent, most teams arrive at the general same instinct that it should get better from one run to the next. So let me give you an example to hold on to for the rest of this talk today. Recently, the labs team at Langchain have been working with a company in the financial services sector who's building a spending, budgeting, and non-investment advice agent. Given the highly regulated nature of the financial services sector, obviously you would imagine that it would need to follow some strict tone guidelines. And so, the way that it speaks and its vocabulary and the way that it interacts with different users is obviously the tell on whether or not it's following and abiding by the correct tone. It will derive the way that it generates this tone from the context and from the memories and from the references that it has to its rules and policies. And you can imagine in some contexts, and actually in some contexts that we experienced, its tone would slip. And so it would move from being advisory and helpful to actually pointed and directed, saying things like, users in your similar situation would generally set a spending cap. And it would actually say, oh, well, actually, it looks like you need to cancel some subscriptions and move some money into savings. The company that we're working with thought that this is a violation of tone. And there were similar instances of this too. And so, to correct that, the review process is manual. You have to have someone understand the traces and understand where its tone slipped, make those changes to the context that it needs to reference when it's giving its tone, and then make sure that there are no regressions as well. Obviously, that doesn't scale, or rather, it's challenging to scale. And so, the system should be, or the system around the agent should be a place where it can continuously learn and benefit from its interactions and its experiences. And that's the version of memory that I want to talk about today. Together, I want to start with the tension that I think a lot of teams have run into. I think all of us here today, the reason why we're at this conference is we're curious, we're building agents. I think we've gotten very good at observing them. But observing them and then turning those observations and those agent experiences into lessons for future runs are obviously very different things. And so, that's where memory comes into play. Agents are producing more signal and more traces than ever before. And this is going to be something that will obviously increase as more agents are built. That's fantastic for us because every run produces a trace and that trace is stored somewhere. That's incredibly useful. It means that we can understand the tools that were called, the reasoning that the agent made as it was on its way to making its decision. The artifacts that it referenced. Observability is obviously a critical foundation for building very reliable agents. But I think the challenge really is after the trace is stored or after the log or after the transcript of what the agent did is stored. If the future context that that agent references never changes, then a misguided skill or instruction will mean that the agent will still persist in future runs. The goal or the system that we want to work towards is where a trace stops just being a log and becomes a source of signal. Memory. Agents that are observable tell you what happened. Agents that are adaptive are able to change and guide themselves on the following runs. So, I've mentioned memory. I think it'll really help to define what I mean when I say memory. It's the durable context that an agent references that will guide future runs. A trace, a transcript, or a log is evidence of what happened. It only becomes memory when that lesson is converted into durable context that the agent can reference on future runs. Now, you'll see six things on this slide behind me. Facts, preferences, patterns, previous examples, skills, and instructions. I think that it's helpful to group them into three distinct buckets. A taxonomy that we borrow from cognitive science and actually it applies a lot when we're talking about agents that are language-based. First, there's what the agent knows. This is often referred to as semantic memory. This includes things like the facts and the preferences that guide the way that it responds. Whoops. Then there's what the agent has experienced. And this is the episodic memory. This is the learned patterns that it's seen, past interactions and examples. And finally, there's how the agent should behave. This is also known as procedural memory. And that's the instructions, the skills that you're all probably very familiar with, and the rules that guide how it should behave. Procedural memory is where actually most of the visible gains come from. So in that financial assistant that I gave the example of at the beginning, tone changes that we wanted to promote to the agent and make it follow came in the form of updating its procedural memory. We weren't giving it a new fact or we weren't telling it not to use a banned word. We were giving it a rule to follow as it engages with its users. That's the procedural memory that guides our agent. Another distinction that I want to make, and I think this is very important when thinking about the general agent memory paradigm, is the separation between working memory or short-term memory and long-term memory. Working memory is what the agent is referencing in its current run. So these might be things like intermediate scratch pads. It might be tool results. It might be the files retrieved as part of its operation. Everything that it needs to do to perform its current job. Long-term memory is what exists typically in some data structure or some store somewhere else that has instructions and skills and things that it needs to reference as part of future turns and continuous behavior. Different agent harnesses will leverage and inject long-term memory in different ways, whether you're building your own SDK or using a variety of different popular agent frameworks. Some inject it directly into the prompt. Some will use tools to retrieve that. Some will pull it directly from a store. Some load it through files or some change the runtime state. Some of the memory or some of the context that an agent references is temporary, while some of it is durable and long-term and is useful to guide future runs. And I think that distinction is really important when we think about traces and logs and artifacts that the agent produces as it runs. A trace isn't just a record of the final output. It's a record of how our working memory changed over the course of the run. Some part of that should stay as history. Some part of that should become durable long-term context. And so that's what lends itself to this really helpful mental model that I have, or that I and the team at Langchain and generally I think is a very useful way to think about the relationship between working or short-term memory and long-term memory. It's a read-write cycle. And so you might have heard of sleep time compute or dreaming. Those terms refer to the way that memory is updated or pulled from long-term into short-term whilst the agent is doing work or actually in some cases while the agent is also not doing work. That's the sleep time compute. If we start somewhere at the beginning of an agent run, it needs to read relevant context from long-term memory into its short-term memory. So this is anything relevant, this is anything important for the current run that it has. It might be skills, it might be instructions. You've probably seen progressive disclosure with agents that actually pull in the relevant skills for a certain task. That's that phase moving from long-term memory into short-term memory. Then when the agent runs, it produces a trace. This evidence is really important to us because now we can understand how it retrieves context. The tool calls that it made or the decisions or the sub-agents or anything that's part of its working job. As I mentioned, most evidence should stay as history. If we turned everything that was from a trace, if we turned all of that evidence into long-term memory, then it would make the agent struggle and it would make it harder to reason over future tasks. And so what I think is really interesting is the filter step. How do you decide what is useful signal and what should become durable long-term context? And how do you decide what should stay as history? Once you've made that decision, and we'll get into that in a moment, once you've made that decision, that signal is then written back into durable long-term context. So in the case of our financial assistant, that was be measured and not pointed or not directive, so that it can update the way that it behaves on future turns. And that's the core loop. Memory informs the run. The run makes the evidence. We filter that evidence to make signal, and then we use that signal to update memory. If you can build that flywheel, then we trend towards a place where we can build very reliable and very powerful agents that just feel like they get better with time. And so once we have that mental model, I think an even more simple way to break this down or to abstract this away is capturing what happened, analyzing what might matter, and then updating the context so that future runs can use this. The implementations around how different people building different frameworks are still evolving, but this three-part shape is a really useful starting point. One implementation of this, and I won't claim it's the only implementation, but just to put some concrete structure to what I'm talking about is the way that we do this with Langsmith. The capture step to be able to understand and see the trajectory and the things that the agent did is where our observability comes in. You're able to see the tool calls. You're able to see the way that the agents called sub-agents. You're able to see the context that was retrieved. The analyze step in the middle is something new that I'm really excited about, but basically it's that intelligent process that's doing the background analysis and doing the background work to extract signal from traces based on the things that matter to you and then promoting that signal to the memory store or the point of reference that the agent will use for future runs, and that is Langsmith's context hub. So you can imagine now if there is a place where this analysis can be done, signal can be extracted, a remote store where you can now go and update what's in that so that the agent can pull that down the next time it runs, that is what Langsmith's context hub does. And the abstract loop maps cleanly. You capture the experience, you extract the signal, and then you store that durable context for future runs. To put that in some more detail and also to frame it in the context of the financial assistant that I was speaking about at the beginning and the way that we built this loop, when that agent runs its context is loaded from the context hub and so that might include its instructions, its skills, relevant markdown files that matter to it, policies and rules. When it functions or when we invoke that agent, then a trace is produced. That shows us the failed tool calls or user corrections, or in this case it flagged where our tone strayed from what we wanted it to be. Engine then looks for patterns and then identifies where different static skill markdown files that are based in context hub need to be changed or promoted, and it'll make that change. And then the next time our agent runs, we're able to actually go and understand and see that its tone changes when it interacts with and engages with users. So some things that I and my team have currently or always think about when designing memory, and this should also ideally guide the way that you design and build some of these abstractions, is that agents produce so much, we call it exhaust or we call it feedback. Not everything should become a memory update. And actually the devil is in the details around what should become one as we've discussed over the course of this presentation. It's understanding and deciding what matters to you. Most trace data actually should stay as history, as referenceable history. Some might become data sets to do offline evaluations and things like that. A small segment of that or subset should end up becoming what changes your agent's memory. Now this second one is a gotcha that I ran into a lot. And I think that you tread the fine line of trying to build a system that's optimized, but then also one that has a memory store or updates available to it in the hot path. And what I found was, particularly for long running background agents, right? Imagine if you have an agent that's running over long time horizons and you make some memory updates in the beginning of its operation, but because of the runtime state and because of the way that it's accessing memory, you don't actually access that or that's not available to it for future runs. And so, understanding what you can cache, what you can't cache to be able to make sure that memory updates are available for future runs is very important. And I was having trouble for a while while I was trying to understand why my behavior wasn't changing. And I needed to recognize and think about that second principle. And then the third one as well. I think that OpenClaw and Hermes Agent and a lot of agents that are becoming widely popular that do this self-update process, right? I think that it's another really important consideration of what do you make self-updateable as opposed to what do you make something that needs human review? And so, if we're talking about procedural memory with instructions and policies and tone guidelines, those are probably going to drive about 75% of the behavior of my agent. And so, that actually probably should have some level of human in the loop and human interaction. You should have some way to surface the changes that you make to the parts of the agent's memory that are procedural before actually committing those and putting those in the agent's hot reload path. So, protecting important behavior with evals is another really important third level to this that I find really important. And so, I want to come back to this initial refrain. The next run should be better. Memory allows us to do this. The word memory is thrown around a lot. I think in the context of building agents and working with harnesses and working with providing context to your agent, memory really does give us the ability to do this. And it's more than just a place to store information. It's how experience becomes context. And then that context is how our next runs get the chance to improve. If you're curious about an actual implementation of this, by the way, that QR code has a video of me walking through how I built an agent that does exactly what I've just described. Hopefully, that'll make it tangible and we'll connect some of those dots. And if you want to have any further discussions about this, please come and see me. We're at booth UG19. I'd love to... is a violation of tone. And there were similar instances of this too. And so, to correct that, the review process is manual. You have to have someone understand the traces and understand where its tone slipped, make those changes to the context that it needs to reference when it's giving its tone, and then make sure that there are no regressions as well. Obviously, that doesn't scale, or rather, it's challenging to scale. And so, the system should be, or the system around the agent should be a place where it can continuously learn and benefit from its interactions and its experiences. And that's the version of memory that I want to talk about today. Together, I want to start with the tension that I think a lot of teams have run into. I think all of us here today, the reason why we're at this conference is we're curious, we're building agents. I think we've gotten very good at observing them. But observing them and then turning those observations and those agent experiences into lessons for future runs are obviously very different things. And so, that's where memory comes into play. Agents are producing more signal and more traces than ever before. And this is going to be something that will obviously increase as more agents are built. That's fantastic for us because every run produces a trace and that trace is stored somewhere. That's incredibly useful. It means that we can understand the tools that were called, the reasoning that the agent made as it was on its way to making its decision. The artifacts that it referenced. Observability is obviously a critical foundation for building very reliable agents. But I think the challenge really is after the trace is stored or after the log or after the transcript of what the agent did is stored. If the future context that that agent references never changes, then a misguided skill or instruction will mean that the agent will still persist in future runs. The goal or the system that we want to work towards is where a trace stops just being a log and becomes a source of signal. Memory. Agents that are observable tell you what happened. Agents that are adaptive are able to change and guide themselves on the following runs. So, I've mentioned memory. I think it'll really help to sort of define what I mean when I say memory. It's the durable context that an agent references that will guide future runs. A trace, a transcript, or a log is evidence of what happened. It only becomes memory when that lesson is converted into durable context that the agent can reference on future runs. Now, you'll see six things on this slide behind me. Facts, preferences, patterns, previous examples, skills, and instructions. I think that it's helpful to group them into three distinct buckets. A taxonomy that we borrow from cognitive science and actually it applies a lot when we're talking about agents that are language-based. First, there's what the agent knows. This is often referred to as semantic memory. This includes things like the facts and the preferences that guide the way that it responds. Whoops. Then there's the then there's what the agent has experienced. And this is the episodic memory. This is the learned patterns that it's seen, past interactions and examples. And finally, there's how the agent should behave. This is also known as procedural memory. And that's the instructions, the skills that you're all probably very familiar with, and the rules that guide how it should behave. Procedural memory is where actually most of the visible gains come from. So in that financial assistant that I, the example that I gave at the beginning, tone changes that we wanted to promote to the agent and make it follow came in the form of updating its procedural memory. We weren't giving it a new fact or we weren't telling it not to use a banned word. We were giving it a rule to follow as it engages with its users. That's the procedural memory that guides our agent. Another distinction that I want to make, and I think this is very important when thinking about the general agent, agent memory paradigm, is the separation between working memory or short-term memory and long-term memory. Working memory is what the agent is referencing in its current run. So these might be things like intermediate scratch pads. It might be tool results. It might be the files retrieved as part of its operation. Everything that it needs to do to perform its current job. Long-term memory is what exists typically in some data structure or some store somewhere else that has instructions and skills and things that it needs to reference as part of future turns and and continuous behavior. Different agent harnesses will leverage and inject long-term memory in different ways, whether you're building your own SDK or using a variety of different popular agent frameworks. Some inject it directly into the prompt. Some will use tools to retrieve that. Some will pull it directly from a store. Some load it through files or some change the runtime state. Some of the memory or some of the context that an agent references is temporary, while some of it is durable and long-term and is useful to guide future runs. And I think that distinction is really important when we think about traces and logs and artifacts that the agent produces as it runs. A trace isn't just a record of the final output. It's a record of how our working memory changed over the course of the run. Some part of that should stay as history. Some part of that should become durable long-term context. And so that's what lends itself to this really helpful mental model that I have, or that I and the team at Langchain and generally I think is a very useful way to sort of think about the relationship between working or short-term memory and long-term memory. It's a read-write cycle. And so you might have heard of sleep time compute or dreaming. Those terms refer to the way that memory is updated or pulled from long-term into short-term whilst the agent is doing work or actually in some cases while the agent is also not doing work. That's the sleep time compute. If we start somewhere at the beginning of an agent run, it needs to read relevant context from long-term memory into its short-term memory. So this is anything relevant, this is anything important for the current run that it has. It might be skills, it might be instructions. You've probably seen progressive disclosure with agents that actually pull in the relevant skills for a certain task. That's that phase moving from long-term memory into short-term memory. Then when the agent runs, it produces a trace. This evidence is really important to us because now we can understand how it retrieves context. The tool calls that it made or the decisions or the sub-agents or anything that's part of its working job. As I mentioned, most evidence should stay as history. If we turned everything that was from a trace, if we turned all of that evidence into long-term memory, then it would make the agent struggle and it would make it harder to reason over future tasks. And so what I think is really interesting is the filter step. How do you decide what is useful signal and what should become durable long-term context? And how do you decide what should stay as history? Once you've made that decision, and we'll get into that in a moment, once you've made that decision, that signal is then written back into durable long-term context. So in the case of our financial assistant, that was be measured and not pointed or not directive, so that it can update the way that it behaves on future turns. And that's the core loop. Memory informs the run. The run makes the evidence. We filter that evidence to make signal, and then we use that signal to update memory. If you can build that flywheel, then we trend towards a place where we can build very reliable and very powerful agents that just feel like they get better with time. And so once we have that mental model, I think an even more simple way to break this down or to abstract this away is capturing what happened, analyzing what might matter, and then updating the context so that future runs can use this. The implementations around how different people building different frameworks are still evolving, but this three-part shape is a really useful starting point. One implementation of this, and I won't claim it's the only implementation, but just to kind of like put some concrete structure to what I'm talking about is the way that we do this with Langsmith. The capture step to be able to understand and see the trajectory and the things that the agent did is where our observability comes in. You're able to see the tool calls. You're able to see the way that the agents called sub-agents. You're able to see the context that was retrieved. The analyze step in the middle is something new that I'm really excited about, but basically it's that intelligent process that's doing the background analysis and doing the background work to extract signal from traces based on the things that matter to you and then promoting that signal to the memory store or the point of reference that the agent will use for future runs, and that is Langsmith's context hub. So you can imagine now if there is a place where this analysis can be done, signal can be extracted, a remote store where you can now go and update what's in that so that the agent can pull that down the next time it runs, that is what Langsmith's context hub does. And the abstract loop maps cleanly. You capture the experience, you extract the signal, and then you store that durable context for future runs. To kind of put that in some more detail and also to frame it in the context of the financial assistant that I was speaking about at the beginning and sort of the way that we built this loop, when that agent runs its context is loaded from the context sub and so that might include its instructions, its skills, relevant markdown files that matter to it, policies and rules. When it functions or when we invoke that agent, then a trace is produced. That shows us the failed tool calls or user corrections, or in this case it flagged where our tone strayed from what we wanted it to be. Engine then looks for patterns and then identifies where different static skill markdown files that are based in context hub need to be changed or promoted, and it'll make that change. And then the next time our agent runs, we're able to actually go and understand and see that its tone changes when it interacts with and engages with users. So some things that I and my team have currently or kind of always think about when designing memory, and this should also as well ideally guide the way that you design and build some of these abstractions, is that agents produce so much, we call it exhaust or we call it kind of like feedback, not everything should become a memory update. And actually the devil is in the details around what should become one as we've sort of discussed over the course of this presentation. It's understanding and deciding what matters to you. You know, most trace data actually should stay as history, as referenceable history. Some might become data sets to do offline evaluations and things like that. A small segment of that or subset should end up becoming what changes your agent's memory. Now this second one is sort of like a gotcha that I ran into a lot. And I think that you sort of tread the fine line of trying to build a system that's optimized, but then also one that has a memory store or updates available to it in the hot path. And what I found was, particularly for long running background agents, right? Imagine if you have an agent that's running over long time horizons and you make some memory updates in the beginning of its operation, but because of the runtime state and because of the way that it's accessing memory, you don't actually access that or that's not available to it for future runs. And so, you know, understanding what you can cache, what you can't cache to be able to make sure that memory updates are available for future runs. Very important. And sort of, I was banging my head on a wall for a while while I was trying to sort of understand why my behavior wasn't changing. And I needed to recognize and think about that second principle. And then the third one as well. I think that OpenClaw and, you know, Hermes Agent and a lot of agents that are becoming widely popular that sort of do this self-update process, right? I think that it's another really important consideration of like, what do you make self-updateable as opposed to what do you make something that needs human review? And so, if we're talking about procedural memory with instructions and policies and tone guidelines, those are probably going to drive about 75% of the behavior of my agent. And so, that actually probably should have some level of human in the loop and human interaction. You should have some way to surface it. The changes that you make to the parts of the agent's memory that are procedural before actually committing those and putting those in the agent's sort of like hot reload path. So, protecting important behavior with evals is, I guess, another really important third kind of like level to this that I find really important. And so, I want to come back to this initial refrain. The next run should be better. Memory allows us to do this. The word memory is thrown around a lot. I think in the context of building agents and working with harnesses and working with like providing context to your agent, memory really does give us the ability to do this. And it's more than just a place to store information. It's how experience becomes context. And then that context is how our next runs get the chance to improve. If you're curious about an actual implementation of this, by the way, that QR code has a video of me walking through how I built an agent that does exactly what I've just described. Hopefully, that'll kind of like make it tangible and and we'll sort of connect some of those dots. And if you want to have any further discussions about this, please come and see me. We're at booth, UG19. I'd love to...