Loading articles…
Loading articles…
Loading article…
Loading article…
When a model asks to look up an order or issue a refund, it has produced a proposal for your application to act on. The tool schema describes the shape of a request; it does not prove that the current user is allowed to perform it.
A safe tool flow has distinct steps: the model selects an allowlisted tool, the runtime validates the arguments, the application authenticates and authorizes the caller, and only then does a narrowly scoped function execute. The result is returned to the model as data, which may inform a response or a later tool call.
Validate arguments on the server even when the model uses structured output or a strict schema. Check types, ranges, enum values, record ownership, and business rules. Derive tenant and user IDs from the authenticated session rather than accepting them from model-generated arguments. Prefer tools such as get_order(order_id) over broad tools such as run_sql(query).
Reading a status and sending money have different risk. Put approval steps around irreversible or high-impact changes: show the exact action and target, require a user confirmation, and record who approved it. Add rate limits, timeouts, and idempotency for actions that may be retried. Do not let generated text bypass normal business authorization.
Control | Question it answers |
|---|---|
Authentication | Which signed-in user initiated this run? |
Authorization | Can this user perform this action on this record? |
Validation | Are the proposed arguments well-formed and allowed? |
Approval | Has a human confirmed this consequential change? |
Audit | Can we reconstruct the request, decision, and result? |
A retrieved email, document, or support ticket can contain instructions that should not control the agent. Keep system policy separate from retrieved content, minimize the data returned by tools, and validate every follow-up action independently. Tool outputs should be structured, bounded, and free of secrets the model does not need.
Senior Full-Stack Software Engineer
Newsletter
New articles from our engineers, straight to your inbox. One email a month, no spam.