Guardrail Evaluation API
POST /v1/guardrails/evaluate returns the synchronous guardrail decision for content an agent hook is about to act on. Installed agent hooks call it before a tool runs.
body uses the same request shapes as the Gateway (messages, responses, or Anthropic
messages), and stage says which lifecycle point is being evaluated. pre_tool_use is the
supported stage today; the last tool call in body is the pending call.
Authentication#
Use a project API key with guardrails:evaluate. The default project key includes it.
curl "$PROVON_API_URL/v1/guardrails/evaluate" \
-H "Authorization: Bearer $PROVON_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"stage": "pre_tool_use",
"endpoint": "chat-completions",
"body": {
"messages": [
{
"role": "assistant",
"tool_calls": [
{
"type": "function",
"function": {
"name": "Bash",
"arguments": "{\"command\":\"rm -rf /tmp/cache\"}"
}
}
]
}
]
},
"source": "claude",
"sessionId": "session_123",
"cwd": "/repo"
}'PROVON_API_URL has no /v1 suffix.
Request#
| Field | Type | Required | Notes |
|---|---|---|---|
stage |
string | yes | pre_tool_use |
endpoint |
string | yes | chat-completions, responses, or messages |
body |
object | yes | Gateway-shaped request body; the last tool call is pending |
source |
string | no | claude, codex, or cursor |
sessionId |
string | no | Agent session id |
cwd |
string | no | Working directory |
The request body is limited to 256 KiB. The pending call's arguments are evaluated in memory and
are not included in the response or the decision span. source, sessionId, and cwd are hook
attribution; they are not evaluated.
Response#
{
"decision": "allow",
"mode": "audit",
"matched": true,
"wouldBlock": true,
"rule": {
"pluginId": "provon.guard.tool-call-denylist",
"action": "audit",
"direction": "output"
},
"reason": "Audit only: tool-call-denylist would block this tool call."
}| Field | Notes |
|---|---|
decision |
allow or deny. Only deny stops the tool call. |
mode |
Project guardrail mode: off, audit, or enforce. |
matched |
Whether any configured rule matched. |
wouldBlock |
Audit mode matched an enforce rule; the hook records the evidence without blocking. |
rule |
Bounded decision detail: plugin id, action, direction, category, metric, and optional reason. |
reason |
Client-safe explanation for the agent. Never contains matched text or tool arguments. |
error |
evaluation_failed when the policy could not be evaluated; the hook applies its fail mode. |
Decision semantics#
off: allow with no decision.audit: allow, record matches, and setwouldBlockwhen an enforce action would have fired.enforce+block: deny.enforce+transform: deny. The hook boundary cannot rewrite tool arguments, so the call is stopped instead of being executed un-redacted.
Evaluated rules for a pending tool_call are tool-call denylist, PII, secret leak, word list, and
semantic policy. Rules that need a complete model output remain Gateway-only.
Errors#
| Status | Code | Meaning |
|---|---|---|
400 |
INVALID_REQUEST |
Missing/unsupported stage or endpoint, malformed body, no tool call in body, malformed JSON, or an oversized field |
401 |
UNAUTHORIZED |
Missing or invalid project API key |
403 |
FORBIDDEN |
Key lacks guardrails:evaluate |
413 |
PAYLOAD_TOO_LARGE |
Request exceeds 256 KiB |
An internal evaluation failure returns 200 with error: "evaluation_failed" so the hook can apply
its configured fail mode instead of treating the failure as a policy decision.