Evaluate Rego with execution trace
rego_eval_with_explainEvaluate a Rego query with full OPA explain tracing and return raw trace events with AST nodes alongside the result, so you can debug policy decisions at the event level.
Instructions
Evaluate with --explain=full and return OPA's raw trace events (with their AST nodes) alongside the result. For a readable trace use rego_explain_decision, which renders the same events as lines. Raw events are large: over the response cap the bound-variable values are dropped first, then trailing events (explanationTruncated), and the result is kept.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | No | Inline input document. | |
| paths | No | Policy / data file or directory paths. Each must be inside an allowed root. | |
| query | Yes | Rego query to evaluate, e.g. "data.example.allow". | |
| source | No | Inline Rego policy source. Optional: without `source` or `paths` the query runs on its own, which is enough to try a built-in or an expression. | |
| partial | No | Run partial evaluation rather than full evaluation. | |
| unknowns | No | Refs to treat as unknown during partial evaluation. | |
| inputPath | No | Path to a JSON input file. Mutually exclusive with `input`. | |
| v0Compatible | No | Read the policy as Rego v0 (`--v0-compatible`), the syntax OPA used before 1.0: rules without `if`, partial sets as `deny[msg] { ... }`. Needed for a policy that has not been migrated, which OPA 1.x otherwise refuses to load. Where the tool also takes a query, the query is read as v0 too, with the future keywords imported so `in`, `every` and `some x in` still work in it. | |
| strictBuiltinErrors | No | Treat builtin errors as fatal instead of returning undefined. |