Services

Resources

Company

LLM guardrails

Guardrails are automated checks placed around a large language model (LLM) application to keep its inputs, outputs and actions within set rules. They run outside the model, so they still work when the model is wrong or has been manipulated. A guardrail can block, rewrite, mask or send a request for human approval.

How it works

  • Input guardrails screen prompts for prompt injection, banned topics and personal data.

  • Output guardrails validate the format, mask secrets and catch unsupported claims.

  • Action guardrails limit which tools an agent may call, and require approval for writes.

For example, an output check can match AWS access key IDs, which are 20 characters starting with AKIA, and replace them with [REDACTED] before a response leaves the service.

Why it matters in production

Models are probabilistic, so a rule written in the prompt is a request, not a control. Guardrails enforce the rule in code you can test and log. Each check adds latency and can block good answers, so teams measure false positives the same way they measure errors.

See also

On the One2N blog

Further reading

Comic about guardrails: Pat pastes a log with an email and the input guardrail masks it before the model sees it; the model's answer contains an AWS key starting AKIA and the output guardrail replaces it with REDACTED before Pat reads it; the agent then tries delete_service and the action guardrail holds the call until Asha denies it, with every block logged.