Tool Contracts for Agents That Touch Money
Enforce schemas, permissions, approval and duplicate-action checks outside the model before a workflow can quote, refund or change a record.
A model's request to execute a tool is untrusted input to an enforcing service. Before any consequential action, validate the request and check permissions using authenticated application context rather than values the model invented.
Separate structure from authority
A proposed tool request should name the action and its required fields. JSON Schema is a primary reference for validating structure. A schema-valid refund amount is still unauthorised if the caller cannot issue the refund.
Keep the caller identity, tenant, approval record and allowed limits outside the generated arguments. The gateway must join those facts with the validated request and reject anything outside the contract. OWASP prompt-injection guidance is relevant when a user or retrieved passage attempts to change those rules.
Define repeats and uncertain outcomes
Give a consequential operation a server-side identifier and a documented duplicate-handling contract. HTTP semantics explains idempotency at the protocol level; an application still needs to enforce its actual side-effect behaviour.
If a request times out after the service may have performed it, reconcile the operation status before retrying. Do not assume that a missing response means no action occurred. Set limits on attempts and require a manual route when the outcome cannot be established safely.
Test the service, not only the prompt
Attempt an unauthorised action, a duplicate request, a malformed amount and a cross-tenant reference in staging. The gateway should refuse them even if the model asks confidently. Keep the evidence redacted and include the service version.
Use the human-approval pattern, the staging smoke kit and a pilot decision record. A text saying approval is required is not the same as a tested approval boundary.
What to do next
- Save the acceptance rule, source versions and limits before testing.
- Use the linked implementation and review tools to record what actually happened.
Published by Janeiro.ai. Original editorial for operators. How this was made