Skip to chapter content
navan✳THE BUILD LABAI ENGINEERING / GUIDE
0/21 read
COOKBOOK 08 / 8

A release gate and monitoring loop.

Turn task, permission, holdout, fallback, and live status into an explicit release decision.

BY NAVAN SAMICOMPLETE EXAMPLEPYTHON 3
01 / THE PURPOSE

Why this workflow exists.

An AI feature can pass a few demos while still lacking a fallback or a permission review. A release gate makes necessary evidence visible. It should point to the actual test results and owners, not merely a checkbox. This small script shows how a decision can fail with a reason instead of a vague “not ready.”

After release, monitoring and the ability to revert matter as much as the initial gate. A model or document update can change behavior without a code change.

Code context. Python 3 standard library only. The report is fictional and included in the script.

02 / COMPLETE PYTHON

The whole example.

release-gate.py
REQUIRED = ("task_defined", "permission_checked", "holdout_passed", "fallback_ready")


def release_decision(report):
    missing = [name for name in REQUIRED if not report.get(name)]
    if missing:
        return {"ready": False, "reason": "Missing: " + ", ".join(missing)}
    if report.get("critical_failures", 0):
        return {"ready": False, "reason": "Critical failures need review"}
    return {"ready": True, "reason": "Begin monitored rollout"}

report = {
    "task_defined": True,
    "permission_checked": True,
    "holdout_passed": True,
    "fallback_ready": False,
    "critical_failures": 0,
}
print(release_decision(report))
report["fallback_ready"] = True
print(release_decision(report))
03 / READ THE FLOW

What each stage does.

The first call returns a missing-fallback reason. After the report changes, the second returns a monitored-rollout decision. The function checks critical failures separately because a passing average should not hide a severe case.

In real work, each field would link to evidence: an approved task definition, access-control review, versioned holdout report, and a demonstrated fallback. A human owner would make the final release decision. The code simply prevents those conditions from disappearing into an informal conversation.

04 / THE RESULT

What the output means.

The output moves from not ready to ready only after the fallback condition is present. The decision remains conditional on the quality of the evidence behind each field.

05 / THE BOUNDARY

Where the example stops.

A boolean gate cannot judge whether the holdout represents real users or whether an access review was thorough. Maintain a rollback path, live traces, and an incident process after launch.

Built with curiosity. By Navan Sami. ↗AI engineering · From model calls to reliable systems.