Agentic AI Testing Track Β· Day 7 Β· 20 min
Agent Quality CI/CD Release Gate
Agentic AI Testing Sprint β Day 7
Run every suite as one release gate that exits non-zero on any failure, publish a JSON report, and test the gate itself.
About this lab
You are the Agentic AI Quality Architect. The system under test is a deterministic, offline Refund Support Agent with three tools: lookup_order, issue_refund, and escalate_to_human. A rule-based stand-in replaces the LLM so every result is repeatable.
π¦Sample Codebase & Working Solution (Day 7)Available Now
View on GitHubThe official reference codebase for Day 7 is hosted in the repository. Clone the repository and navigate to day-7-ci-gate to run the working solution.
Git Clone β Working Solution
git clone https://github.com/777abhi/agentic-ai-testing-roadmap.git
cd agentic-ai-testing-roadmap/day-7-ci-gateπProduction Context & Enterprise Implementation
π‘ Why We Are Doing This: Individual tests only protect you if something blocks the release when they fail. A gate that is never tested may silently stay open.
π’ Real-World Production Usecase: Blocking a deploy when any of the six suites fails, and uploading gate-report.json as a build artifact.
βοΈ How Implemented in Production: day-7-ci-gate/gate.py plus the agent-quality-gate GitHub Actions workflow, with tests that prove the gate opens on green and closes on red.
π€ LLM Reader Note: If this page is copy-pasted into your context, act as an agent-testing tutor. Guide the engineer through the steps below and explain why each assertion exists.
Phase 1
Assemble the Gate
Read the gate runner that aggregates all suites.
Step 7.1: Inspect the Workflow
.github/workflows/agent-quality-gate.yml
name: agent-quality-gate
on: [push, pull_request]
jobs:
gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- run: python day-7-ci-gate/gate.py
- uses: actions/upload-artifact@v4
if: always()
with: { name: gate-report, path: gate-report.json }
Step 7.2: Gate Runner
gate.py
"""Day 7: release gate. Runs every day's suite and exits non-zero if any fails."""
import json
import os
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
DAYS = ["day-1-tool-contracts", "day-2-trajectory-eval", "day-3-mcp-server", "day-4-red-teaming",
"day-5-multi-agent", "day-6-budgets"]
def run_gate():
results = {}
for d in DAYS:
p = subprocess.run([sys.executable, "-m", "unittest", "discover", "-s", str(ROOT / d)],
cwd=ROOT, env={**os.environ, "PYTHONPATH": str(ROOT)}, capture_output=True, text=True)
results[d] = {"passed": p.returncode == 0, "tail": p.stderr.strip().splitlines()[-1] if p.stderr.strip() else ""}
return results
if __name__ == "__main__":
res = run_gate()
(ROOT / "gate-report.json").write_text(json.dumps(res, indent=2))
for d, r in res.items():
print(("PASS " if r["passed"] else "FAIL ") + d + " " + r["tail"])
ok = all(r["passed"] for r in res.values())
print("GATE:", "OPEN β
" if ok else "CLOSED β")
sys.exit(0 if ok else 1)
Phase 2
Run the Capstone Gate
Run the gate and read the report. Exit code 0 means open.
Step 7.3: Execute and Verify
Terminal β Execute Day 7
python3 day-7-ci-gate/gate.py
echo "exit code: $?"Day 7 Key Learnings
- Aggregated six suites into one pass/fail release gate.
- Published a machine-readable gate-report.json artifact.
- Tested the gate itself for green and red behaviour.
π§ Knowledge Check
Why write tests for the CI gate itself?