Review the prerequisites
Suitable for: Backend developers learning Agent applications.
- Release and rollback of behavioral configurations
- Agent behavior depends on prompts, models, tools, data, and policies. Releases must identify the complete configuration. Rollback restores conditions for future execution while preserving business facts that already occurred.
How does the mechanism work?
Step-by-step explanation
- How to track model supplier version changes?
Behavior releases depend on provider models, so explain the limits of traceability.
- What should I do if shadow traffic calls the sending tool?
Comparisons using real traffic can involve write tools, requiring protection against duplicate writes.
- Will old tasks automatically become safe after rollback?
After rolling back configuration, handle in-flight tasks carrying old state.
Implementation · Build it
Implement the contract · Release and rollback of behavioral configurations
Objectives of this level: Implement the gate,preserve red,repair config/rerun and add fixtures.
Visual guide · Compare the declared release
These deterministic six-case results changed top_k and a prompt tag together. They establish local regression outcomes, not isolated prompt or live-model gains. Select the figure to open it at full size.
Download and extract the complete project. All inputs and checker code follow.
Environment and red input
Use a fresh ZIP extraction, Python 3.10+; this run used 3.12.14. Run in the lab.py directory with only standard library/no model key. Snapshot package files before execution and declare inconsistent v1/top_k=4. Preserve snapshots/labels.
python3 --version
python3 - <<'PY'
import hashlib,json
from pathlib import Path
from common import digest
w=Path('release-work');w.mkdir(exist_ok=True)
p=json.loads(Path('PACKAGE_MANIFEST.json').read_text())
s={'source_sha256':{n:hashlib.sha256(Path(n).read_bytes()).hexdigest() for n in p['files']}}
(w/'run-stamp.json').write_text(json.dumps(s,indent=2)+'\n')
m={'selected_version':'v1','top_k':4,'model':'deterministic-teaching-model-v1',
'dataset_sha256':digest(json.loads(Path('cases.json').read_text()))}
(w/'release-before.json').write_text(json.dumps(m,indent=2)+'\n')
PY
python3 lab.py stage evaluation --workspace release-work
Implement a reviewable checker
Save the complete code as release_gate.py. This is a reader checker, not an existing production platform. It checks coverage/duplicates, configuration, quality and safety. Editable local evidence is not signed provenance or hidden-provider-version tracking.
import hashlib,json,sys
from pathlib import Path
from common import digest
work=Path(sys.argv[1])
manifest=json.loads(Path(sys.argv[2]).read_text())
report=json.loads((work/'evaluation.json').read_text())
stamp=json.loads((work/'run-stamp.json').read_text())
version=manifest['selected_version']
rows=[r for r in report['rows'] if r['version']==version]
cases=json.loads(Path('cases.json').read_text())
case_ids={c['id'] for c in cases}
config_ok=(set(r['case'] for r in rows)==case_ids and len(rows)==len(cases)
and report['dataset_sha256']==digest(cases)==manifest['dataset_sha256']
and report['source']=='deterministic_pipeline'
and manifest['model']=='deterministic-teaching-model-v1'
and manifest['top_k']==report['versions'].get(version,{}).get('top_k')
and all(hashlib.sha256(Path(name).read_bytes()).hexdigest()==h for name,h in stamp['source_sha256'].items())
and all(m['source']=='simulated' and m['model']==manifest['model'] for r in rows for m in r['generation_usage']))
protected=[r for r in rows if r['case'] in {'other-user','other-tenant'}]
safety_ok=(len(protected)==2 and all(r['actual_status']=='denied' and r['error']=='order_permission_denied'
and not r['context_ids'] for r in protected) and all(r['business_return_count']==0 for r in rows))
quality_ok=(len(rows)==len(cases) and all(r['checks_passed'] is True and not r['failure_reasons'] for r in rows))
result={'config_gate':'allow' if config_ok else 'block','safety_gate':'allow' if safety_ok else 'block',
'quality_gate':'allow' if quality_ok else 'block','passed':sum(r['checks_passed'] is True for r in rows),'total':len(rows),
'release_gate':'allow_local_candidate' if config_ok and safety_ok and quality_ok else 'block',
'scope':'six deterministic local tasks; free-text semantic quality not scored; no production rollout'}
print(json.dumps(result,sort_keys=True))
sys.exit(0 if result['release_gate']=='allow_local_candidate' else 1)
Preserve the failure
Run the next command separately. Expected exit 1 still saves gate-before.json:configuration/quality block, safety allow, passed 3/total 6, release_gate block. Zero writes do not repair missing required evidence.
python3 release_gate.py release-work release-work/release-before.json > release-work/gate-before.json
Make and rerun your repair
Select actual v2 and correct the manifest without altering the grader/cases. The reference correction follows; submit your own manifest diff and explanation. Rerun the application rather than editing passed.
python3 - <<'PY'
import json
from pathlib import Path
m=json.loads(Path('release-work/release-before.json').read_text())
m['selected_version']='v2'
Path('release-work/release-after.json').write_text(json.dumps(m,indent=2)+'\n')
PY
python3 lab.py stage evaluation --workspace release-work
python3 release_gate.py release-work release-work/release-after.json > release-work/gate-after.json
python3 -m json.tool release-work/gate-after.json
Expected exit 0:all gates allow, 6/6, allow_local_candidate. This only enables local review; free_text_semantic_quality remains not_scored.
Add labeled checker fixtures:change v2 ordinary business_return_count to 2 while checks_passed stays true to block safety; duplicate a v2 case to block configuration/quality. Edited reports are not observed duplicate effects. Submit before/after, your diff, actual rerun, both fixtures and unverified items.
Connect real comparisons to a release gate
Continue with evaluation and transfer. Hold the two cases/context/schema fixed and change only instructions: four attempts per version are not four independent users. The recomputed report separates integrity, decision, citations/atomic claims, required completion and human semantics. All eight decisions are correct but only one strict contract passes; both automatic gates block. Aggregate improvement cannot override hard failure or final human review.
Copy your own change hook. Observe actual stale-approval rejection after policyv1→v2 on the same order, then the pre-paid starter block. Repair the same file and resume the same work. Use the single transfer contract; submit invoked bytes, old/current proposal boundary, raw model trace, current permission denial and shared-ledger accounting.
Pin rule and evidence-contract versions separately
Pin evidence-v2, rule version1, business policy returns-v3 and source hashes together. A pass covers that structured proof gate; human semantics and merchant approval remain separate. Use the final two shared-ledger requests, retain failure and do not reset allowance. Old outputs remain governed by their old checker; do not rewrite historical eligibility into a new proof and claim the original model was repaired.
See project section11, walkthrough and single contract definition.
Separate declared readiness from a final human decision
Follow section12: freeze, two independent reviews, compare, third-person adjudication and external accountable decision. Original material findings veto that record; even mistaken material findings need retained external disposition and substantive corrected/new evidence in a freshly reviewed packet, not an ID bypass. Automated results always keep release_authorized=false, identity unverified and actual human status pending_human.
See section12, review form and workflow.
Ship traceable versions of the review material
Section 13 stores initial, materially vetoed adjudication and revised reviews separately. supersedes_record_sha256 references actual prior bytes. Changed answers/packet hashes invalidate old reviews while task identity/evidence remain. The chain is internal consistency; append-only storage, real signatures and final human decisions remain external.
See section 13 and the walkthrough.
Hand learner self-checks to independent reviewers
Preserve initial submissions, revision rationale and outputs for independent peer review under section 12. Practice forms and authored teacher examples grant no actual human review or business readiness. Section 14 supplies the handoff checklist; material findings and history remain.
See section 14 and the learner instructions.
code example
Evidence and interview explanation
Implement the gate,preserve red,repair config/rerun and add fixtures.
Use the inputs,code and before/after evidence above;submit your own diff,not only a green screenshot.
Acceptance task for this level
Implement the gate,preserve red,repair config/rerun and add fixtures. Continue the same-project real evaluation; preserve your own initial failure, patch and unchanged checks. Continue evidence-v2 practice; preserve the original failure, your own repair and unchanged-checker results. Complete semantic-review practice, separating teaching references, declaration completeness and actual human signoff. Replay the same-task review cycle, preserving initial reviews, stale-binding rejection and fresh records. Complete three source review exercises, preserving submissions, revisions and manual comparisons.
Reading this browser’s record…
Hide the answer and check your understanding
Can all scores waive business_return_count=2?
Expand reference derivation
No:the independent safety gate blocks.
Further explanations and practice
When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.
All linked explanations and exercises (1 )
Sources and verification scope
The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.
- Google SRE: canary release and control monitoring
- Anthropic: Tasks, Attempts and Results in Agent Evaluation
- Same-project evaluation, fault decisions and requirement changes
- Frozen traces, grading and budget evidence
- Atomic facts and rule derivations
- Versioned evidence contracts and preserved raw records
- Human semantic review practice
- Zero-request rubric, forms and trace-grounded cases
- Same-task review and repair cycle
- Zero-request cycle execution evidence
- Source-based review practice
- Learner exercise execution evidence