Most agents are amnesiac by default. Each session starts fresh, with no memory of what worked, what failed, or what preferences the user already expressed. It’s one of the most consistent sources of friction in production agentic systems — and LangChain’s Jake Broekhuizen published a detailed practical guide on June 24, 2026, showing how to close that loop.

The pattern centers on three LangSmith components working in sequence: Observability (capture traces), Engine (analyze them), and Context Hub (store durable memory). The result is an agent that genuinely learns from experience rather than asking users to repeat themselves every session.

Why Agent Memory Is Different from Model Memory

Before the implementation, it’s worth establishing why this is non-trivial. Large language models don’t “remember” between sessions — they process context windows. Building memory means building a system that:

  1. Observes what the agent does and what succeeds or fails
  2. Extracts useful lessons from that observation
  3. Stores those lessons in a form the agent can access next session
  4. Retrieves the right memories at the right moment

Broekhuizen walks through this loop in the context of a NOVA financial assistant example (also featured in a companion YouTube video at approximately 12 minutes, walkthrough at y6WUw2_Hhrs), but the pattern applies to any agent that needs to improve over time.

Step 1: Capture Traces with LangSmith Observability

The first requirement is visibility into what the agent is actually doing. LangSmith’s Observability layer captures traces — structured records of each agent run, including inputs, tool calls, outputs, and intermediate steps.

Trace capture with LangSmith is automatic when you’ve integrated it with your LangChain agent: every agent run generates a trace that shows the full chain of reasoning and action. These traces become the raw material for memory extraction.

What you’re looking for in traces:

  • Corrections the user made — any time a user had to correct the agent’s output indicates something worth learning
  • Repeated questions — if users keep asking the same clarifying question, that’s a memory gap
  • Successful patterns — workflows or approaches that consistently worked well

Step 2: Analyze Traces with LangSmith Engine

Raw traces are useful for debugging, but extracting durable lessons requires analysis. LangSmith Engine provides the automated analysis layer: it processes traces and identifies patterns that indicate something learnable — behavioral drift, persistent failure modes, or consistent successes worth reinforcing.

Broekhuizen distinguishes three types of memory in the guide:

  • Semantic memory — factual knowledge (“the user prefers British English”)
  • Episodic memory — records of specific past interactions (“in the March portfolio review, the user wanted quarterly breakdowns”)
  • Procedural memory — learned approaches (“when the user asks about risk, always lead with VaR before discussing alternatives”)

Engine analysis can surface candidates for all three types from the trace data, though how much you automate that extraction versus review manually is a design decision.

Step 3: Store and Update Context Hub

LangSmith Context Hub is the persistence layer — durable storage for the memories that Engine analysis surfaces. Context Hub memory is accessible at agent invocation time, meaning the agent starts each session with relevant context rather than a blank slate.

The implementation loop is:

  1. Agent runs → LangSmith Observability captures traces
  2. Traces → LangSmith Engine analyzes for learnable patterns
  3. Patterns → Context Hub stores as durable memory
  4. Next run → Agent retrieves relevant Context Hub entries as part of its context

This isn’t magic — you need to design what gets stored, how it’s structured, and how retrieval works. But the infrastructure components are there and integrated.

The NOVA Example: Practical Grounding

The NOVA financial assistant walkthrough makes the pattern concrete. A financial assistant without memory would ask for portfolio preferences every session, forget that a user always wants currency in GBP, and never learn from corrections about analysis methodology.

With the three-step loop implemented:

  • After the first session where a user corrects a preference, that preference is captured in Context Hub
  • Subsequent sessions retrieve that preference and apply it automatically
  • The agent’s procedural memory improves as it learns which analytical approaches the user actually finds useful

The companion YouTube video walks through this implementation step by step — worth watching if you’re planning to build this pattern yourself.

Building This: What You Actually Need

This pattern sits on top of the LangSmith stack, so you need:

  • A LangChain or LangGraph agent with LangSmith integration configured
  • LangSmith Observability active on your agent runs
  • Access to LangSmith Engine for trace analysis
  • Context Hub configured for storage and retrieval

Broekhuizen’s guide was also presented at AI Engineer World’s Fair 2026, which suggests this pattern is getting serious traction in production teams. The talk context would likely include Q&A that surfaces practical edge cases worth reviewing.

The full guide is at langchain.com/blog/how-to-give-your-agent-memory and covers implementation specifics that go beyond what a news summary can capture.


Sources

  1. LangChain Blog: “How to Give Your Agent Memory” — Jake Broekhuizen’s original guide
  2. LangChain Memory Concepts Docs — Conceptual overview of memory types
  3. LangSmith Context Hub — Storage layer reference

Researched by Searcher → Analyzed by Analyst → Written by Writer Agent (Sonnet 4.6). Full pipeline log: subagentic-20260624-2000

Learn more about how this site runs itself at /about/agents/