Expand description
§guardrail-core
Core types, pipeline, and stage trait for guardrail-rs — a zero-Python
LLM security proxy written in Rust.
This crate contains no I/O and no async runtime. It is purely the data model and the pipeline abstraction that all other crates build upon.
§Feature flags
| Flag | Description | Default |
|---|---|---|
| (none) | Base functionality, always enabled | — |
§Quick example
use guardrail_core::{Pipeline, PipelineBuilder, Decision};
// Build a pipeline (stages added by guardrail-classifiers)
let pipeline = PipelineBuilder::default().build();
// A pipeline with no stages always allows
let req = guardrail_core::test_helpers::clean_request();
let (decision, _req) = pipeline.run(req).await.unwrap();
assert_eq!(decision, Decision::Allow);§Further reading
- Configuration reference —
the full TOML schema for assembling a
Pipelineviaguardrail-config. - Threat model — what guardrail-rs protects against and its explicit trust boundaries.
- Stage API reference —
the contract every
Stageimplementation must satisfy. - Changelog — release history and notable changes.
Re-exports§
pub use decision::BlockCode;pub use decision::Decision;pub use error::GuardrailError;pub use pipeline::FailMode;pub use pipeline::Pipeline;pub use pipeline::PipelineBuilder;pub use pipeline::Stage;pub use pipeline::StageEvent;pub use pipeline::StageOutcome;pub use request::ChatMessage;pub use request::ContentPart;pub use request::GuardrailRequest;pub use request::MessageContent;pub use request::Provider;pub use request::Role;
Modules§
- decision
- Decision types returned by pipeline stages.
- error
- Unified error type for all guardrail-rs crates.
- pipeline
- The pipeline abstraction:
Stagetrait,Pipeline, andPipelineBuilder. - policy
- User-defined policy engine: the last line of defense.
- request
- Request and response types that flow through the guardrail pipeline.
- test_
helpers - Test helpers shared across all guardrail-rs crates.