pub struct PipelineConfig {
pub depth_limit: u8,
pub exhaustive_evaluation: bool,
pub confidence_threshold: u8,
}Expand description
Configuration for the governance pipeline.
Fields§
§depth_limit: u8Maximum AST recursion depth. Limits resource consumption on embedded.
exhaustive_evaluation: boolIf true, always run all engines regardless of paradigm detection. Useful for audit/compliance scenarios where every paradigm must certify.
confidence_threshold: u8Minimum confidence threshold. Verdicts below this threshold are denied.
Implementations§
Source§impl PipelineConfig
impl PipelineConfig
Sourcepub fn healthcare() -> PipelineConfig
pub fn healthcare() -> PipelineConfig
Conservative config for healthcare/HIPAA contexts: exhaustive evaluation, higher confidence threshold.
Examples found in repository?
examples/comparison_opa.rs (line 58)
54fn main() {
55 println!("=== URGE side of the OPA comparison ===\n");
56 println!("policy expression: {POLICY}\n");
57
58 let pipeline = GovernancePipeline::new(PipelineConfig::healthcare());
59
60 // Case 1: everything in order — same PERMIT OPA gives.
61 evaluate(&pipeline, true, true);
62
63 // Case 2: review missing. OPA says deny. URGE says deny AND reports the
64 // cross-paradigm finding: the temporal constraint is violated while the
65 // deontic obligation is active — a contradiction, not just a false.
66 evaluate(&pipeline, true, false);
67
68 // Part 2 — what OPA has no vocabulary for at all: the review is an
69 // obligation with a deadline, tracked across time.
70 println!("=== Obligation lifecycle (no OPA equivalent) ===\n");
71 let mut mgr = ObligationManager::new();
72 mgr.register(
73 Obligation::new(
74 "review-P123",
75 ObligationType::Obligatory,
76 "payment-agent",
77 "complete_review",
78 Some(1000), // deadline at t=1000
79 0,
80 ),
81 0,
82 );
83 println!("t=0 obligation registered: complete_review, deadline t=1000");
84 println!(
85 " active={} violated={}",
86 mgr.active_count(),
87 mgr.violated_count()
88 );
89
90 let violations = mgr.process(ObligationEvent::TimeTick { now: 2000 });
91 println!("t=2000 time tick — deadline exceeded, review never happened");
92 for v in &violations {
93 println!(" VIOLATION EVENT: {v:?}");
94 }
95 println!(
96 " active={} violated={}",
97 mgr.active_count(),
98 mgr.violated_count()
99 );
100}More examples
examples/agent_gate.rs (line 27)
24fn main() {
25 println!("=== URGE Agent Governance Gate Demo ===\n");
26
27 let pipeline = GovernancePipeline::new(PipelineConfig::healthcare());
28
29 let actions = &[
30 AgentAction {
31 agent_id: "billing-agent",
32 action: "submit_claim",
33 is_authorized: true,
34 audit_running: true,
35 governance_expr: "must authorized and always audit_running",
36 },
37 AgentAction {
38 agent_id: "rx-agent",
39 action: "prescribe_medication",
40 is_authorized: false, // Not authorized — should be denied.
41 audit_running: true,
42 governance_expr: "must authorized and must verified_order",
43 },
44 AgentAction {
45 agent_id: "intake-agent",
46 action: "access_phi",
47 is_authorized: true,
48 audit_running: false, // Audit not running — HIPAA violation.
49 governance_expr: "must authorized and always audit_running",
50 },
51 AgentAction {
52 agent_id: "scheduler-agent",
53 action: "book_appointment",
54 is_authorized: true,
55 audit_running: true,
56 governance_expr: "must authorized",
57 },
58 ];
59
60 println!("{:<20} {:<25} {:<12}", "Agent", "Action", "Decision");
61 println!("{}", "-".repeat(60));
62
63 for action in actions {
64 let slots: &[(&'static str, ContextValue)] = &[
65 ("authorized", ContextValue::Bool(action.is_authorized)),
66 ("audit_running", ContextValue::Bool(action.audit_running)),
67 ("verified_order", ContextValue::Bool(false)), // Default: not verified.
68 ];
69
70 let ctx = EvalContext {
71 slots,
72 logical_time: 0,
73 depth_limit: 16,
74 };
75
76 let verdict = pipeline.evaluate_str(action.governance_expr, &ctx);
77
78 println!(
79 "{:<20} {:<25} {}",
80 action.agent_id,
81 action.action,
82 if verdict.valid {
83 "PERMITTED ✓"
84 } else {
85 "DENIED ✗"
86 },
87 );
88
89 if !verdict.valid {
90 println!(
91 " Confidence: {:.0}% | Conflicts: {} | Paradigms: {}",
92 verdict.confidence.as_f32() * 100.0,
93 verdict.cross_validation.conflicts_detected,
94 verdict.paradigms_evaluated.iter().count(),
95 );
96 println!(" Formal: {}", verdict.formal_notation);
97 println!(" Trace ({} steps):", verdict.trace.len());
98 for entry in verdict.trace.entries.iter().take(3) {
99 println!(" [{:?}] {:?}", entry.stage, entry.description);
100 }
101 }
102 }
103
104 println!("\n=== Agent governance summary ===");
105 println!(" Every agent action is gated by formal logic, not behavioral alignment.");
106 println!(" The governance layer is: deterministic, auditable, sub-millisecond.");
107 println!(" No LLM inference involved in permit/deny decisions.");
108 println!(" This is the URGE architecture operating as designed.");
109}Sourcepub fn embedded() -> PipelineConfig
pub fn embedded() -> PipelineConfig
Minimal config for embedded BIOS-like contexts: fast, shallow evaluation.
Trait Implementations§
Source§impl Clone for PipelineConfig
impl Clone for PipelineConfig
Source§fn clone(&self) -> PipelineConfig
fn clone(&self) -> PipelineConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PipelineConfig
impl Debug for PipelineConfig
Source§impl Default for PipelineConfig
impl Default for PipelineConfig
Source§fn default() -> PipelineConfig
fn default() -> PipelineConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PipelineConfig
impl RefUnwindSafe for PipelineConfig
impl Send for PipelineConfig
impl Sync for PipelineConfig
impl Unpin for PipelineConfig
impl UnsafeUnpin for PipelineConfig
impl UnwindSafe for PipelineConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more