SysArt
Book a briefing
SysArt

AI security

Guardrails Architecture for On-Premises AI Agents: Beyond a Single Filter

A layered guardrails architecture for on-premises AI agents: input checks, policy as code bound to identity, output validation, monitoring and human approval.

Last reviewed by SysArt AI Architecture Team6 min readHow we review

In short

Guardrails for on-premises AI agents are a set of independent controls, not one filter: input checks before the model, policy as code that authorises each tool call against the caller's identity, validation of outputs before anything acts on them, monitoring of every layer, and human approval for high-impact actions. Each layer should be simple, testable and logged.

Key takeaways

  • No single classifier can screen inputs, authorise tools, redact data, validate outputs and support audit, so build guardrails as independent layers.
  • Keep security decisions out of the system prompt: OWASP advises against using it as a security control, so authorise tool calls in deterministic code bound to identity.
  • Constrain outputs with schemas or grammars wherever a machine consumes them, and reject anything that does not parse.
  • Monitor the guardrails themselves: shifts in refusal or denial rates signal model updates, data changes or new attacks.
  • Human approval works only if reviewers see the full context and the exact change, so design against automation bias.
Abstract visualization of a neural network and decision pathways

Why is a single safety filter not enough for AI agents?

Because an agent’s risks sit in different places, and no single checkpoint sees them all. Many teams adopt one content classifier, moderation model or rules engine and call it the guardrail. But one filter cannot tell a legitimate policy question from an extraction attempt, enforce tool permissions, redact personal data from a transcript and audit a long-running agent conversation at the same time. Guardrails are an architecture, not a product.

The OWASP Top 10 for LLM Applications 2025 points the same way. Its entry on system prompt leakage (LLM07) warns against relying on prompts for strict control, recommends an independent system to inspect model outputs, and says that privilege separation and authorisation checks belong in deterministic, auditable systems outside the model. On-premises, you control the latency budget, the models and the logging boundary, which makes a genuinely layered design practical.

Layer 1: What should the input gate check?

Cheap, high-signal checks run before a prompt reaches the main model:

  • secret and personal-data scanning, with redaction or rejection;
  • classification against the use cases the agent is approved for;
  • length and token-budget limits;
  • normalisation that removes zero-width characters, look-alike characters and hidden markup that can smuggle instructions, while the original request is kept for audit.

For content classification, a dedicated safeguard model is one option. Llama Guard, described by Inan and colleagues in 2023, is an LLM-based input-output safeguard that classifies prompts and responses against a safety risk taxonomy, and its instruction tuning allows custom categories and output formats. Smaller task-specific classifiers are another option. Whichever you choose, evaluate it on your own traffic, and remember what it is: a content classifier, not an authorisation system.

Reject clearly. When input is blocked, return a structured reason and a correlation ID the user can quote to support. Explicit refusals produce feedback you can learn from; silent ones produce tickets.

Layer 2: How should policy as code govern tool use?

Write policy as structured, versioned rules alongside the application, not as English sentences in a system prompt. The rules state which tools can be invoked, by which roles, against which data classifications and with which approvals.

  • Use a policy engine. Open Policy Agent (OPA) is a general-purpose policy engine that decouples policy decisions from enforcement: the application sends structured input, such as JSON, and receives a decision based on policies written in the Rego language. Rules become reviewable, testable and version-controlled.
  • Use guardrail frameworks where they fit. NeMo Guardrails, an open-source Python package, provides input, retrieval, dialog, execution and output rails; its execution rails validate tool inputs and outputs before and after a tool is invoked.
  • Bind policy to identity, not to the prompt. Every caller, whether a user, a service account or a delegated agent identity, is a principal, and every tool call is evaluated against that principal before it runs. A model can be manipulated into requesting actions nobody intended, and policy as code stops the request before it executes.
  • Keep separate allowlists per workflow. A summarisation agent does not need database-write tools, and a ticket-triage agent does not need shell access. Where tasks need different access levels, OWASP suggests using several agents, each with the least privilege its task requires.

Layer 3: How do you validate outputs before anything acts on them?

Constrain the output wherever a machine consumes it. vLLM’s structured outputs can force a response to be one of a set of choices, to match a regular expression, to follow a JSON schema or a context-free grammar, or to place JSON inside specified tags, using xgrammar or guidance as the backend. A response that does not parse is rejected before a person or another system sees it. Our post on structured output enforcement compares the options across serving engines.

For free text, run an output classifier for policy violations, scan for secrets and personal data, and, for RAG workloads, check that the answer’s claims are supported by the retrieved passages. Verification models and similarity checks can flag unsupported statements, but calibrate their thresholds on your own data before trusting them.

