What It Does
LLM Guard intercepts allhexr_llm() calls and scans prompts and responses for security threats using multiple detection strategies.
Scanning Pipeline
1
Prompt Injection Detection
Incoming prompt is analyzed for injection attacks, jailbreak attempts, and adversarial patterns.
2
PII Scanner
Detects and optionally redacts personally identifiable information (names, emails, SSNs, etc.).
3
Secrets Scanner
Catches API keys, tokens, passwords, and other credentials before they reach the LLM.
4
Token Limit Check
Validates the prompt fits within the configured token budget for the model.
5
LLM Provider
The sanitized prompt is forwarded to the configured LLM provider.
6
Response Scanner
The LLM response is scanned for leaked secrets, hallucinated PII, and policy violations.
7
Topic Boundary Check
Ensures the response stays within the agent’s configured topic boundaries.
Scanners
OWASP Top 10 for GenAI Coverage
Integration
LLM Guard is automatically invoked byhexr_llm() — no code changes required:
Configuration
Observability
LLM Guard is fully instrumented with OpenTelemetry. Every scan generates span attributes on the parenthexr.llm.call span and emits dedicated metrics.
Span Attributes
When LLM Guard blocks a prompt or response, the following attributes are set on thehexr.llm.call span:
Blocked requests set the span status to
ERROR with a description like "Blocked by LLM Guard" or "Output blocked by LLM Guard".
Metrics
Grafana Dashboard
The Security dashboard includes an LLM Guard panel showing:- Block rate over time (prompt vs. response)
- Top triggered scanners
- Scan latency percentiles
- Blocks by tenant and agent