AI 代理的有效上下文工程

Effective context engineering for AI agents

Anthropic Anthropic · Anthropic · 2025-09-29 · Anthropic Engineering ↗

打开互动全文版(逐段中英对照 + 图/公式 + 论文问答)→

摘要 · Abstract

上下文是 AI 代理的关键但有限的资源。在这篇文章中,我们探讨了有效策划和管理驱动它们的上下文的策略。经过几年提示工程在应用 AI 领域成为关注焦点后,一个新术语脱颖而出:上下文工程。使用语言模型构建越来越不关乎为提示找到正确的词语和短语,而更多是关于回答更广泛的问题:“什么样的上下文配置最有可能生成我们模型期望的行为?”上下文指的是从大型语言模型(LLM)采样时包含的令牌集。当前的工程问题是在 LLM 固有的约束下优化这些令牌的效用,以持续实现期望的结果。有效驾驭 LLM 通常需要“在上下文中思考”——换句话说:考虑 LLM 在任何给定时间可用的整体状态以及该状态可能产生的潜在行为。

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. After a few years of prompt engineering being the focus of attention in applied AI, a new term has come to prominence: context engineering. Building with language models is becoming less about finding the right words and phrases for your prompts, and more about answering the broader question of “what configuration of context is most likely to generate our model’s desired behavior?" Context refers to the set of tokens included when sampling from a large-language model (LLM). The engineering problem at hand is optimizing the utility of those tokens against the inherent constraints of LLMs in order to consistently achieve a desired outcome. Effectively wrangling LLMs often requires _thinking in context_— in other words: considering the holistic state available to the LLM at any given time and what potential behaviors that state might yield.

核心贡献 · Key contributions

局限 · Limitations

论文章节 · Sections(共 7)

阅读逐段中英对照全文 →