[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-langchain-ai--langmem":3,"tool-langchain-ai--langmem":62},[4,18,26,36,46,54],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",158594,2,"2026-04-16T23:34:05",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":42,"last_commit_at":43,"category_tags":44,"status":17},8272,"opencode","anomalyco\u002Fopencode","OpenCode 是一款开源的 AI 编程助手（Coding Agent），旨在像一位智能搭档一样融入您的开发流程。它不仅仅是一个代码补全插件，而是一个能够理解项目上下文、自主规划任务并执行复杂编码操作的智能体。无论是生成全新功能、重构现有代码，还是排查难以定位的 Bug，OpenCode 都能通过自然语言交互高效完成，显著减少开发者在重复性劳动和上下文切换上的时间消耗。\n\n这款工具专为软件开发者、工程师及技术研究人员设计，特别适合希望利用大模型能力来提升编码效率、加速原型开发或处理遗留代码维护的专业人群。其核心亮点在于完全开源的架构，这意味着用户可以审查代码逻辑、自定义行为策略，甚至私有化部署以保障数据安全，彻底打破了传统闭源 AI 助手的“黑盒”限制。\n\n在技术体验上，OpenCode 提供了灵活的终端界面（Terminal UI）和正在测试中的桌面应用程序，支持 macOS、Windows 及 Linux 全平台。它兼容多种包管理工具，安装便捷，并能无缝集成到现有的开发环境中。无论您是追求极致控制权的资深极客，还是渴望提升产出的独立开发者，OpenCode 都提供了一个透明、可信",144296,1,"2026-04-16T14:50:03",[13,45],"插件",{"id":47,"name":48,"github_repo":49,"description_zh":50,"stars":51,"difficulty_score":32,"last_commit_at":52,"category_tags":53,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":55,"name":56,"github_repo":57,"description_zh":58,"stars":59,"difficulty_score":32,"last_commit_at":60,"category_tags":61,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[45,13,15,14],{"id":63,"github_repo":64,"name":65,"description_en":66,"description_zh":67,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":66,"owner_location":66,"owner_email":77,"owner_twitter":74,"owner_website":78,"owner_url":79,"languages":80,"stars":89,"forks":90,"last_commit_at":91,"license":92,"difficulty_score":32,"env_os":93,"env_gpu":93,"env_ram":93,"env_deps":94,"category_tags":98,"github_topics":66,"view_count":32,"oss_zip_url":66,"oss_zip_packed_at":66,"status":17,"created_at":99,"updated_at":100,"faqs":101,"releases":132},8335,"langchain-ai\u002Flangmem","langmem",null,"langmem 是一款专为智能体（Agent）设计的开源记忆管理工具，旨在让 AI 在长期交互中不断学习和适应。它解决了传统 AI 模型“聊完即忘”、无法跨会话保持个性化偏好和行为一致性的痛点。通过提供核心的记忆 API 和专用工具，langmem 能自动从对话中提取关键信息，优化提示词策略，并维护长期的知识库，使智能体能够像人类一样随着交流深入而变得更“懂”用户。\n\n该工具特别适合开发者和技术研究人员使用，尤其是那些基于 LangGraph 框架构建复杂智能体应用的人群。其独特亮点在于既提供了可适配任意存储系统的通用功能原语，又原生集成了 LangGraph 的长期记忆存储层，实现了开箱即用的高效持久化。此外，langmem 支持“热路径”下的实时记忆操作，允许智能体在对话过程中主动记录或检索信息；同时配备后台记忆管理器，能自动 Consolidate（整合）和更新知识，无需人工干预。只需几行代码，开发者即可赋予智能体自主管理记忆的能力，使其在无特殊指令的情况下，自然地完成从“记住用户喜欢深色模式”到“跨会话调用该偏好”的完整闭环，显著提升用户体验与系统智能化水平。","# LangMem\n\nLangMem helps agents learn and adapt from their interactions over time.\n\nIt provides tooling to extract important information from conversations, optimize agent behavior through prompt refinement, and maintain long-term memory.\n\nIt offers both functional primitives you can use with any storage system and native integration with LangGraph's storage layer.\n\nThis lets your agents continuously improve, personalize their responses, and maintain consistent behavior across sessions.\n\n## Key features\n\n- 🧩 **Core memory API** that works with any storage system\n- 🧠 **Memory management tools** that agents can use to record and search information during active conversations \"in the hot path\"\n- ⚙️ **Background memory manager** that automatically extracts, consolidates, and updates agent knowledge\n- ⚡ **Native integration with LangGraph's Long-term Memory Store**, available by default in all LangGraph Platform deployments\n\n## Installation\n\n```bash\npip install -U langmem\n```\n\nConfigure your environment with an API key for your favorite LLM provider:\n\n```bash\nexport ANTHROPIC_API_KEY=\"sk-...\"  # Or another supported LLM provider\n```\n\n## Creating an Agent\n\nHere's how to create an agent that actively manages its own long-term memory in just a few lines:\n\n```python\n# Import core components (1)\nfrom langgraph.prebuilt import create_react_agent\nfrom langgraph.store.memory import InMemoryStore\nfrom langmem import create_manage_memory_tool, create_search_memory_tool\n\n# Set up storage (2)\nstore = InMemoryStore(\n    index={\n        \"dims\": 1536,\n        \"embed\": \"openai:text-embedding-3-small\",\n    }\n) \n\n# Create an agent with memory capabilities (3)\nagent = create_react_agent(\n    \"anthropic:claude-3-5-sonnet-latest\",\n    tools=[\n        # Memory tools use LangGraph's BaseStore for persistence (4)\n        create_manage_memory_tool(namespace=(\"memories\",)),\n        create_search_memory_tool(namespace=(\"memories\",)),\n    ],\n    store=store,\n)\n```\n\n1. The memory tools work in any LangGraph app. Here we use [`create_react_agent`](https:\u002F\u002Flangchain-ai.github.io\u002Flanggraph\u002Freference\u002Fprebuilt\u002F#langgraph.prebuilt.create_react_agent) to run an LLM with tools, but you can add these tools to your existing agents or build [custom memory systems](concepts\u002Fconceptual_guide.md#functional-core) without agents.\n\n2. [`InMemoryStore`](https:\u002F\u002Flangchain-ai.github.io\u002Flanggraph\u002Freference\u002Fstore\u002F#langgraph.store.memory.InMemoryStore) keeps memories in process memory—they'll be lost on restart. For production, use the [AsyncPostgresStore](https:\u002F\u002Flangchain-ai.github.io\u002Flanggraph\u002Freference\u002Fstore\u002F#langgraph.store.postgres.AsyncPostgresStore) or a similar DB-backed store to persist memories across server restarts.\n\n3. The memory tools ([`create_manage_memory_tool`](reference\u002Ftools.md#langmem.create_manage_memory_tool) and [`create_search_memory_tool`](reference\u002Ftools.md#langmem.create_search_memory_tool)) let you control what gets stored. The agent extracts key information from conversations, maintains memory consistency, and knows when to search past interactions. See [Memory Tools](guides\u002Fmemory_tools.md) for configuration options.\n\nThen use the agent:\n\n```python\n# Store a new memory (1)\nagent.invoke(\n    {\"messages\": [{\"role\": \"user\", \"content\": \"Remember that I prefer dark mode.\"}]}\n)\n\n# Retrieve the stored memory (2)\nresponse = agent.invoke(\n    {\"messages\": [{\"role\": \"user\", \"content\": \"What are my lighting preferences?\"}]}\n)\nprint(response[\"messages\"][-1].content)\n# Output: \"You've told me that you prefer dark mode.\"\n```\n\n1. The agent gets to decide what and when to store the memory. No special commands needed—just chat normally and the agent uses [`create_manage_memory_tool`](reference\u002Ftools.md#langmem.create_manage_memory_tool) to store relevant details.\n\n2. The agent maintains context between chats. When you ask about previous interactions, the LLM can invoke [`create_search_memory_tool`](reference\u002Ftools.md#langmem.create_search_memory_tool) to search for memories with similar content. See [Memory Tools](guides\u002Fmemory_tools.md) to customize memory storage and retrieval, and see the [hot path quickstart](https:\u002F\u002Flangchain-ai.github.io\u002Flangmem\u002Fhot_path_quickstart) for a more complete example on how to include memories without the agent having to explicitly search.\n\nThe agent can now store important information from conversations, search its memory when relevant, and persist knowledge across conversations.\n\n> [!TIP]\n> For developing, debugging, and deploying AI agents and LLM applications, see [LangSmith](https:\u002F\u002Fdocs.langchain.com\u002Flangsmith\u002Fhome).\n\n## Next Steps\n\nFor more examples and detailed documentation:\n\n- [Hot Path Quickstart](https:\u002F\u002Flangchain-ai.github.io\u002Flangmem\u002Fhot_path_quickstart) - Learn how to let your LangGraph agent manage its own memory \"in the hot path\"\n- [Background Quickstart](https:\u002F\u002Flangchain-ai.github.io\u002Flangmem\u002Fbackground_quickstart) - Learn how to use a memory manager \"in the background\"\n- [Core Concepts](https:\u002F\u002Flangchain-ai.github.io\u002Flangmem\u002Fconcepts\u002Fconceptual_guide) - Learn key ideas\n- [API Reference](https:\u002F\u002Flangchain-ai.github.io\u002Flangmem\u002Freference) - Full function documentation\n- Build RSI 🙂 \n","# LangMem\n\nLangMem 帮助智能体在与用户的交互中不断学习和适应。\n\n它提供了一系列工具，用于从对话中提取重要信息、通过优化提示来改进智能体的行为，并维护长期记忆。\n\nLangMem 既提供了可与任何存储系统配合使用的功能原语，也与 LangGraph 的存储层实现了原生集成。\n\n这使得您的智能体能够持续改进、个性化回复，并在不同会话中保持一致的行为。\n\n## 核心特性\n\n- 🧩 **核心记忆 API**，可与任何存储系统兼容\n- 🧠 **记忆管理工具**，智能体可在活跃对话的“热路径”中记录和检索信息\n- ⚙️ **后台记忆管理器**，自动提取、整合并更新智能体的知识\n- ⚡ **与 LangGraph 长期记忆存储的原生集成**，默认适用于所有 LangGraph 平台部署\n\n## 安装\n\n```bash\npip install -U langmem\n```\n\n请使用您喜爱的 LLM 提供商的 API 密钥配置环境变量：\n\n```bash\nexport ANTHROPIC_API_KEY=\"sk-...\"  # 或其他支持的 LLM 提供商\n```\n\n## 创建智能体\n\n以下是如何仅用几行代码创建一个能够主动管理自身长期记忆的智能体：\n\n```python\n# 导入核心组件 (1)\nfrom langgraph.prebuilt import create_react_agent\nfrom langgraph.store.memory import InMemoryStore\nfrom langmem import create_manage_memory_tool, create_search_memory_tool\n\n# 设置存储 (2)\nstore = InMemoryStore(\n    index={\n        \"dims\": 1536,\n        \"embed\": \"openai:text-embedding-3-small\",\n    }\n) \n\n# 创建具备记忆能力的智能体 (3)\nagent = create_react_agent(\n    \"anthropic:claude-3-5-sonnet-latest\",\n    tools=[\n        # 记忆工具使用 LangGraph 的 BaseStore 进行持久化 (4)\n        create_manage_memory_tool(namespace=(\"memories\",)),\n        create_search_memory_tool(namespace=(\"memories\",)),\n    ],\n    store=store,\n)\n```\n\n1. 记忆工具可以在任何 LangGraph 应用中使用。这里我们使用 [`create_react_agent`](https:\u002F\u002Flangchain-ai.github.io\u002Flanggraph\u002Freference\u002Fprebuilt\u002F#langgraph.prebuilt.create_react_agent) 来运行带有工具的 LLM，但您也可以将这些工具添加到现有智能体中，或者在没有智能体的情况下构建[自定义记忆系统](concepts\u002Fconceptual_guide.md#functional-core)。\n\n2. [`InMemoryStore`](https:\u002F\u002Flangchain-ai.github.io\u002Flanggraph\u002Freference\u002Fstore\u002F#langgraph.store.memory.InMemoryStore) 将记忆保存在进程内存中——重启后数据会丢失。在生产环境中，请使用 [AsyncPostgresStore](https:\u002F\u002Flangchain-ai.github.io\u002Flanggraph\u002Freference\u002Fstore\u002F#langgraph.store.postgres.AsyncPostgresStore) 或类似的基于数据库的存储，以确保记忆在服务器重启后仍能持久化。\n\n3. 记忆工具（`create_manage_memory_tool` 和 `create_search_memory_tool`）允许您控制哪些内容会被存储。智能体会从对话中提取关键信息，保持记忆的一致性，并判断何时需要搜索过往交互。有关配置选项，请参阅 [记忆工具](guides\u002Fmemory_tools.md)。\n\n接下来即可使用该智能体：\n\n```python\n# 存储一条新记忆 (1)\nagent.invoke(\n    {\"messages\": [{\"role\": \"user\", \"content\": \"记住我偏好暗色模式。\"}]}\n)\n\n# 检索已存储的记忆 (2)\nresponse = agent.invoke(\n    {\"messages\": [{\"role\": \"user\", \"content\": \"我的显示偏好是什么？\"}]}\n)\nprint(response[\"messages\"][-1].content)\n# 输出： \"你曾告诉我你偏好暗色模式。\"\n```\n\n1. 智能体会自行决定存储什么以及何时存储。无需特殊指令——只需正常聊天，智能体就会利用 `create_manage_memory_tool` 存储相关细节。\n\n2. 智能体会在不同会话之间保持上下文连贯。当您询问之前的交互时，LLM 可以调用 `create_search_memory_tool` 来搜索相关内容的记忆。请参阅 [记忆工具](guides\u002Fmemory_tools.md)，以自定义记忆的存储和检索方式；同时，建议阅读 [热路径快速入门](https:\u002F\u002Flangchain-ai.github.io\u002Flangmem\u002Fhot_path_quickstart)，获取更完整的示例，展示如何在不需智能体显式搜索的情况下融入记忆功能。\n\n现在，该智能体已经能够存储对话中的重要信息、在必要时检索记忆，并在不同会话间持久化知识。\n\n> [!TIP]\n> 如需开发、调试和部署 AI 智能体及 LLM 应用程序，请参阅 [LangSmith](https:\u002F\u002Fdocs.langchain.com\u002Flangsmith\u002Fhome)。\n\n## 后续步骤\n\n更多示例和详细文档：\n\n- [热路径快速入门](https:\u002F\u002Flangchain-ai.github.io\u002Flangmem\u002Fhot_path_quickstart) - 学习如何让您的 LangGraph 智能体在“热路径”中自主管理记忆\n- [后台快速入门](https:\u002F\u002Flangchain-ai.github.io\u002Flangmem\u002Fbackground_quickstart) - 学习如何使用后台记忆管理器\n- [核心概念](https:\u002F\u002Flangchain-ai.github.io\u002Flangmem\u002Fconcepts\u002Fconceptual_guide) - 了解关键理念\n- [API 参考](https:\u002F\u002Flangchain-ai.github.io\u002Flangmem\u002Freference) - 完整的功能文档\n- 构建 RSI 🙂","# LangMem 快速上手指南\n\nLangMem 是一款帮助 AI Agent 从交互中学习并适应的工具。它提供了从对话中提取关键信息、优化提示词以及维护长期记忆的功能，支持任意存储系统，并能与 LangGraph 的存储层原生集成。\n\n## 环境准备\n\n在开始之前，请确保满足以下条件：\n\n*   **Python 版本**：建议 Python 3.9 或更高版本。\n*   **前置依赖**：需要安装 `langgraph` 相关库（安装 langmem 时通常会自动处理依赖）。\n*   **LLM API Key**：你需要一个支持的 LLM 提供商 API Key（如 Anthropic、OpenAI 等）。本指南以 Anthropic 为例。\n\n## 安装步骤\n\n使用 pip 安装最新版本的 langmem：\n\n```bash\npip install -U langmem\n```\n\n配置环境变量，设置你的 LLM 提供商 API Key：\n\n```bash\nexport ANTHROPIC_API_KEY=\"sk-...\"  # 替换为你实际的 Anthropic API Key\n# 如果使用 OpenAI，请 export OPENAI_API_KEY=\"sk-...\"\n```\n\n> **提示**：国内开发者若遇到下载慢的问题，可使用国内镜像源安装：\n> ```bash\n> pip install -U langmem -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n> ```\n\n## 基本使用\n\n以下示例展示如何创建一个具备长期记忆能力的 Agent，使其能够记住用户偏好并在后续对话中检索。\n\n### 1. 创建具备记忆功能的 Agent\n\n```python\n# 导入核心组件\nfrom langgraph.prebuilt import create_react_agent\nfrom langgraph.store.memory import InMemoryStore\nfrom langmem import create_manage_memory_tool, create_search_memory_tool\n\n# 设置存储 (开发测试使用内存存储，生产环境建议改用 AsyncPostgresStore)\nstore = InMemoryStore(\n    index={\n        \"dims\": 1536,\n        \"embed\": \"openai:text-embedding-3-small\",\n    }\n) \n\n# 创建带有记忆工具的 Agent\nagent = create_react_agent(\n    \"anthropic:claude-3-5-sonnet-latest\",\n    tools=[\n        # 记忆工具使用 LangGraph 的 BaseStore 进行持久化\n        create_manage_memory_tool(namespace=(\"memories\",)),\n        create_search_memory_tool(namespace=(\"memories\",)),\n    ],\n    store=store,\n)\n```\n\n### 2. 测试记忆存储与检索\n\n**存储记忆**：直接告诉 Agent 需要记住的信息，它会自动调用工具进行存储。\n\n```python\n# 存储新记忆\nagent.invoke(\n    {\"messages\": [{\"role\": \"user\", \"content\": \"Remember that I prefer dark mode.\"}]}\n)\n```\n\n**检索记忆**：在后续对话中询问相关信息，Agent 会自动搜索记忆并回答。\n\n```python\n# 检索已存储的记忆\nresponse = agent.invoke(\n    {\"messages\": [{\"role\": \"user\", \"content\": \"What are my lighting preferences?\"}]}\n)\nprint(response[\"messages\"][-1].content)\n# 输出示例：\"You've told me that you prefer dark mode.\"\n```\n\n### 注意事项\n*   **存储持久化**：上述示例使用的 `InMemoryStore` 仅在进程运行期间有效，重启后数据会丢失。生产环境请使用 `AsyncPostgresStore` 或其他数据库支持的存储方案。\n*   **自动化**：无需特殊命令触发记忆，Agent 会在对话过程中自动判断何时存储或搜索记忆。","某电商公司正在开发一款智能客服助手，旨在为回头客提供个性化的购物建议和售后支持。\n\n### 没有 langmem 时\n- **记忆断层严重**：用户每次开启新会话，助手都像“失忆”一样，无法识别老顾客的身份或过往偏好，导致用户体验割裂。\n- **重复询问令人烦躁**：助手不得不反复询问用户的尺码、喜欢的风格或之前的订单问题，显得不够智能且浪费沟通时间。\n- **个性化推荐缺失**：由于缺乏长期数据积累，助手只能基于当前对话进行通用推荐，无法根据用户历史行为提供精准的“千人千面”服务。\n- **人工维护成本高**：开发团队需要手动设计复杂的数据库读写逻辑来存储用户画像，代码耦合度高且难以随业务灵活扩展。\n\n### 使用 langmem 后\n- **跨会话记忆连贯**：langmem 自动提取并固化关键信息（如“偏好深色模式”、“常买 M 码”），让用户在数周后的新对话中仍能感受到被“记住”。\n- **主动调用历史上下文**：助手能利用内置的记忆搜索工具，在用户提及“还是像上次那样”时，自动检索过往记录，无需用户重复描述细节。\n- **动态优化服务策略**：通过后台记忆管理器，langmem 持续整合交互数据，使助手能随着互动次数增加，越来越精准地预测用户需求。\n- **开发部署极简高效**：借助与 LangGraph 的原生集成，开发者仅需几行代码即可赋予 Agent 长期记忆能力，无需自建复杂的存储架构。\n\nlangmem 让 AI 助手从“单次问答机器”进化为懂用户、会成长的长期合作伙伴，显著提升了客户留存率与服务满意度。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flangchain-ai_langmem_28ebfb4f.png","langchain-ai","LangChain","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Flangchain-ai_8e6aaeef.png","","support@langchain.dev","https:\u002F\u002Fwww.langchain.com","https:\u002F\u002Fgithub.com\u002Flangchain-ai",[81,85],{"name":82,"color":83,"percentage":84},"Python","#3572A5",99.4,{"name":86,"color":87,"percentage":88},"Makefile","#427819",0.6,1402,159,"2026-04-16T07:44:25","MIT","未说明",{"notes":95,"python":93,"dependencies":96},"该工具主要依赖 LangGraph 框架。需要配置支持的 LLM 提供商 API 密钥（如 Anthropic）。示例代码中使用了 InMemoryStore（内存存储，重启后数据丢失），生产环境建议配置 AsyncPostgresStore 或其他数据库后端以实现持久化。示例中还涉及 OpenAI 嵌入模型（text-embedding-3-small）的配置。",[97,65],"langgraph",[14,13],"2026-03-27T02:49:30.150509","2026-04-17T09:53:26.734486",[102,107,112,117,122,127],{"id":103,"question_zh":104,"answer_zh":105,"source_url":106},37285,"如何在 langmem 中使用 Anthropic 以外的其他大语言模型（如 Google Gemini）？","langmem 支持任何具备工具调用（tool calling）能力的 LLM。您只需实例化相应的 LangChain 聊天模型并传递给 `create_memory_manager` 即可。例如，使用 Google Gemini 的代码如下：\n\n```python\nfrom langchain_google_genai import ChatGoogleGenerativeAI\nfrom langmem import create_memory_manager\n\nllm = ChatGoogleGenerativeAI(\n    model=\"gemini-1.5-pro\",\n    temperature=0,\n    max_tokens=None,\n    timeout=None,\n    max_retries=2,\n)\n\nmanager = create_memory_manager(llm, ...)\n```\n\n注意：针对不同模型的提示词（prompt）效果可能有所不同，默认设置主要在 OpenAI 和 Anthropic 模型上经过测试。","https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangmem\u002Fissues\u002F8",{"id":108,"question_zh":109,"answer_zh":110,"source_url":111},37286,"为什么在使用 PostgreSQL 时记忆无法更新或删除，反而总是插入新数据？","这通常是因为代理（Agent）倾向于走“捷径”，如果它需要主动搜索现有记忆再更新，它可能会选择直接插入。解决方法包括：\n1. **确保现有记忆对代理可见**：在上下文中急切地展示现有记忆，让代理知道它在处理什么。\n2. **优化提示词（Prompting）**：明确指示代理在更新前应先搜索。\n3. **限制操作权限**：如果您确定某个记忆对象只需要更新而不需要新建，可以将 `actions_permitted` 参数仅设置为 `['update']`。\n\n此外，早期版本中同步工具子程序可能存在缺失检查的 Bug，建议升级到最新版本。","https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangmem\u002Fissues\u002F42",{"id":113,"question_zh":114,"answer_zh":115,"source_url":116},37287,"安装 langmem 源码分发包时出现关于无效 tar 文件成员或绝对路径符号链接的错误怎么办？","该问题是由于旧版本的源码分发包中意外包含了本地虚拟环境的文件（如 `.venv`）及其绝对路径符号链接导致的。维护者已修复了打包流程。\n\n解决方案：请升级到最新版本的 langmem。如果您之前遇到此问题（如在 v0.0.13 中），更新到新版本后即可正常通过 `pip install langmem --no-binary langmem` 进行安装。","https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangmem\u002Fissues\u002F18",{"id":118,"question_zh":119,"answer_zh":120,"source_url":121},37288,"遇到 psycopg 报错 'column \"expires_at\" of relation \"store\" does not exist' 如何解决？","这是因为数据库架构缺少新的列定义。解决方法是升级 langmem 到最新版本（如 2.0.19 或更高），然后重新运行数据库迁移（migrations）。执行迁移后，`expires_at` 列将被添加到 store 表中，错误即可消除。","https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangmem\u002Fissues\u002F30",{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},37289,"如何在 langmem 中使用 DeepSeek 或其他非官方示例中展示的模型？","langmem 基于 LangChain 构建，因此支持 LangChain 集成的所有模型。对于 DeepSeek 等模型，您可以使用 LangChain 对应的集成包（例如 `langchain-moonshot` 或其他兼容接口）。\n\n配置方式与其他模型一致：导入对应的 ChatModel 类，初始化实例，然后传入 `create_memory_manager`。只要该模型支持工具调用（Tool Calling），即可正常工作。具体集成参考 LangChain 官方文档：https:\u002F\u002Fpython.langchain.com\u002Fdocs\u002Fintegrations\u002Fllms\u002F","https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangmem\u002Fissues\u002F99",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},37290,"如何获取包含特定功能修复（如支持新版 langgraph）的最新 PyPI 包？","如果当前 PyPI 版本限制了依赖项（例如 langgraph 版本），而您需要使用更新的特性（如 langgraph 1.0.0a1），请检查 PyPI 上是否已发布新版本。维护者通常会响应社区请求发布新版本（例如从 0.0.29 升级到 0.0.30）。您可以访问 https:\u002F\u002Fpypi.org\u002Fproject\u002Flangmem\u002F 查看最新版本并使用 `pip install -U langmem` 进行更新。","https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangmem\u002Fissues\u002F125",[]]