The outcome
Use function calling while preventing prompt injection, cross-tenant access, forged arguments, and autonomous consequential actions.
Step by step
A workflow you can repeat.
- 01
Define an allowlist of narrow tools, user roles, tenant boundaries, argument schemas, data classifications, approval thresholds, side effects, budgets, timeouts, and audit requirements.
- 02
Keep keys server-side, minimize prompts, quote untrusted content as data, use a pinned model, disable arbitrary URLs or code, and never put credentials in tool descriptions or context.
- 03
Parse tool calls as untrusted proposals, reject unknown names and fields, canonicalize and validate arguments, reauthorize against current user state, and request confirmation for side effects.
- 04
Execute through isolated service accounts with idempotency, least privilege, rate and spend limits, then return bounded results without internal secrets or excessive records.
- 05
Test prompt injection, confused deputy, tenant crossover, replay, duplicate calls, malformed JSON, data exfiltration, timeout, provider failure, key rotation, denial, and rollback.
Working standard
What good use looks like.
- Treat every tool call as untrusted.
- Authorize outside the model.
- Require confirmation for side effects.
Official references