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 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 and jailbreaks. 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 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 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 ($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.