Before your first users
Use this stage when you are about to let someone outside the team use the feature. Start from what the model can reach. A chat response, a retrieved document and a tool call need different checks because they can affect different parts of your product.
Treat uploaded and retrieved content as untrusted. Validate tool arguments on the server and take identity from the session. Run permission checks inside the tool, where a model reply cannot bypass them. For an action that cannot be undone, show the person the exact action and require approval tied to those arguments.
Check the output path too. Render model text without allowing it to fetch arbitrary remote content. If you run an open-weight model, inspect its provenance and lock what you approved before serving it.
Done means you can call the tool directly with bad arguments and a different user's record ID and watch the server reject it. You can change an approved action's arguments and show that the old approval no longer works.
Know the limit
These checks limit what a confused model can do. They do not make prompt injection disappear or establish that customer data stays separate across retrieval, memory and deletion.
Controls in this stage
Run tools with the user's permissions, not the agent's
Every tool takes user and tenant identity from the session and checks the same permissions as the normal API.
Ask before any action that cannot be undone
Irreversible actions need an explicit approval bound to the exact arguments, with an expiry checked at execution.
Verify the open-weight model you pulled
Open-weight models are checked against their declared base, template changes are reviewed and approved artifacts are locked in CI.
Render model output as untrusted
Model output cannot inject active HTML or load images and links from unapproved hosts, and model-written URLs are never fetched automatically.
Validate every tool call on the server
Every tool validates its arguments on the server and recomputes prices and IDs from your own data.
Treat retrieved and uploaded content as data, not instructions
Outside text is labeled as untrusted, hidden document text is checked, and tools that send data or change state are removed or gated.