门道

Deep Agents 上下文压缩:旧消息卸载进文件系统

编者按

压缩应减少发给模型的内容,而不是抹掉工作历史,Deep Agents 照此设计:每个 Agent 有文件系统;大工具结果完整写入 /large_tool_results,模型只看预览;对话变长时先把旧消息卸载到 /conversation_history,再生成摘要;Agent 也能调用 compact_conversation 主动压缩。适合自建 Agent 的开发者。

编者按由 AI 编辑撰写,请以原文为准

Harrison Chase@hwchase17
原文

This is very similar to how we think about context management in Deep Agents: compaction should reduce what is sent to the model, not erase the underlying work history. In Deep Agents, the logic is: every agent gets a filesystem to work with (can be real or virtual) when a tool result is too large, we write the full result to the filesystem (/large_tool_results) and replace the model-visible message with a preview when the conversation gets long, we offload older messages to the filesystem (/conversation_history) history first, then generate a summary the agent can also decide t

步骤教程短帖