Getting Started

Core Docs

DocumentWhat it covers
Threat ModelWhat we protect against, attack taxonomy, known gaps
Policy TuningWriting custom policies — categories, actions, flag rules, bridges
Deployment GuideDocker, Kubernetes, systemd, embedded Rust, C FFI
Integration GuideSDK and API reference, MCP server, inline proxy
SLI / SLOReliability targets, monitoring, alerting

API Reference

POST /check

Check a tool call against the policy. Returns verdict without executing.

{
  "tool_name": "Bash",
  "target": "rm -rf /",
  "params": {}
}

Response:

{
  "verdict": "deny",
  "action": "rm_rf",
  "confidence": "high",
  "reason": "rm_rf IS_A destructive_op prevents execution",
  "tier": "deterministic",
  "strategy": "category_verdict",
  "latency_us": 124,
  "ellm_trace": ["rule::destructive_op_deny"]
}

POST /forward

Check a tool call and forward it to an upstream executor if allowed. Requires GUARDRAIL_UPSTREAM_URL to be configured.

VerdictBehavior
AllowForwards to upstream, returns upstream response + X-Guardrail-* headers
DenyReturns 403, never forwards
EscalateReturns verdict by default. Set GUARDRAIL_AUTO_FORWARD_ESCALATED=true to forward

GET /health

{
  "status": "ok",
  "guardrail": "ok",
  "upstream": "ok",
  "upstream_url": "http://tool-executor:8080/execute"
}

GET /metrics

{
  "total_checks": 15432,
  "allow_count": 12100,
  "deny_count": 3100,
  "escalate_count": 232,
  "avg_latency_us": 127,
  "uptime_secs": 86400
}

SDK Reference

Python

from ellm_guardrail import GuardrailClient

guard = GuardrailClient()
result = guard.check("Bash", "rm -rf /")

print(result.verdict)    # "deny"
print(result.reason)     # "rm with destructive flags"
print(result.is_allowed) # False
print(result.is_denied)  # True

Full Python SDK docs →

Rust (Embedded)

use ellm_guardrail::pipeline::GuardrailPipeline;

let pipeline = GuardrailPipeline::deterministic_only();
let result = pipeline.check("Bash", "rm -rf /", &[]);
assert_eq!(result.verdict.as_str(), "deny");

Full Rust API docs →

MCP Server (Claude Code)

claude mcp add guardrail -- python -m ellm_guardrail.mcp_server

Architecture

The guardrail has two tiers:

  1. Deterministic tier (always on): Compiles your TOML policy into a Rete forward-chaining network. Every check is the same inference — insert facts, run rules to fixpoint, read verdict. 124µs latency. No LLM. No network calls.

  2. LLM tier (optional, Enterprise): For escalated actions, an LLM reviews the context and intent. This tier is gated behind Enterprise licensing and requires an LLM provider connection.

The deterministic tier is always the primary security boundary. The LLM tier is advisory — it can escalate to Deny but never overrides a deterministic Allow with a Deny.


More Questions?

Contact us or open an issue on GitHub.