Quickstart
Junior-proof. Five steps from composer require to a guarded agent.
Install the package
composer require padosoft/laravel-ai-guardrailsPublish the config
php artisan vendor:publish --tag=ai-guardrails-config(Optional) Publish + run the audit migration — only if you want database-backed audit:
php artisan vendor:publish --tag=ai-guardrails-migrations php artisan migratethen set
AI_GUARDRAILS_AUDIT_STORE=databasein your.env.Guard a tool call (Control A) anywhere in your app:
use Padosoft\AiGuardrails\Facades\AiGuardrails; $safeTool = AiGuardrails::guard($refundTool); // re-scopes owner keys + validates argsScreen a prompt or sanitize output:
$verdict = AiGuardrails::screen($userPrompt); // ->blocked, ->ruleId, ->refusalMessage $clean = AiGuardrails::sanitize($modelOutput); // HTML/markdown sanitized + PII redacted
That’s it. Add the agent middleware to screen prompts and sanitize output automatically on every agent run.
The four controls are on by default — that is the point. The HITL bridge (hitl.enabled) and the HTTP API (api.enabled) are default-OFF because they need optional dependencies or an explicit opt-in.
What you just enabled
Next steps
A walkthrough of each defensive layer and the threat it closes.
Screen prompts and sanitize output automatically on your agents.