Quanta

← Back to Briefings

7 Schema Rules for Teams Running Heavy Tool Traffic

Platform engineeringEN7 reads

A function schema is an operational contract, not just a prompt accessory. Under sustained traffic, a renamed field can break dispatch, an ambiguous amount can trigger the wrong action, and a retry can duplicate work. Stability means keeping that contract predictable across model changes, application releases, and budget constraints. Use these seven steps to design tool interfaces your team can operate without constant repair.

01 · Step 1: Define one business operation per tool

Start with the action your backend can safely perform, then describe its inputs. A tool named create_refund should create a refund request; it should not also search transactions, resolve customer identities, and decide whether approval is required.

Separate discovery from mutation. Let a lookup tool return an authoritative transaction identifier, then require that identifier for the refund operation. This gives the model fewer decisions per call and gives operators a clear boundary for permissions, auditing, and failure handling.

02 · Step 2: Make ambiguous values impossible to mistake

Prefer explicit fields such as amount_minor and currency over amount. Describe amount_minor as an integer in the currency's minor unit, and enforce the currency rules in application code. Likewise, specify timestamp formats and time zones rather than accepting an unexplained date string.

  • › Identifiers: State which system issues them and require lookup rather than guessing.
  • › Enumerations: Use a bounded set when the business vocabulary is genuinely closed.
  • › Absence: Define whether omission and null mean different things.

Keep descriptions short but operationally precise. Examples should explain a constraint, not introduce an alternative spelling that downstream systems cannot accept.

03 · Step 3: Choose a portable schema subset

Build around objects, strings, numbers, booleans, arrays, and straightforward required fields. Test advanced constructs before depending on them. Provider support for schema keywords and strict-output modes can differ, even when requests pass through a familiar SDK interface.

If your team routes between Claude Sonnet 5.5 and GPT-6 Astra, run the same contract tests against both. Keep one canonical business schema, then generate any provider-specific declaration from it. An adapter may change declaration syntax; it must not silently change what a field means.

04 · Step 4: Validate outside the model before execution

Schema-conforming arguments are not authorization. Parse the arguments, validate their structure, apply business rules, and check permissions before dispatching any operation. Reject unknown properties where your validator supports that policy.

Supply tenant identity, credentials, and access scope from trusted server context, not model-authored arguments. For consequential actions, enforce approval requirements in the backend. Return concise, structured errors with a stable code, the affected field, and a safe correction hint. Never include secrets in a validation response.

05 · Step 5: Design retries around business intent

A timeout does not prove that an operation failed. Before enabling automatic retries for mutating tools, implement backend idempotency. Create and persist a key for the intended operation in trusted orchestration code, then reuse it across transport retries.

Do not treat the model's tool-call identifier as a durable business identifier. A regenerated response can contain a different identifier for the same intended action. Define the deduplication window, reject conflicting payloads under one key, and provide a status lookup for uncertain outcomes.

06 · Step 6: Version contracts with replay tests

Treat renamed fields, changed units, and new required inputs as breaking changes. Even an optional field can alter model behavior, so replay representative conversations before rollout. Test missing inputs, invalid enums, unfamiliar identifiers, duplicate requests, and partial backend failures.

Keep old and new tool contracts available during migration, but expose only the appropriate version to each request. Start with a limited rollout and compare validation failures, repair attempts, execution outcomes, and token consumption before expanding traffic.

07 · Step 7: Budget for the entire tool loop

Measure schema tokens, argument generation, tool results, and repair turns together. Large results and repeated validation failures can outweigh savings from a shorter schema. Keep declarations stable when possible, but verify caching behavior rather than assuming every repeated prefix receives a cache hit.

For teams running sustained workloads, Quanta is worth considering for pay-as-you-go access across models through one balance. Calls are metered on actual tokens, with cache writes and cache reads priced separately. Open a Quanta account to evaluate your contract test suite against your own traffic and budget. Keep schema versions in your telemetry so routing changes never hide a contract regression.