Glossary

LLM guardrails

Glossary

What are LLM guardrails?

LLM guardrails are runtime controls that detect or block unsafe prompts and responses, such as prompt injection, jailbreaks, sensitive topics, off-topic requests, and leaked personal data, before they reach users, tools, or logs.

Last updated

Guardrails run on inputs, outputs, or both. Input guardrails catch prompt injection and jailbreak attempts, including instructions hidden in tool outputs or retrieved documents. Output guardrails catch leaked secrets, personal data, or responses outside an approved topic. Each check either blocks the request, rewrites it, or flags it for review.

Detectors are usually rule-based (regular expressions and keyword lists, which are fast and cheap) or model-based (an LLM judge or classifier, which catches paraphrased attacks but adds latency and cost). Production systems often run cheap rules first and escalate to a model only when needed.

Guardrails sit in the governance layer of an agent harness. They should fail closed on safety-critical paths and be traced, so you can see when and why a request was blocked. OpenLIT includes open-source guardrails for prompt injection, sensitive topics, topic restriction, and PII redaction (for example openlit.guard.PromptInjection), with LLM-based or regex-based detection, correlated with OpenTelemetry traces so blocked calls appear next to the agent step that triggered them.

FAQ

What are LLM guardrails?

LLM guardrails are runtime checks that detect or block unsafe prompts and responses, such as prompt injection, sensitive topics, off-topic requests, and personal data.

What is the difference between guardrails and evals?

Guardrails run inline on each request and can block it. Evals score quality after the fact, on production traces or test datasets, to find regressions and gate releases.

Are there open-source LLM guardrails?

Yes. OpenLIT (Apache 2.0) includes prompt injection, sensitive topic, topic restriction, and PII redaction guardrails for Python and TypeScript, traced with OpenTelemetry. Guide: https://openlit.io/blogs/protect-prompt-injection.

Related terms

Get started

Ready to use the OpenLIT UI in production?

Self-host or connect your stack in minutes. Same harness UI for traces, dashboards, prompts, and evaluations.