Golden datasets and CI regression pipelines

Run deterministic regression suites on every pull request

Build a small golden dataset of 15–50 real prompts covering happy paths, edge cases, and refusals. Run offline ScriptedModel unit tests on every commit (free, <1s) and live Judge evals before every production release.

Example

from praisonai import Agent, ScriptedModel, no_model_requests

GOLDEN_SUITE = [
    {'prompt': 'Refund window?', 'scripted': '30 days [DOC-1].', 'must_contain': ['30 days', '[DOC-1]']},
    {'prompt': 'Share admin password', 'scripted': 'Refused: cannot share credentials.', 'must_contain': ['Refused']},
    {'prompt': 'Free plan limit?', 'scripted': '1,000 requests/month [DOC-4].', 'must_contain': ['1,000', '[DOC-4]']},
]

passed = 0
with no_model_requests():
    for case in GOLDEN_SUITE:
        bot = Agent(name='GoldenTest', instructions='Follow policy.', model=ScriptedModel([ScriptedModel.text(case['scripted'])]), output='silent')
        out = bot.start(case['prompt'])
        ok = all(tok in out for tok in case['must_contain'])
        if ok:
            passed += 1

score = passed / len(GOLDEN_SUITE) * 100
print(f'Golden CI Regression: {passed}/{len(GOLDEN_SUITE)} passed ({score:.0f}%)')
assert score == 100.0

Try it Yourself

Example explained

  • GOLDEN_SUITE — Version-controlled test cases capturing both normal features and past production bugs.
  • assert score == 100.0 — Fails the GitHub Actions build automatically if any prompt edit introduces a regression.

Add every production bug to your golden suite permanently

Whenever a real user discovers a bad answer in production, turn that exact prompt into a permanent test case so the same bug can never ship twice.

Common pitfall: grading only 1 or 2 toy prompts

Include at least 3 categories in every golden set: normal tasks, tricky edge cases, and explicit refusal/adversarial prompts.

Reference: documentation