AI innovator LangChain today announced the launch of LangMem SDK, a cutting-edge development toolkit designed to empower AI Agents with long-term memory capabilities. The release of the LangMem SDK marks a critical step in the evolution of Agent technology, which will help developers build AI Agents that can learn, evolve, and deliver more personalized experiences over time.
Agent Memory Difficulties: Short versus Long Term
Memory management is critical in building intelligent agents, which need memory to learn user preferences, acquire domain knowledge, and adjust behaviors based on past experiences. However, traditional agent memory solutions often have limitations, especially in dealing with long-term memory. agents may forget important user details and fail to continuously optimize their behavior, resulting in a limited user experience.
The LangMem SDK was created to solve the problem of long-term memory for Agents. It provides a set of tools to help developers build Agents with persistent memory that can learn from past conversations and interactions and progress like humans.
LangMem SDK: A Powerful Tool for Building Agent Long-Term Memories
The LangMem SDK provides the following core features to help developers easily build Agents with long-term memory:
- Extraction of information: The ability to intelligently extract key information from an Agent's conversations and interactions lays the foundation for the construction of long-term memories.
- Prompt Optimization: Supports dynamic updating and optimization of Prompts based on Agent performance and user feedback, enabling continuous improvement of Agent behavior.
- Long-term memory management: Provide flexible APIs to facilitate developers to choose the right storage system according to their own needs and build Agent's long-term memory to store behavioral patterns, factual knowledge and important events.
It's worth noting that the LangMem SDK not only integrates flexibly with any storage system and Agent framework, but also with the LangGraph s long-term memory layer enables native docking, providing developers with a more convenient development experience.
To further lower the development barrier, LangChain has also launched the LangMem hosting service, which provides developers with additional long-term memory resources for free. Developers interested in using the LangMem SDK in their production environments canClick hereRegister for the experience.
Multiple memory types for a smarter Agent
LangChain has found in Agent memory research that different types of memories play different roles in the learning and adaptation process of an Agent. the LangMem SDK focuses on supporting the following three key memory types:
Semantic memory: facts and knowledge
semantic memory It is used to store factual knowledge and domain information that the Agent needs to master. For example, an Agent can use semantic memory to remember user preferences, product knowledge bases, or complex conceptual relationships. This allows the Agent to respond based on accurate factual information, avoiding "hallucination" problems.
As the LangChain example shows, semantic memory can help an Agent remember team members and project information:
code example
memories = [
ExtractedMemory(
id="27e96a9d-8e53-4031-865e-5ec50c1f7ad5",
content=Memory(
content="Alice 管理 ML 团队并指导 Bob,Bob 也是团队成员。"
),
),
ExtractedMemory(
id="e2f6b646-cdf1-4be1-bb40-0fd91d25d00f",
content=Memory(
content="Bob 现在领导 ML 团队和 NLP 项目。"
),
),
]
Procedural memory: the evolution of behavioral patterns
procedural memory The LangMem SDK focuses on learning and optimizing Agent behavior patterns. Through procedural memory, agents can continuously learn how to interact with users more effectively in different scenarios and adjust their response strategies.LangMem SDK supports agents to learn from successful and unsuccessful interactions through the Prompt Optimization Mechanism and automatically update the Prompts to improve the agent's behavioral patterns.
For example, an Astronomy Assistant Agent can continuously optimize the way it explains astronomical concepts to be more relevant to the user's level of knowledge through procedural memory:
code example
"""
你是一个乐于助人的助手...
如果用户询问天文学,请使用真实世界的例子和最新的科学数据清晰地解释相关主题。
在有帮助的时候使用视觉参考,并根据用户的知识水平进行调整。
平衡实践观测天文学和理论概念,根据用户需求提供观测建议或技术解释。
"""
Situational memory: events and experiences
situational memory Instead, it focuses on recording the specific interaction events and experiences between the Agent and the user. Through situational memory, the Agent can review past conversations, understand the user's intention in a specific situation, and adjust the current dialog strategy based on past experience. Situational memory is especially important in dealing with complex dialog scenarios and tasks that require contextual understanding.
Experience the LangMem SDK today and start your Agent's journey into long-term memory!
The release of the LangMem SDK reinvigorates the future of Agent technology. With the LangMem SDK, developers can build smarter, more personalized, and growing AI Agents that provide users with a smarter experience than ever before.
Visit now LangMem SDK DocumentationLearn more about how to build custom memory systems with the LangMem SDK.