Mini-project: Zero-regression release gate

Gate releases with code guardrails + ScriptedModel CI + Judge config

Put every Reliability skill together into a single release gate script that validates deterministic guardrails, runs an offline CI check under no_model_requests(), and initializes Judge for pre-deploy scoring.

Example

from praisonai import Agent, GuardrailConfig, GuardrailAction, RetryBackoffConfig, ScriptedModel, no_model_requests
from praisonai.eval import Judge

def check_policy(text: str) -> tuple[bool, str]:
    if 'sk-' in text:
        return False, 'Secret detected'
    if len(text.strip()) < 10:
        return False, 'Reply too short'
    return True, text

guard = GuardrailConfig(validator=check_policy, max_retries=2, on_fail=GuardrailAction.RETRY)
backoff = RetryBackoffConfig(base_delay=0.5, max_delay=10.0, jitter_ratio=0.2, max_retries=3)
judge = Judge(criteria='Accurate, concise, and follows refund policy.')

with no_model_requests():
    agent = Agent(
        name='ReleaseCandidate',
        instructions='Answer refund questions concisely.',
        model=ScriptedModel([ScriptedModel.text('Refunds are issued within 30 days of purchase.')]),
        output='silent',
    )
    reply = agent.start('What is your refund window?')
    ok, msg = guard.validator(reply)
    assert ok, msg
    print('Guardrail:', ok, '| Backoff retries:', backoff.max_retries, '| Judge ready:', bool(judge.criteria))
    print('Release gate PASSED ->', reply)

Try it Yourself

Example explained

  • guard + backoff + judge + no_model_requests — Combines all four PraisonAI reliability pillars into one clean pre-release gate.

Next course: Hooks and autonomy

Now that your outputs are guarded and regression-tested, move to Hooks and autonomy to audit every tool call and run bounded autonomous loops.

Reference: documentation