Changing a Tool Schema

7 min read

O39
Operation · AgentOps: Deploy & Operate

A schema edit is two completely different deploys wearing the same diff.

Renaming a tool and reordering two of its fields look like the same size of change in a pull request, and they are not remotely the same change in production: one reuses a compiled grammar that is already warm, the other throws it away and pays a fresh compilation in front of the next token, under a hard 180-second ceiling. The boundary that decides which you just shipped is the schema's structure, not the size of the diff — and it is crossed by things that never touch the schema at all, including adding an unrelated tool to the same request.

Step 1The structure boundary, and why the diff does not predict it.

Under strict tool use and structured outputs, your schema is compiled into a grammar and the result is cached for 24 hours from last use. What invalidates that cache is documented and narrow: a change to the schema's structure, or — with tool use — a change to the set of tools in the request. What explicitly does not invalidate it is a change to a tool's name or description.

That single asymmetry reorganises how you should read your own release notes. A hundred-line rewrite of six tool descriptions, which reviewers will treat as a substantial content change, costs nothing at the grammar layer and ships with no latency signature at all. Adding one optional field to one tool, which reviewers will wave through, discards the compiled artefact and makes the next request pay for a new one. Risk here is quantised, not proportional, and the quantum is "did this cross into structure".

Make the boundary visible in review. A single check that diffs the structural part of each tool schema — everything except name and description — and labels the pull request grammar:warm or grammar:recompile turns an invisible operational property into a line a reviewer can see before merging.

Step 2Changing the set of tools recompiles the ones you did not touch.

The second invalidation trigger is the expensive one, because it is not a property of any schema. With tool use, changing which tools are in the request invalidates the cache. The explicit per-request limits already apply to the combined total across every strict schema — 20 strict tools, 24 optional parameters, 16 union-typed parameters, counted together — so the request, not the tool, is the unit the platform compiles. Adding a twenty-first tool therefore does not add one tool's worth of compilation; it invalidates the grammar for the whole set.

The operational consequence is that a team shipping a new tool imposes a cold compile on twenty tools owned by other teams, and nothing in their diff says so. It also means feature-flagging a tool is not free: a flag that varies the tool set per user splits your traffic across two grammars instead of one, and each has to stay warm on its own share of the traffic to stay warm at all.

This is the same failure that Tool Catalog Lifecycle describes for selection accuracy, arriving through a second mechanism. There, the fortieth tool changes behaviour on the thirty-nine tasks that were working. Here, it changes their latency. Both say the catalogue is the unit of change; only one of them shows up in a quality metric.

Step 3The compile sits in front of the first token, and the canary measures the wrong path.

A cold grammar is latency the user feels, because compilation has to finish before constrained sampling can emit anything. The platform bounds it rather than hiding it: schemas that pass every published complexity check can still hit a compilation timeout of 180 seconds, and schemas whose compiled grammar exceeds internal size limits return a 400 reading "Schema is too complex for compilation". Both of those are first-request failures — the ones a smoke test catches and a code review does not.

The subtler problem is that a canary systematically mis-measures this. Because the cache expires 24 hours after last use, a grammar's warmth is a function of traffic. Route 1% of requests to a new schema and that schema's grammar spends much of its life cold or near-expiry, so the canary reports a p99 that the full rollout will never reproduce — and in the direction that makes you cancel a good change. The same arithmetic runs the other way for a rarely-called tool: a tool invoked twice a week is cold essentially every time, so its production latency is the cold path, permanently, and no amount of aggregate warmth helps it.

Do not read first-request latency from a low-traffic canary as the rollout's steady state, and do not read steady-state latency as what a rare tool will see. Measure cold-compile cost once, deliberately, on a fresh schema, and record it next to the tool. It is a property of the schema's complexity, so it only changes when the structure does — which is the same boundary from STEP 1.

Step 4A tightening that gets demoted is a no-op at the layer you were trying to change.

Here is the schema change that passes review for exactly the wrong reason. An engineer adds minimum: 100 to an amount field to stop sub-dollar transfers. Numeric constraints are not in the compilable subset, so one of two things happens. Against the raw API, the request 400s and the change is caught immediately. Through an SDK helper, the constraint is stripped from the wire format and appended to the field's description instead — and a description change, as STEP 1 established, does not invalidate the grammar cache.

So the diff reads as a tightening of a financial control; the deploy produces no recompile, no latency change, and no error; and the enforcement layer is byte-identical to yesterday. The only thing that moved is a sentence the model will usually but not always honour. Schemas, Contracts & Defaults sorts which keywords land in which bucket; the operational point is narrower and worth stating on its own: the absence of a recompile is evidence that your constraint did not reach the grammar.

That makes the signal from STEP 1 diagnostic rather than merely informational. If a pull request claims to tighten a schema and your check labels it grammar:warm, those two facts are in contradiction and one of them is wrong.

Step 5Your stored traces are a second consumer, on a clock you do not control.

A tool schema is not only a live contract; it is the format of every tool call already written to your trace store. Tighten a schema and the recorded calls from last month may no longer validate against it — so a replay suite goes red for a reason that is not a regression, and the honest reading of that red is "these traces predate the contract", which no test framework will tell you. Replay Testing With Recorded Traces covers the mechanics; the schema-change-specific discipline is to stamp the schema version on every recorded call, so a replay can be filtered to the traces that were produced under the contract it is testing.

Loosening has the mirror problem and it is quieter. Make a required field optional and every historical trace still validates, so nothing goes red — while the eval set has silently stopped covering the omission case that is now reachable in production. A loosening needs a new test, and nothing about the deploy will ask you for one.

Sessions in flight are the third consumer. An agent session that has been running for forty minutes holds the old tool definitions in its own history, so a mid-session schema change puts a model in front of a catalogue that disagrees with the calls it already made — the same class of problem Long-Lived Sessions & Deploys works through for session state generally, specialised to the one piece of state the model reads every turn.

Step 6Ship it like an API change, because that is what it is.

The practice that works treats a tool schema as a published interface with three consumers on three clocks: the live request, which pays compilation; the trace store, which holds calls in the old shape forever; and the in-flight session, which cannot be upgraded underneath itself. Nothing exotic is required — the existing discipline from Rollout, Versioning & Pinning applies, with one addition: the tool schema belongs in the stamped behaviour triple, not outside it.

Concretely: version the schema and put that version on every run and every recorded call. Classify each change as structural or cosmetic in CI and surface it on the pull request. For a structural change, measure the cold compile once before rollout rather than inferring it from a thin canary. Prefer additive-then-migrate over in-place tightening, so the old shape stays valid while traces age out. And treat a loosening as the change that needs a new test, because it is the one that will never fail an old one.

The one-line version: ask whether the change crossed into structure, and distrust any answer that comes from the size of the diff. A description rewrite is free and enforces nothing new. A field addition is a recompile for every tool in the request. A constraint the grammar refuses is a no-op wearing the clothes of a control. Those three are indistinguishable in a pull request and completely different in production, and a four-line check in CI is what makes them distinguishable before merge instead of after.