The outcome
Use search and custom tools without prompt-injection escalation, cross-tenant access, uncontrolled side effects, or hidden retention surprises.
Step by step
A workflow you can repeat.
- 01
Define users, tenants, narrow tool allowlists, data boundaries, schemas, side effects, approval thresholds, budgets, stopping conditions, storage mode, retention, and audit fields.
- 02
Create a dedicated server-side xAI key, choose an exact model, decide whether default retention, store=false or team-wide ZDR applies, and verify incompatible stored features before implementation.
- 03
Minimize context, isolate untrusted web and file text, parse tool calls strictly, reject unknown names and fields, canonicalize arguments, and reauthorize every requested resource against current server state.
- 04
Execute through scoped service identities with idempotency, timeouts, rate and spend limits; require explicit approval for writes, purchases, publication, messages, account changes, or sensitive disclosure.
- 05
Test direct and indirect injection, confused deputy, forged IDs, tenant crossover, replay, parallel calls, exfiltration, denial, tool failure, cancellation, retention headers, and rollback before canarying.
Working standard
What good use looks like.
- Authorize every tool outside the model.
- Verify the active retention mode.
- Make every side effect idempotent.
Official references