Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

Story

LangChain v1 Context and Memory

AI summary

A learning summary for LangChain v1 distinguishes the context supplied during a model call from memory persisted across calls. It explains how LangGraph Checkpointer provides thread-scoped short-term memory, while LangGraph Store holds cross-session facts selected through namespaces and keys. The summary also describes using thread_id for individual conversations and user_id for a user's broader memory, identifies common implementation mistakes, and notes that InMemorySaver is intended for development and debugging while database-backed savers such as PostgresSaver and SqliteSaver are presented as production alternatives. It further covers Summarization and Context Editing middleware for managing context growth.

In-depth insight

The report gives developers a practical way to distinguish conversation-scoped state from cross-session facts and to select persistence and middleware mechanisms based on how long the data should be retained.

LangChain 上下文与记忆 学习总结

适用版本:LangChain v1 / createAgent + LangGraph。核心原则:上下文是“喂给模型什么”,记忆是“跨调用存什么”,两者通过中间件和持久化机制衔接。


一、先分清两个概念

1. 上下文(Context)—— 单次调用的输入

上下文工程(Context Engineering)的目标是:在正确的时间,把正确的信息以正确的格式交给 LLM。Agent 失败的两大原因,一是模型能力不够,二是“对的上下文”没传进去。

#LangChain#LangGraph#createAgent#LangGraph Checkpointer#LangGraph Store

Original · 5 min readRead the original
Group chat

No comments yet. Start the conversation.