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.