---
title: "What are LLM guardrails? Input and output checks explained"
description: "Guardrails are checks around an LLM call that block, fix or flag unsafe input and output. Input, output and tool guardrails, their latency cost, and where they run."
url: https://broadrouter.com/glossary/guardrails/
lang: en
updated: 2026-11-14
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Guardrails

Updated 2026-11-14

Guardrails are checks that an application runs around a language model call to keep it within set limits. Input guardrails screen what goes into the model, output guardrails check what comes out, and tool guardrails validate actions before they run. A failed check blocks, rewrites or flags the request.

Also called: LLM guardrails, AI guardrails, input guardrails, output guardrails, safety rails

Guardrails are the checks you wrap around a model so a bad input or a bad output stops at your code, not at your user.

## How it works

The OpenAI Agents SDK describes guardrails as “checks and validations of user input and agent output” and defines three kinds:

| Kind | Runs | Typical check |
| --- | --- | --- |
| Input | Before or alongside the first model call | Off-topic, abusive or injected requests |
| Output | After the final answer | Leaked secrets, policy breaks, wrong format |
| Tool | Before and after a function tool runs | Arguments in range, no destructive action |

When a check fails, a “tripwire” raises an exception and stops the run. Input checks can be blocking (the main model never starts) or parallel (lower latency, but tokens and tool calls may already be spent when the tripwire fires).

NVIDIA’s open-source NeMo Guardrails library uses five stages: input, retrieval, dialog, execution and output rails. Anthropic’s docs suggest a “harmlessness screen”: a small, fast model that classifies user input before it reaches the main conversation, with [structured output](https://broadrouter.com/glossary/structured-output/) so the verdict is a parseable true or false.

Not every guardrail needs a model. Regex filters, allow-lists, JSON Schema validation and length limits are cheap and deterministic.

## Why it matters

-   **Safety.** Guardrails are one layer of defence against [prompt injection](https://broadrouter.com/glossary/prompt-injection/) and [jailbreaks](https://broadrouter.com/glossary/jailbreak/). No single layer stops all of them.
-   **Cost.** A cheap screen can reject a request before an expensive model reads 100,000 tokens of context.
-   **Agents.** An [agent](https://broadrouter.com/glossary/agent/) that sends email or edits data needs tool-level checks and human approval for high-risk steps, not only a filter on the final text.
-   **Measure them.** A guardrail that blocks good requests is a bug. Track false positives with an [eval](https://broadrouter.com/glossary/eval/) set.

## On BroadNet Inference

BroadNet’s docs do not list guardrails, moderation endpoints or content filters. Treat guardrails as your application’s job. A common pattern is a screen on a smaller model such as [BroadNet Gemma 4 VL 26B](https://broadrouter.com/models/gemma-4-vl-26b/) ($0.10 per 1M input tokens), then the main call on a larger model. If inputs contain personal data, see [sending sensitive data to an LLM API](https://broadrouter.com/blog/llm-api-sensitive-data/).

## Questions

### Are guardrails part of the model?

No. Models have their own trained refusals, but guardrails are separate code or model calls that your application runs before and after the main call. You decide what they check.

### Do guardrails add latency?

A blocking input check adds one extra call before the main model starts. The OpenAI Agents SDK can instead run input guardrails in parallel, which saves time but may spend tokens before the check trips.

### Does BroadNet Inference include guardrails?

BroadNet's docs do not list guardrails or content filters as a feature. Build them in your application, for example with a small model as a screen and schema validation on outputs.

## See also

-   [Prompt injection](https://broadrouter.com/glossary/prompt-injection/) (term)
-   [Jailbreak (LLM)](https://broadrouter.com/glossary/jailbreak/) (term)
-   [AI agent](https://broadrouter.com/glossary/agent/) (term)
-   [Structured output](https://broadrouter.com/glossary/structured-output/) (term)
-   [Eval (LLM evaluation)](https://broadrouter.com/glossary/eval/) (term)
-   [System prompt](https://broadrouter.com/glossary/system-prompt/) (term)
-   [PII (personally identifiable information)](https://broadrouter.com/glossary/pii/) (term)
-   [Run the OpenAI Agents SDK on BroadNet Inference](https://broadrouter.com/guides/openai-agents-sdk-custom-provider/) (guide)
-   [Sending sensitive data to an LLM API: redact, minimise, log less](https://broadrouter.com/blog/llm-api-sensitive-data/) (article)
-   [LLM API key security: storage, rotation and IP allow-lists](https://broadrouter.com/blog/llm-api-key-security/) (article)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-guardrails&utm_content=page-cta) ·

**Sources**

-   [OpenAI Agents SDK, guardrails (input, output and tool guardrails, tripwires)](https://openai.github.io/openai-agents-python/guardrails/)
-   [NVIDIA NeMo Guardrails documentation](https://docs.nvidia.com/nemo/guardrails/latest/index.html)
-   [Anthropic, mitigate jailbreaks and prompt injections (harmlessness screens)](https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/mitigate-jailbreaks)
