AI agents and models Required
Give agent tools the least power they need
Give the model only the tools its task needs, each with the narrowest rights, acting as the user and never as an administrator.
How to do it
List the tools per feature. A help chat needs to read orders, not refund them. Run every tool call with the user's own rights, so the server checks them as it would for the user. Use read-only database accounts where reading is enough.
How to check
Ask the assistant to call each tool it has with another user's record. Every call fails with the same error the normal API gives.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers security testing playbook: https://agentwranglers.se/playbook/adversarial-testing/ai-agents-and-models/least-privilege-tools.