Back office ops · Production

How LangChain built the memory system for LangSmith Agent Builder

The problem

Task-specific agents that execute the same workflow repeatedly need persistent memory across sessions; without it, users must repeat their preferences to the agent in every session, which would be a fundamentally poor experience. Most AI products launch without memory, but LangSmith Agent Builder's design made it a necessity.

First attempt

During development, the agent failed in multiple ways: not remembering when it should, remembering when it should not, routing memory to the wrong file type, generating files with invalid schemas, and failing to generalize specific learnings into compact rules.

Workflow diagram · grounded in source
1
Builder creates task-specific agent
trigger
“In LangSmith Agent Builder, builders will create an agent to automate a particular workflow or part of their day”
2
Agent executes task
ai_action
“The agent produces paragraph summaries”
3
User corrects agent in natural language
human_review
“You correct it: "Use bullet points instead."”
4
Agent edits its own memory files
ai_action
“The agent edits AGENTS.md”
5
Schema validation of updated files
validation
“We added a step to explicitly validate these custom shapes, and, if validation failed, throw any errors back to the LLM instead of committing the file”
6
Human approves memory update
human_review
“we made all edits to memory human-in-the-loop – that is, we require explicit human approval before updating. This was largely done to minimize the potential attack vector of prompt injection. We do expose a way for users to turn this off…”
7
Agent reads memory and applies preferences
feedback_loop
“It reads its memory and uses bullet points automatically. No reminder needed.”
Reported outcome

LangChain shipped a file-based memory system backed by Postgres, with human-in-the-loop approval and schema validation, enabling agents to build their own AGENTS.md through natural-language corrections without any upfront manual configuration.

Reported metrics
candidates sourced per LinkedIn search~50 candidates
Prompting effort for memory systemone person working full time on prompting for memory
User instruction repetition eliminatedNo reminder needed
Reported stack
LangSmith Agent BuilderPostgresMCPAGENTS.mdLinkedIn
Source
https://blog.langchain.com/how-we-built-agent-builders-memory-system/
Read source ↗

Frequently asked questions

What did this team achieve with this AI workflow?

LangChain shipped a file-based memory system backed by Postgres, with human-in-the-loop approval and schema validation, enabling agents to build their own AGENTS.md through natural-language corrections without any upf…

What tools did this team use?

LangSmith Agent Builder, Postgres, MCP, AGENTS.md, LinkedIn.

What results were reported?

candidates sourced per LinkedIn search: ~50 candidates; Prompting effort for memory system: one person working full time on prompting for memory; User instruction repetition eliminated: No reminder needed (source-reported, not independently verified).

What failed first in this deployment?

During development, the agent failed in multiple ways: not remembering when it should, remembering when it should not, routing memory to the wrong file type, generating files with invalid schemas, and failing to gener…

How is this back office ops AI workflow structured?

Builder creates task-specific agent → Agent executes task → User corrects agent in natural language → Agent edits its own memory files → Schema validation of updated files → Human approves memory update → Agent reads memory and applies preferences.