Creates boundary-point validation contracts, defines invariant-based success criteria, and sets up automated verification probes so reliability workflows trigger on objective evidence rather than intuition. Use when designing robust handoff, memory-persistence, or tool-call reliability workflows; when you need to verify handoffs work, check memory persistence, validate tool calls succeeded, or convert vague reliability goals into concrete, testable checks at each boundary point with explicit failure-class mapping (operational vs. critical); or when you want to test your workflow end-to-end, make sure it works, or verify your automation runs correctly using read-back probes and escalation triggers rather than agent confidence. Includes explicit untrusted-content/prompt-injection guardrails for third-party inputs.
96
Quality
90%
Does it follow best practices?
Impact
98%
1.25xAverage score across 9 eval scenarios
A machine learning platform runs a model training pipeline where each stage (data preparation, feature engineering, model training, evaluation) writes an output artifact to disk before the next stage begins. The platform currently has no automated stage-gate checks — engineers manually inspect files before approving the next stage. This approach doesn't scale as the team grows.
The engineering lead wants automated verification scripts that can be run as stage gates in CI. For each stage transition, the script should read the output artifact from the previous stage and confirm it is safe to proceed. The artifacts are JSON files. The platform runs on Python 3.8+.
Produce the following files:
stage_gate.py — A Python verification script that accepts two arguments: a file path and an expected SHA-256 checksum string. The script should:
timestamp field in the JSON is within 5 minutes of current time (if the field exists)contract.md — A one-page contract document describing the invariants this script enforces, with a table showing the boundary point, invariants checked, and failure action for each check.
The script should be runnable with: python stage_gate.py <artifact_path> <expected_sha256>