Skip to main content
Version: Next

title: Ideas & Examples description: 10 robust scenarios with copy-paste snippets.

Ideas & Examples (10)

  1. AI Triage for Approvals
Event::listen(\OVAC\Guardrails\Events\ApprovalRequestCaptured::class, function ($e) {
$score = app('ai')->riskScore($e->request->new_data);
if ($score > 0.8) {
// Add an executive step dynamically
$flow = \OVAC\Guardrails\Services\FlowBuilder::make()
->anyOfRoles(['ciso'])
->signedBy(1, 'CISO Review')
->build();
$e->request->meta = array_merge($e->request->meta ?? [], ['extra_flow' => $flow]);
$e->request->save();
}
});
  1. PR Gating (Deploy Flags)
// Treat a PR merge as applying a feature flag update guarded by Ops
Flow::make()->anyOfPermissions(['ops.deploy'])->signedBy(1, 'Ops Gate')->build();
  1. KYC Review
Flow::make()->anyOfRoles(['kyc_officer','compliance_analyst'])->signedBy(1, 'KYC Check')->build();
  1. GDPR Delete Requests
Flow::make()->anyOfRoles(['dpo','security_officer'])->signedBy(1, 'Data Deletion Approval')->build();
  1. Marketing Blast
Flow::make()->anyOfRoles(['marketing_manager','growth_lead'])->signedBy(1, 'Send Approval')->build();
  1. Vendor Access Grant
Flow::make()->anyOfRoles(['it_admin','security_officer'])->signedBy(1, 'Access Grant')->build();
  1. Payment Schedule Change
Flow::make()->anyOfRoles(['finance_manager'])
->signedBy(1, 'Finance Approval')
->build();
  1. Feature Ramp % Change
Flow::make()->anyOfPermissions(['ops.change'])
->includeInitiator(true, true)
->signedBy(2, 'Ops Review')
->build();
  1. Schema Migration Toggle
Flow::make()->anyOfRoles(['sre','eng_lead'])->signedBy(2, 'Release Gate')->build();
  1. External Partner Data Push
Flow::make()->anyOfRoles(['bd_lead','legal_counsel'])
->signedBy(2, 'Partner Data Release')
->build();

Each example can be plugged into model guardrailApprovalFlow() or computed in your controller/interceptor at runtime.