Skip to main content

PipelineConfig

Struct PipelineConfig 

Source
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: u8

Maximum AST recursion depth. Limits resource consumption on embedded.

§exhaustive_evaluation: bool

If true, always run all engines regardless of paradigm detection. Useful for audit/compliance scenarios where every paradigm must certify.

§confidence_threshold: u8

Minimum confidence threshold. Verdicts below this threshold are denied.

Implementations§

Source§

impl PipelineConfig

Source

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
Hide additional 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}
Source

pub fn embedded() -> PipelineConfig

Minimal config for embedded BIOS-like contexts: fast, shallow evaluation.

Trait Implementations§

Source§

impl Clone for PipelineConfig

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for PipelineConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for PipelineConfig

Source§

fn default() -> PipelineConfig

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.