Recommend `on_change='append'` for instructions that change mid-conversation across the docs

Merged
DO
1mo ago
+194-21

Follow-up to #8188. Before this PR, on_change='append' was documented only in docs/agent.md. Now every page that explains dynamic instructions recommends it for instructions that change mid-conversation, explains the trade-off (the prefix stays cached, at the cost of storing the block's complete new text in history for each change) and shows how to opt in on that surface.

Docs only. Docstrings change but code doesn't.

  • docs/agent.md: a tip in the Instructions section, a recommendation and trade-off in "Appending instruction changes", a table of how each instruction source opts in, and a list of the sources that can't opt in yet, each with an alternative that can (except MCP server instructions).
  • docs/toolsets.md: a new "Toolset instructions that change" section with a runnable FunctionToolset subclass example. @toolset.instructions has no on_change. The section also covers get_instructions() on custom toolsets, and @agent.toolset(id=...) for dynamic toolsets.
  • docs/capabilities/custom.md: a new "Instructions that change during a conversation" section. Its runnable example has get_instructions() return an InstructionPart(on_change='append') that for_run rebuilds per run, and it points to Capability plus @capability.instructions(..., on_change='append') for text that changes during a run. The steering-messages table now recommends append mode instead of saying "re-sends everything uncached".
  • docs/capabilities/caching.md, docs/message-history.md, docs/models/anthropic.md, docs/models/openai.md: short pointers where those pages describe dynamic instructions and the cache.
  • Docstrings: AbstractCapability.get_instructions, AbstractToolset.get_instructions, FunctionToolset.instructions, and on_change on Agent.instructions and Capability.instructions.
  • Agent skill: AGENTS-CORE.md lists how each surface opts in. CAPABILITIES-AND-HOOKS.md no longer recommends a get_instructions callable for tracked state.

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver.
  • PR title is fit for the release changelog.

šŸ¤– Generated with Claude Code