执行摘要 本报告对Agent Infrastructure(Agent基础设施)领域进行了系统性深度调研,重点关注Memory管理层次模型。通过对LangChain、LangGraph、LangSmith、Zep、MemGPT等主流技术的分析,揭示了Agent Memory从简单会话存储到复杂知识图谱演进的技术脉络。
1. Agent Infra 分层架构 1.1 Agent执行动态追踪(Trace)层 LangSmith 是LangChain团队推出的LLM应用可观测性平台,截至2025年已处理超过10亿条Trace。
核心架构:
Frontend (UI) + Backend API + SDK (Python/TypeScript) ↓ ClickHouse (Trace存储) + PostgreSQL (元数据) + Redis (缓存) 定价模式:
Developer计划:免费,5,000 traces/月 Plus计划:$39/月/席位 Enterprise计划:支持私有化部署 1.2 Agent Context管理层 Context生命周期:
创建(Creation) → 传递(Transfer) → 更新(Update) → 销毁(Dispose) │ │ │ │ 初始化状态 节点间流转 Reducer合并 会话结束 LangGraph中的Context管理:
class AgentState(TypedDict): messages: Annotated[list, add_messages] documents: list[str] counter: Annotated[int, add] 2. Memory管理深度分析(重点) 2.1 Memory层次模型 基于认知科学和计算机体系结构的启发,Agent Memory采用分层架构:
┌─────────────────────────────────────────────────────────┐ │ Working Memory (工作记忆) │ │ Context Window / Active Reasoning │ │ ~4K-128K tokens │ │ ▲ │ │ │ 实时访问 │ ├───────────────────┼─────────────────────────────────────┤ │ ▼ │ │ Short-term Memory (短期记忆) │ │ Session History / Conversation Buffer │ │ ~10-100 messages │ │ ▲ │ │ │ 快速检索 │ ├───────────────────┼─────────────────────────────────────┤ │ ▼ │ │ Long-term Memory (长期记忆) │ │ ┌───────────────┬───────────────┐ │ │ │ Fixed Attr │ Fuzzy Vector │ │ │ │ Memory │ Memory │ │ │ │ (用户画像) │ (Embedding) │ │ │ └───────────────┴───────────────┘ │ └─────────────────────────────────────────────────────────┘ 2.2 短期记忆(Short-term Memory) 工作记忆(Working Memory):
...