Model fabricates an order identifier
Detect: Lookup or ownership validation finds no authorized matching record.
Recover: Request clarification using verified records only.
Convert model-proposed operations into validated, authorized tool calls with stable schemas and explicit treatment of side effects.
Tool invocation connects a language model to application capabilities through structured operation requests. The model proposes a function name and arguments; the application resolves, validates, authorizes, and executes that request. Producing syntactically valid arguments does not prove that the operation is permitted, sensible, or safe to retry.
Treat the tool layer as a business API boundary. Narrow tools with clear preconditions and typed results are easier to evaluate than unrestricted shell, SQL, or HTTP access. Distinguish read operations from commands, and represent pending, failed, and uncertain outcomes explicitly so the agent cannot interpret an empty response as successful execution.
A prototype exposes a few read-only functions with hand-checked arguments. Evaluate tool selection and argument correctness separately from final-answer quality.
Production introduces schema validation, scoped credentials, operation deadlines, result normalization, and idempotency for commands. Business invariants remain in the tool service even when the model follows instructions reliably.
At scale, tool registries require version compatibility, deprecation policies, and per-capability telemetry. Large tool catalogs should be filtered to relevant authorized capabilities to reduce selection errors and prompt overhead.
Defines stable operation names, argument schemas, side-effect classifications, and supported versions.
Rejects unknown fields, invalid types, unsafe ranges, and unresolved business identifiers.
Checks the user's delegated authority against the specific resource and requested action.
Applies deadlines, credentials, retry rules, and operation identity to the actual business API.
Returns typed success, error, pending, or uncertain outcomes with source identifiers.
flowchart LR
M["Model proposal"] --> S["Schema validator"]
S --> A["Resource authorization"]
A --> I["Idempotency and deadline"]
I --> T["Business API"]
T --> N["Outcome normalizer"]
N --> M
S --> R["Rejected proposal"]
A --> R
I --> L["Operation ledger"]Select only tools relevant to the task and permitted for the authenticated requester.
Parse the model's structured function request without evaluating arbitrary generated code.
Resolve identifiers and enforce schema, amount, date, and business-precondition checks.
Recheck resource-specific permissions and require approval where the workflow demands it.
Invoke the adapter with deadline and operation identity, recording the actual outcome.
Supply normalized evidence to the agent and reconcile unknown command outcomes before retrying.
Retail · Illustrative enterprise scenario, not a reported customer outcome.
A retailer's support assistant helps agents replace damaged products when an order is eligible under policy.
A model can identify the right intent but propose the wrong order line, quantity, or delivery address.
The assistant must retrieve verified order facts and create a replacement only within the customer's entitlement.
Separate lookup and replacement tools expose narrow schemas; the command adapter checks eligibility and uses a stable replacement operation key.
If the creation request times out, the adapter queries the operation ledger before permitting another command.
Monitor wrong-tool selection, argument rejection, unauthorized attempts, and duplicate-command prevention alongside customer resolution time.
| Decision | Benefit | Cost |
|---|---|---|
| Narrow tools | Smaller contracts improve validation and evaluation. | More adapters may be required for complex workflows. |
| Rich schemas | Invalid arguments are caught before business execution. | Schema validity cannot establish factual or policy correctness. |
| Central gateway | Authorization and telemetry remain consistent. | Gateway availability and version management become shared dependencies. |
Detect: Lookup or ownership validation finds no authorized matching record.
Recover: Request clarification using verified records only.
Detect: Result schema validation fails despite an HTTP success status.
Recover: Mark the outcome uncertain and reconcile with the system of record.
Resolve only registered capability identifiers.
Apply delegated or resource-scoped authorization.
Reconcile outcomes and use idempotency before retries.