TGViewer
Laisky's Notes Laisky's Notes @laiskynotes · 3.34K subscribers
Post #404 3.78K
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
laisky on Notion Effective context engineering for AI agents \ Anthropic | Notion Context is a critical but finite resource for AI agents. In this post, we explore strategies for effectively curating and managing the context that powers them.
  • ❤ 8
  • 👍 3
More from @laiskynotes
  1. Oct 6, 2026https://x.com/LaiskyCai/status/2107307813727060123?s=20 codex 最近有三个完全免费的工具,结合之后可以发挥非常强大能力:…
  2. Sep 15, 2026学习了一下 OpenAI 推出的 Agents API https://openai.com/index/introducing-the-agents-api/ 众所周知 Agen…
  3. Aug 28, 2026前阵子读了本很有趣的书,侯杨方的《这才是丝绸之路》。作者抛开抽象的文本溯源,而是采用实地考察的方式,重走了真实的丝绸之路。此书给我最大的感触就是:真实而且符合常理。 在我以前的想象…
  4. Jun 5, 2026读完 Mario Puzo 的《教父 The Godfather》三部曲小说,才意识到自己当年年轻时根本完全就没看懂电影《教父》。然后又去把电影重温了一遍,才发现原来电影里有很多细…
  5. May 22, 2026记录一下最近遇到的一个糟心事儿。 最近两个月开始又开始找工作机会,总的来说很不顺利,托朋友联系了两个内推也是石沉大海。(各位要是有远程工作的机会也请联系 job@laisky.co…
  6. May 14, 2026作为一个从业十多年的程序员,我已经半年没手写过一行代码了。上个月大概提交了 20 万行,这个月大概 4 万行。 昨天认真考虑了一下这个现象,我个人认为,虽然 AI 仍然存在显然的不…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →