Tool CallingIntermediate

Preventing destructive tool misuse

“How would you prevent an agent from calling a destructive tool incorrectly?”

What this tests

  • Defense in depth: schema, validation, permissions, gates, idempotency
  • Understanding that the prompt is not a security boundary
  • Awareness of injection and of retries causing double execution
  • Whether they question giving the agent the tool at all

Answers by level

Read the beginner answer first and notice what is missing.

The prompt is a suggestion, not a control. Controls live in code around the tool. First, schema and validation: the tool takes typed, narrow arguments (a specific resource id, not a free-form query), and the handler validates them against reality before acting, e.g. the id exists and belongs to the current user. See Argument Validation and Tool Schemas.

Second, least privilege: the agent gets a credential scoped to what the task needs; a "summarise tickets" agent has no delete permission at all. Third, an approval gate for irreversible actions: the tool returns a pending action that a human or a deterministic policy confirms, and the confirmation step is outside the model's control. See Tool Permissions and Least Privilege and Approval Gates and Risk Classes.

Fourth, safe execution: idempotency keys so retries cannot repeat the action, dry-run or soft-delete modes, and rate limits on destructive calls. Finally, tracing and alerting on every destructive call so misuse is visible within minutes.

Green flags · Red flags

Green flags
  • States that the prompt is not a security boundary
  • Layers schema validation, least privilege, approval gate, idempotency
  • Considers removing the tool from the agent entirely
  • Mentions indirect injection via tool results
  • Proposes blast-radius or risk thresholds for gating
  • Includes tracing and alerting on destructive calls
Red flags
  • Relies on system prompt instructions or "ask the model to confirm"
  • No mention of permissions or credential scoping
  • Ignores retries and double execution
  • No mention of human approval for irreversible actions

Follow-up questions

F1
The human approval gate gets 500 requests a day. What happens?
F2
A tool call times out. Should the agent retry?
F3
How do you test this?

Practical scenario

An ops agent cleans up stale cloud resources. It has a delete_instance(id) tool. In a trace you see it read a Slack thread that contained "prod-db-01 is stale, kill it" posted by an unknown user, and the agent deleted the production database. List every control that should have stopped this and in what order they would have fired.

Related concepts · Learn this topic