#Examples
One policy, three modes. Suppose your administrator authored a
policy called customer-refund with declared inputs customer,
product, cost, and issue. The same policy can serve three
calls — different mode, same policies array, same inputs
bag.
For the request body shape and response field reference, see Policy engine overview.
#Validate — should this refund go through?
{
"request_id": "5b91d2c4-6a3f-4d1f-9c4a-2f0e7b1f8d4e",
"results": [
{
"slug": "customer-refund",
"version": 4,
"mode": "validate",
"status": "ok",
"outcome": { "passed": true, "reasons": [] },
"failed_predicates": null,
"detail": null,
"citations": [],
"latency_ms": 2
}
],
"summary": null
}
#Generate — draft the response to Sarah
Same policy, mode flipped to generate. The same inputs are
threaded into the LLM prompt — the engine produces
policy-compliant text.
curl -X POST https://aiengine.velgent.com/api/v1/policies/evaluate \
-H "Authorization: Bearer velgent_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"policies": [{ "slug": "customer-refund" }],
"mode": "generate",
"inputs": {
"customer": "sarah@acme.com",
"product": "blender",
"cost": 200,
"issue": "stopped working after 4 months"
}
}'
{
"request_id": "7c81f1a4-2d9e-4f3b-b1a2-9e3d7f0a6c5b",
"results": [
{
"slug": "customer-refund",
"version": 4,
"mode": "generate",
"status": "ok",
"outcome": {
"generated_text": "Hi Sarah, I've reviewed your case for the blender. Since the failure happened within the manufacturer's warranty window, you qualify for a full refund of $200. I'll have it processed today...",
"reason": "Generated by claude-sonnet-4-6."
},
"failed_predicates": null,
"detail": null,
"citations": [],
"latency_ms": 1840
}
],
"summary": null
}
#Decide — pick the right action
Same policy again, mode decide. The administrator has populated
the policy's action catalogue with two options: approve_refund
(with a Workday payload template) and escalate_to_manager. The
LLM picks one based on the inputs.
curl -X POST https://aiengine.velgent.com/api/v1/policies/evaluate \
-H "Authorization: Bearer velgent_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"policies": [{ "slug": "customer-refund" }],
"mode": "decide",
"inputs": {
"customer": "sarah@acme.com",
"product": "blender",
"cost": 200,
"issue": "stopped working after 4 months"
}
}'
{
"request_id": "2a4f9e1c-7b8d-4a1f-9c2e-5e0a3b8f1d4e",
"results": [
{
"slug": "customer-refund",
"version": 4,
"mode": "decide",
"status": "ok",
"outcome": {
"action_id": "approve_refund",
"payload": {
"system": "workday",
"amount": "200",
"user": "sarah@acme.com"
},
"reason": "Customer is within 30-day window and product is defective."
},
"failed_predicates": null,
"detail": null,
"citations": [],
"latency_ms": 1620
}
],
"summary": null
}
The payload is the action's payload_template from the catalogue,
with ${input.X} placeholders substituted against the request inputs.
Your caller fires it downstream — the engine doesn't execute
actions itself.
Each policy declares supported_modes at author time
in the admin console. Calling with a mode outside that list
returns status: "unsupported_mode" on the result row
(200 OK at the request level; the row tells you which modes are
supported). Toggle the missing mode on in the composer to enable it.
Next: Chains →