Execution boundaries

AI Guardrails Implementation

Implement AI guardrails where access, proposals, approvals and tool actions meet, with a measurable control map and failure tests.

AI guardrails are useful only when a named control can stop a named failure at the point where it matters. A model instructed to avoid confidential information may still receive that information. An output filter may reject a reply after an unauthorised tool has already changed a record. Production implementation therefore starts with the sequence of access, reasoning, approval and execution, then assigns a control to each boundary.

This guide is for application owners and security engineers integrating an assistant into business systems. Its working example is an illustrative equipment-service dispatch assistant: it reads an approved maintenance request, proposes a service visit and may create a scheduling request after approval. It cannot release equipment for use, change safety instructions or select arbitrary external destinations. The aim is to make those limits enforceable and testable.

Specify the permitted action before selecting a guardrail product

Write one sentence that describes the allowed business transition: “Create one draft visit request for an authorised asset, using an approved service category and the current maintenance record.” Then list the information needed to decide whether that sentence remains true. The asset must belong to the user's permitted estate; the record must still be current; the category must exist; and the destination must be an approved scheduling service.

This becomes an execution contract, independent of the model's explanation. The assistant may propose a different category or request clarification, but it cannot expand its own authority. A tool called “update system” is difficult to constrain. A tool with a limited operation, explicit object identifier, allowed fields and defined failure response is easier to review. The separation between planner and executor is developed in agentic integration patterns.

The OWASP excessive-agency guidance identifies excessive functionality, permissions and autonomy as distinct risk drivers. Use that distinction to decide which capabilities to remove, which permissions to narrow and which decisions need approval; a longer system prompt does not perform those three jobs.

Place the controls along the actual execution path

Proposed guardrail map for the illustrative dispatch assistant
BoundaryEnforced ruleEvidence and failure response
Request intakeAccept supported file types and bounded input sizes; preserve the original separately.Record the accepted document reference; quarantine unsupported input.
RetrievalReturn only records the requesting identity may use for this task.Record the permission decision and source version; deny unavailable authority.
Model outputRequire a valid proposal structure and known service category.Reject malformed or unknown values; request clarification without execution.
ApprovalBind the reviewer to the exact asset, category, schedule and record version.Store the approved proposal reference and expiry; changes require fresh review.
Tool gatewayPermit only the scheduling operation and approved destination.Reject forbidden fields and routes before issuing credentials or a request.
CompletionReport a created request only after a recognised destination receipt.Keep an uncertain result pending reconciliation, with an accountable owner.

For every row, name an operational owner. The integration team may own input validation while the asset owner defines permitted categories and security owns identity rules. A control without an owner becomes difficult to update when the business process changes. Record whether it runs inside your service, in a gateway or in a provider feature; test the deployed configuration rather than relying on a feature description.

Keep untrusted content from becoming authority

A maintenance attachment may contain relevant observations and instructions aimed at the assistant. Treat both as untrusted document content until the authorised workflow interprets them. The attachment does not gain the right to change tool permissions because it was retrieved successfully or because it carries an apparently official logo. Retrieval relevance and instruction authority are different properties.

In the illustrative case, an attachment asks the assistant to send the full asset register to a new web address “for verification”. The model might refuse, ignore or repeat that request. The decisive control is that the integration has no permitted action for exporting the register and no approved route to that destination. The test passes only when the external action cannot occur, including through alternate tools and error-handling paths.

Content classifiers and model-based checks can help detect suspicious requests, but their outputs are signals. Put deterministic checks around identifiers, allowed operations, field ranges and destinations where those checks are possible. Keep credentials outside model-visible prompts. Refer to AI integration security architecture for the wider trust boundaries and access control for the identity and resource rules that the gateway must enforce.

Validate meaning as well as JSON structure

A structurally correct proposal can still identify the wrong asset, choose an obsolete category or quote an unsupported date. Define separate validation layers: syntax, reference existence, business conditions and authority. Record the result of each layer so that a business rejection is not mislabelled as a model formatting problem.

For the dispatch assistant, a date may be syntactically valid but precede the requested service window. An asset identifier may exist but belong to another subsidiary. A category may be available but require a safety review before scheduling. These checks should use controlled records and rules rather than asking the same model whether its own proposal is safe. Where a judgement cannot be reduced to a reliable rule, route it to a person with sufficient context.

Version the prompt, output schema and rule set together in the release record, while keeping them separately identifiable. A prompt change may alter which fields are proposed; a policy change may alter what the same proposal is allowed to do. Production prompt engineering explains how to keep that behavioural contract reviewable.

Measure two different kinds of mistake

Use a labelled evaluation set that includes legitimate tasks, prohibited tasks and ambiguous tasks. Separate Arabic, English and mixed-language requests where they exercise different parsing or interpretation behaviour. Include scans, quoted instructions, irrelevant attachments and unsupported identifiers. Human reviewers should agree on the expected business outcome before testing the system.

