https://laisky.notion.site/Effective-context-engineering-for-AI-agents-Anthropic-2ddba4011a868170ac2ddd9017afadde?source=copy_link

Anthropic 介绍 context engineering 的文章。

- prompt engineering 主要关注如何撰写 system prompt。
- context engineering 则关注 agent 相关的所有工程问题。

注意力是稀缺的,context 过长,反而会导致模型能力下降(context rot)。

所谓 Agent,就是在 loop 内自动调用工具的 LLM。

context 注入的两种方式:
1. 在推理前,利用 RAG 检索和注入 context(延迟低)
2. 在 Agent 运行的过程中,通过 tools 自动检索和读取(可以 progressive disclosure,信息更准确)。推荐使用类文件系统的信息索引方式,这些文件的路径本身,也包含重要的信息。

long-horizon tasks 的 context 优化工具箱:
- compaction:压缩 context,仅保留关键信息。记忆信息拆分不同的 TTL 层级,然后按照不同的文件路径进行组织和存储。
- structured note-taking:context 外部的记忆工具,如 TODO list
- multi-agent architectures:拆分子任务,coordinator 仅派发任务和接收 sub-agent worker 的摘要。不要试图用一个上下文维护大型项目的全部信息。

Anthropic 还有一篇 Effective harnesses for long-running agents 感觉只是对本文的 multi-agent architectures 的一些实践小经验总结,信息量不多。

👆 prev Effective context engineering for AI agents \ Anthropic | Notion
 
 
Back to Top
OKHK