Skip to main content

quality-gate-stream

Streaming quality gates — continuous quality scoring for data streams, agent outputs, and pipeline results. Score, filter, and route based on configurable quality thresholds.

What This Gives You

  • Stream scoring — evaluate quality of data as it flows through pipelines
  • Configurable gates — define quality thresholds with pass/fail/warn outcomes
  • Multi-metric — composite scoring from multiple quality signals
  • Routing — route items to different paths based on quality scores
  • Aggregation — rolling quality statistics over configurable windows

Installation

pip install quality-gate-stream

How It Fits

Quality assurance layer in the SuperInstance fleet. Scores agent outputs from plato-training, validates data from conservation-spectral, and gates deployments in the CI pipeline.

Quick Start

from quality_gate import (QualityGate, GateStream, ThresholdConfig,
                          ContentCheck, LengthCheck, FormatCheck)
from quality_gate.gate import GateOutcome

gate = QualityGate(
    "agent-output",
    checks=[
        LengthCheck(min_length=20, max_length=4000, sweet_spot=(100, 2000)),
        ContentCheck(required=["analysis"], forbidden=["TODO"]),
        FormatCheck(pattern=r"^[^\n]+\n"),           # non-empty first line
    ],
    threshold=ThresholdConfig(pass_threshold=0.8, warn_threshold=0.5),
    strict=True,                                      # any hard failure fails the gate
)
gate.add_check(FormatCheck("no-stacktrace", pattern=r"Traceback", must_match=False))

stream = GateStream([gate])
report = stream.process_and_report(agent_outputs)
print(report.summary())                               # ✅ / ⚠️ / ❌ counts
print(report.rolling_pass_rate(window=50))            # rolling quality window

# route by outcome: retry FAILs, promote PASSes, sample WARNs
buckets = stream.partition(agent_outputs)
retry_queue   = buckets[GateOutcome.FAIL]
promoted      = buckets[GateOutcome.PASS]

API

  • QualityGate(name, checks, weights, threshold, strict) — composite scoring over checks; strict=True fails the gate on any hard-failed check (no dilution)
  • GateStream(gates, fail_fast) — ordered pipeline; partition(items) routes by outcome; process_and_report(items) rolls up
  • GateReport — pass/warn/fail counts, per-gate score history, rolling_pass_rate(window)
  • ThresholdConfig(pass_threshold, warn_threshold) — score bands with validation
  • Checks: LengthCheck, FormatCheck, ContentCheck, CustomCheck

Check names within a gate must be unique — duplicate names raise ValueError instead of silently corrupting weights.

License

MIT

Metadata

Release files for quality-gate-stream 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for quality-gate-stream 0.1.1
File Interpreter ABI Platform
quality_gate_stream-0.1.1-py3-none-any.whl Python 3 none any Details

Release files / quality_gate_stream-0.1.1-py3-none-any.whl

Download URL quality_gate_stream-0.1.1-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d99cd501704adbb8eab88115d99abe11a8db19865be6170033652552181be2a
BLAKE2b-256 checksum
How to use checksums
e8d7770048c3f6494c36e1feccebbf86609881ab95fc43c61207f4de3164efe5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page