When an AI agent calls the wrong tool: how should permissions and policies be designed?
A practical design for AI agent permissions using least privilege, contextual authorization, risk tiers, approvals, idempotency, and fail-closed enforcement.

A wrong AI agent tool call should never flow directly into sending an email, deleting data, issuing a refund, or changing access. The safe design is to treat the model output as an untrusted action proposal. Every call must pass through an independent execution layer that rechecks the user and agent identities, permitted tool, action, resource, tenant, arguments, risk level, limits, and approval requirements. Only after policy returns allow should the backend invoke the target system with narrowly scoped credentials.
The operational rule is: the model selecting a tool does not mean the model is authorized to execute it. Prompts, tool descriptions, and JSON Schema improve selection quality but do not replace authorization. Missing context, a policy failure, an expired token, a resource outside the tenant, or an action beyond delegated authority must produce deny, request more input, or require approval—not an inferred continuation.
Root risk
Why can a well-formed tool call still be dangerous?
The tool, target, or sequence can be wrong even when the JSON is valid.
A model may select delete_customer instead of , choose the right tool with the wrong , or combine individually valid operations into a harmful sequence. Indirect prompt injection in email, documents, or web content can also influence tool selection and arguments.




