File size: 2,345 Bytes
13fe504 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | """Release gate for the verified autonomous agent.
A release must not ship an agent that regresses the deterministic baseline.
This module exposes a single check the release workflow can call: it runs the
offline non-regression comparison and returns a structured pass/fail verdict.
The F1 promotion bar (deciding whether the agent becomes the *default* path)
lives in :func:`dataforge.bench.agent_promotion_verdict`, fed by real eval runs.
"""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from dataforge.bench.agent_gate import AgentGateReport, compare_agent_vs_deterministic
from dataforge.detectors.base import Schema
__all__ = ["AgentReleaseGateResult", "check_agent_release_gate"]
@dataclass(frozen=True)
class AgentReleaseGateResult:
"""Outcome of the agent non-regression release gate."""
passed: bool
report: AgentGateReport
reason: str
def check_agent_release_gate(
fixture_paths: list[Path] | None = None,
*,
schema: Schema | None = None,
) -> AgentReleaseGateResult:
"""Verify the agent reproduces the deterministic floor on bundled fixtures.
Args:
fixture_paths: Optional fixtures; defaults to the bundled gate fixtures.
schema: Optional schema applied to every fixture.
Returns:
An :class:`AgentReleaseGateResult`. ``passed`` is ``False`` if any
fixture shows the agent diverging from the deterministic baseline.
"""
report = compare_agent_vs_deterministic(fixture_paths, schema=schema)
if not report.fixtures:
return AgentReleaseGateResult(
passed=False,
report=report,
reason="No gate fixtures were available to evaluate.",
)
if report.all_parity:
return AgentReleaseGateResult(
passed=True,
report=report,
reason=(
f"Agent reproduced the deterministic floor on all "
f"{len(report.fixtures)} fixture(s); no regression."
),
)
diverged = [item.fixture for item in report.fixtures if not item.parity]
return AgentReleaseGateResult(
passed=False,
report=report,
reason=f"Agent diverged from the deterministic floor on: {diverged}",
)
|