Skip to content

Pipeline Builder

The pipeline builder assembles steps from OPA policy decisions. It has no policy logic of its own. all configuration flows from OPA.

  1. OPA evaluates Rego policies for the agent/org
  2. Returns a JSON decision with step configurations
  3. Pipeline builder assembles steps in position order
  4. Runner executes them sequentially

Steps are registered with the @register decorator:

@register("detect_pii", position=200, category="data_protection", phase="before")
def detect_pii(ctx: PipelineContext, config: StepConfig) -> StepResult:
...

Position determines execution order. Steps in the same phase run in position order.

Each step accepts:

  • on_detection: block, redact, log, or continue
  • threshold: Score threshold for ML-based steps (0.0–1.0)
  • Custom fields specific to each step

Steps are organized into categories:

CategoryPhaseSteps
access_controlbeforevalidate_input, rate_limit, budget
data_protectionbeforedetect_pii, detect_secrets, detect_infra, etc.
threat_detectionbeforedetect_injection, detect_escalation, etc.
route_and_executecallcall_llm, tool_permissions, scan_tool_calls, etc.
response_safetyafterscan_output, taint_check, shell_bleed, etc.
trackingaftercost_tracking, loop_guard