Anthropic 推出 Claude Opus 4.8 对话中途系统消息功能

Claude Opus 4.8 发布的同时,Anthropic 还上线了一个 API 层面的新能力:mid-conversation system messages(对话中途系统消息)。对于做 Age...

精选理由

做 Agent 开发的团队终于可以动态调整系统提示词了,不用再靠 hack 方式覆盖指令,建议直接试。

AI 摘要

Anthropic 在发布 Claude Opus 4.8 的同时,上线了 API 层面的新能力:mid-conversation system messages(对话中途系统消息)。该功能允许在对话过程中动态修改系统提示词,且不影响 Prompt Caching。对于 Agent 开发者来说,这解决了之前无法在对话中途覆盖原始系统指令的痛点,例如让一个被设定为只写文档的系统设计师角色转变为可以写代码的开发工程师。目前该功能仅支持 Claude Opus 4.8,且仅在 Anthropic 自家 API 和 AWS 上的 Claude Platform 可用。系统消息不能放在对话开头,也不能连续放置两条,必须跟在 user 消息后面。

原文 · 宝玉

Claude Opus 4.8 发布的同时,Anthropic 还上线了一个 API 层面的新能力:mid-conversation system messages(对话中途系统消息)。对于做 Age...

Claude Opus 4.8 发布的同时,Anthropic 还上线了一个 API 层面的新能力:mid-conversation system messages(对话中途系统消息)。对于做 Agent 开发的会很有用。 简单来说它就是类似于后续注入的方式修改原始系统提示词(System Prompt),并且不会影响 Prompt Caching。 4.8 之前 Claude 是不能发送类型是 system 的消息,只能支持 user 或者 assistant 消息,system prompt 只能在最前面。 所以 Claude Code 之前是用的一种特殊的消息内容:<system-reminder>,尝试覆盖系统消息指令。 举个例子,你在初始 system message 指定这个 Agent 是一个系统设计师的角色,擅长做系统设计,但是不允许写代码,只写文档。 然后随着任务推进,现在得让这个 Agent 开始写代码了,但你就算通过 user message 去让它可以写代码,因为权重不够高,它还是会倾向于不写代码写文档。 现在有了 mid-conversation system messages,你就可以新加一条指令,明确要求它转变角色变成一个开发工程师,不必再遵守之前不写代码只写文档的约定,并且 mid-conversation system messages 的优先级更高,能覆盖原始 system message 的设定。 这个功能目前只支持 Claude Opus 4.8,只在 Anthropic 自家 API 和 AWS 上的 Claude Platform 可用,Bedrock、Vertex AI、Microsoft Foundry 都不支持。系统消息不能放在对话开头(开头还是用顶层 system 字段),也不能连续放两条,必须跟在 user 消息后面。 对于普通用户,这功能无需关心。 Lance Martin @RLanceMartin a number of useful tips + tricks for Opus 4.8: 1/ you can now update the system prompt mid-conversation w/o breaking the prompt cache. previously, you had to add <system-reminder> tags to user messages (see @trq212 's post). https: platform.claude.com/docs/en/build-… s://t.co/0jNoyDOLgt 🔗 View Quoted Tweet 💬 0 🔄 0 ❤️ 2 👀 229 ⚡