Actions
What guardrail-sim does when constraints are violated
Actions
When a policy rule's conditions are met, it triggers a violation event. The policy engine collects these violations and determines whether the discount request is approved.
Violation Events
Each rule defines an event that fires when conditions are met:
Evaluation Result
The evaluation result indicates whether the discount was approved:
Approved (No Violations)
Rejected (Violations Found)
UCP Error Codes
Violations map to UCP-compatible error codes for agentic commerce:
Error Code Mapping
| Violation Rule | UCP Error Code |
|---|---|
max_discount | discount_code_invalid |
margin_floor | discount_code_invalid |
volume_tier | discount_code_user_ineligible |
stacking_not_allowed | discount_code_combination_disallowed |
discount_expired | discount_code_expired |
login_required | discount_code_user_not_logged_in |
Handling Violations
Check Before Applying
Find Maximum Allowed
MCP Tool Integration
The MCP server's evaluate_policy tool returns the same result structure:
AI agents can use this response to:
- Explain why a discount was rejected
- Suggest an alternative discount level
- Negotiate within policy limits