When validation fails, prefer deterministic repair to open-ended regeneration: remove the failing field, retry once with a narrower prompt, or fall back to a fixed response. Unbounded regeneration loops cause latency spikes and unpredictable load.

Layer 4: How do you monitor guardrails in production?

Instrument every layer with structured events: input decisions, policy evaluations, tool invocations, output validations and repairs. Give each event session and tenant context and send it to your on-premises logging stack, so that an investigation can follow a conversation from end to end.

Watch for drift in guardrail behaviour as well as in model behaviour. Sudden changes in refusal rates, classifier confidence or the distribution of policy denials usually mean a model update, a change in the data the agent reads or a new attack pattern, and all three deserve an alert path. Run red-team regression tests against staging on every change to prompts, models or policies, and treat them like security scans that either pass or block the release. Our post on automated red teaming covers the tooling.

Layer 5: When should a human approve an agent’s action?

When the action has high impact: financial transactions, changes to access rights, outbound communication on behalf of the organisation, or irreversible data operations. Provide an approval queue in which the reviewer sees the user’s request, the retrieved evidence, the proposed tool call and the policy evaluation before confirming.

Design against reviewer fatigue, because a reviewer who approves everything adds no safety. Summarise the intent, highlight exactly what would change, and keep approvals rare enough to be read by routing low-risk, reversible actions through automated checks. For high-risk AI systems, Article 14 of the EU AI Act requires a design that lets the people overseeing the system remain aware of automation bias, the tendency to over-rely on its output, and lets them override the output or stop the system. Our post on human oversight for enterprise AI agents covers approval design in more depth.

How do the layers fit together?

Each layer is simple on its own, and that is the point: complex guardrails hide failures, while layered simple guardrails expose them.

LayerPurposeExample controlsEvidence produced
Input gateStop unsafe or out-of-scope requests earlySecret scanning, use-case classifier, normalisationInput decisions with reasons
Policy as codeAuthorise every tool callPolicy engine, per-workflow allowlists, identity bindingPolicy evaluations
Output validationStop malformed or unsafe outputsSchemas and grammars, output classifier, groundedness checkValidation results and repairs
MonitoringDetect drift and attacksStructured events, alerts, red-team regression testsDashboards and test reports
Human approvalKeep people in charge of high-impact actionsApproval queue with full contextApproval records

To put these controls into practice, agree owners with the AI governance checklist, see how they defend against prompt injection in on-premises RAG, and use our agentic AI governance framework for the organisational side. SysArt’s AI security work covers guardrail design and testing for agents that run on infrastructure the client controls.

Featured image by Google DeepMind on Unsplash.

Frequently asked questions

What are guardrails for AI agents?

Guardrails are the controls around a model that decide what goes in, what the agent may do and what comes out. In a layered design they include input checks, policy as code for tool calls, output validation, monitoring and human approval. NVIDIA's open-source NeMo Guardrails, for example, distinguishes input, retrieval, dialog, execution and output rails that run at different stages of an interaction.

Is a safety classifier such as Llama Guard enough?

No. Llama Guard is an LLM-based safeguard that classifies prompts and responses against a safety risk taxonomy, and its instruction tuning allows custom categories. That makes it useful at the input and output gates. It does not decide whether a user may call a tool or see a document, so it must sit alongside policy enforcement, output validation and approvals.

Why should agent policy not live in the system prompt?

Because prompts can be leaked or overridden. OWASP's entry on system prompt leakage says the system prompt should not be treated as a secret or used as a security control, and that privilege separation and authorisation checks must not be delegated to the model. Express policy as code in a policy engine such as Open Policy Agent, and evaluate every tool call against the caller's identity.

How do you validate agent outputs on-premises?

Constrain them wherever a machine consumes them. vLLM, for example, can force output to one of a set of choices, a regular expression, a JSON schema or a context-free grammar. Reject anything that fails to parse before a person or system acts on it. For free text, add an output classifier, secret and personal-data scanning and, for RAG, a check that claims are supported by retrieved sources.

How do you prevent approval fatigue?

Show reviewers only what needs a decision: the request, the evidence, the exact change and the policy result. Route low-risk, reversible actions through automatic checks with logging, so that approvals stay rare enough to be read. For high-risk AI systems, Article 14 of the EU AI Act requires a design that lets overseers remain aware of automation bias, the tendency to over-rely on a system's output.

Related insights

Plan your private AI with people who build it

Book a briefing. We look at your use case, data and constraints, and you leave with the deployment options and governance steps that fit.