ContextConcepts

Tool binding

A skill's tools are visible and callable only while the skill is loaded, and the rule holds even when a framework registers every tool up front.

Tool schemas, not instructions, dominate most agent prompts. Binding is where the context saving comes from: a skill's tools are not in the model's tool list until the skill loads.

A tool may be bound by several skills; it is visible while any of them is loaded. A tool bound by no skill is an error by default (unbound: "error"), so a typo in tools: cannot silently expose a tool. Pass ambient: [...], or unbound: "ambient", for tools that should always be visible.

Two places, so it always holds

  1. Visibility. Each adapter shows the model only bound tools, in the way its framework allows: activeTools in the AI SDK, a model-call middleware in LangChain, isEnabled in the OpenAI Agents SDK, MCP servers toggled per skill in the Claude Agent SDK.
  2. Execution. session.guard is a core tool middleware around every bindable tool, and every adapter dispatches through session.call. A call to an unbound tool never runs: it returns a refusal the model can act on, issue_refund is not available. Load the refunds skill first. It composes with Viewport HITL's approval gate in any order.

The next step, not the same one

A skill's tools become callable on the model's next step, after it has read the instructions that arrived with load_skill. A tool called in the same step as the load that binds it (parallel tool calls in one model message) is refused: "issue_refund is not available yet: the refunds skill was loaded in this same step. Read its instructions, then call issue_refund in your next step." Every adapter judges each call against the state the model saw when it wrote the call, except the Claude Agent SDK adapter, a preview: the SDK reports no message boundary, so a second tool call in the same model message as a skill load may run before the step opens; grants still hold, so only tools of allowed skills can run. A step starts when the next prompt is built; session.next_step() (nextStep()) does it by hand for hosts that dispatch several steps without building a prompt. Because building a prompt starts a step, call prompt() only when the model is about to see it; to look at state mid-step, use session.loaded or session.state. Loads from code (session.load) apply at once.

Exposure modes and the cache

Changing the tool list is the most expensive cache event on most providers. expose makes the trade explicit:

exposeRequest shapeUnloaded tools costCache when a skill loads
boundOnly bound tools, appended in load orderNothingThe tools block changes once per load
deferred (Anthropic)Every bindable tool declared with defer_loading; load_skill's result carries tool_reference blocksNothing in contextPreserved
allowed (OpenAI)Every bindable tool declared in a fixed order; tool_choice allowed_tools lists the bound onesFull schemas, cachedPreserved

The default, auto, resolves per provider: deferred for Anthropic, bound everywhere else. The benchmark reports all three on the same tasks.

Tools are values

Treat a tool as immutable once a registry has it. Context counts each tool's schema once per process and reuses the count and the recorded wrapper for every session and tenant (keyed by the tool object), so changing a registered tool's description or input_schema later is not seen. Register a new tool object, in a new registry, instead.

On this page