Consider an illustrative set of 200 cases: 160 permitted requests and 40 prohibited requests. If a content gate blocks 35 prohibited requests, five escape that gate, giving a 12.5% escape rate for that prohibited sample. If it also blocks 12 permitted requests, the false-block rate is 7.5% of permitted requests. Reporting “47 requests blocked” hides both the escaped cases and the unnecessary interruption.

These are sample results for a particular gate, not a production safety estimate. Test the execution boundary separately: an escaped proposal must still be unable to perform a forbidden action. Report severity alongside counts, since one unauthorised external disclosure may matter more than many harmless formatting errors. Track ambiguous cases separately instead of labelling them safe merely to improve a percentage.

Exercise unavailable services and changed state

Guardrail services can time out, policies can fail to load and source permissions can change between retrieval and execution. Set the response for each condition before release. For consequential actions, an unavailable authorisation decision should prevent execution. A harmless drafting feature may continue with a clear limitation if it cannot access optional supporting material. Avoid one universal fallback that treats all failures alike.

Repeat approval tests after changing the asset record, revoking the user's access and expiring the proposal. The executor should recheck the conditions relevant to the action. A reviewer who approved yesterday's version has not necessarily approved today's changed schedule or newly attached document. If the destination times out after receiving a request, the correct state is uncertain until reconciliation establishes whether it committed.

The integration testing strategy should include bypass attempts through retries, alternative endpoints and administrative tools. Test whether support staff can accidentally replay an unapproved proposal. An emergency override, if the business requires one, needs a narrow permission, a recorded reason and a reviewable event; it should not be an undocumented bypass hidden in a support script.

Release a control pack that operations can use

A useful handover contains the boundary map, allowed-action contract, evaluation cases, measured results, known limitations, failure responses and rollback instructions. Include the owner of every policy and the evidence that shows which version was active. The release decision should identify which residual risks were accepted and by whom, rather than stating that the system has “guardrails enabled”.

Operational review should distinguish a blocked unsafe proposal, a valid request blocked unnecessarily, a failed authorised execution and a confirmed unauthorised action. Those categories need different responses. Keep sufficient evidence to reconstruct the decision without storing full sensitive documents in every log. AI integration audit logging provides a practical event structure for that purpose.

For broader commercial context, Trusted Data's AI trust, risk and security management overview discusses organisational oversight around AI controls. The acceptance evidence for your integration still needs to come from your own system and workload.

Turn the boundary map into a delivery scope

Begin with the smallest useful action set and expand it only when evaluation and operating evidence justify the change. A controlled draft-only release can help expose interpretation problems before write access is introduced. It does not replace later tests of authorisation, destination acknowledgement and recovery, because those risks appear when actions become possible.

OpenForAI's AI integration and delivery service can be discussed against this concrete scope. Bring a masked example request, the proposed tool list, the relevant permission model and an example of an unacceptable outcome. Enquire about implementing and testing AI guardrails around the specific boundaries your project needs.

FAQ

Your questions, answered.

Can a system prompt be the main guardrail for an AI tool?

A prompt can guide how the model proposes an action, but the executor needs independent checks on identity, resource, operation and current state. Otherwise a model mistake can become a system action. Keep the prompt in the behavioural test suite and enforce consequential permissions outside the model, where a failed check can prevent execution.

What should happen when an AI guardrail service times out?

Decide by the consequence of the operation. If an action requires a current authorisation or safety decision, stop that action when the decision is unavailable. An optional check for a harmless draft may have a different fallback. Record the chosen behaviour, expose the incomplete state and test it; do not silently treat an unavailable check as a passed check.

How do we measure false positives in AI guardrails?

Label permitted requests before testing, then divide incorrectly blocked permitted requests by all permitted requests in that evaluation set. Keep prohibited-request escape rates separate. Segment results where Arabic, English, attachments or different tool actions have materially different behaviour. Review severe individual failures as well as averages, and avoid treating a small evaluation sample as a production guarantee.

Does a valid JSON response mean an AI action is safe?

No. JSON validation establishes structure and some value constraints. It does not establish that a referenced asset belongs to the user, that the business record is current or that the proposed operation is authorised. Add reference, business-condition and permission checks before execution, and route unresolved judgement to an appropriately informed reviewer.

Should an approval remain valid after the AI proposal changes?

Approval should identify the exact proposal, relevant record version, permitted action and expiry. If a change alters the decision context, obtain a new approval. An innocuous display change may not require reapproval if the contract explicitly separates it from the executable payload, but the executor must be able to prove that the approved action itself remained unchanged.

Can we deploy guardrails gradually without enabling write actions?

Yes. A draft-only release can help evaluate interpretation, retrieval and unnecessary blocking while the executor has no write permission. Treat later write access as a separate release decision. It introduces new tests for authority, approval binding, destination acknowledgements, uncertain outcomes and recovery; success in drafting does not demonstrate those controls.

LET’S WORK TOGETHER

Ready to build what’s next?

Tell us about your project or the platform you want to explore, and we’ll come back to confirm a suitable time.