Files
nexus/wiki/concepts/MemoryInAIAgents.md
2026-04-27 12:03:03 +08:00

41 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Memory in AI Agents"
type: concept
tags: [ai, agent, context, llm, memory]
sources: []
last_updated: 2025-05-09
---
## Aliases
- AI Agent Memory
- 对话记忆
- 上下文保留
- Context Retention
## Definition
在 AI Agent 中嵌入的上下文保留机制,通过在多轮对话中存储和检索历史信息,使 Agent 能够理解会话的完整语境,从而生成连贯、相关且符合上下文的响应。没有 Memory 的 Agent 每次交互都是孤立的,无法利用前序对话中的关键信息。
## Why It Matters
- **连贯性**:用户无需在每轮对话中重复已提供的背景信息
- **个性化**Agent 记住用户的偏好、之前的任务状态和关键事实
- **效率**:避免用户反复解释相同的需求或约束
- **真实性**:使对话更接近人与人之间的自然交流
## Implementation Patterns
- **短期记忆Short-term**:单次会话内的上下文窗口管理
- **长期记忆Long-term**:跨会话持久化用户偏好、项目状态等
- **向量检索**:将历史交互转为 embedding通过相似度搜索召回相关信息
- **摘要压缩**:定期将长对话摘要化,减少 token 消耗
## Related Concepts
- [[Agentic System]]Memory 是 Agentic System 的核心组件之一
- [[Tool Integration]]Memory 与工具调用结合使 Agent 能够访问持久化状态
## Related Entities
- [[OpenClaw]]:强调持久记忆的多 Agent 系统
- [[n8n]]:通过 Memory 节点支持对话上下文保留
## Sources
- [[n8n-full-tutorial-building-ai-agents-in-2025-for-beginners]]
- [[养龙虾5天血泪史-我的ai-agent为什么总失忆-openclaw-记忆调试全记录]]