Reference
Expressions
Use the safe, Python-like expression language shared by tool conditions, approval rules, tests, and drain filters.
Last updated
On this page
Examples
expressions
context.user.role == "admin"
input.tier in ["pro", "enterprise"] and not context.suspended
param.amount > 1000
entry.changes.after.guardrail_type == "prompt_injection"
status == "completed" and output.confidence >= 0.8
params.customer_id == context.fixture_customer_id and invocations == 1Bindings by context
Each field exposes only its documented bindings. An expression with an unavailable binding is rejected or does not match, depending on where it is used.
| Binding | Used by | Value |
|---|---|---|
| input.<path> | Conditional tools | The incoming connector JSON payload. |
| context.<path> | Conditions, approvals, tests | Values added to run or test-builder context. |
| param.<path> / params.<path> | Approvals / tests | Arguments for the tool invocation being evaluated. |
| output | Test assertions | JSON-decoded agent output when possible, otherwise its raw string. |
| entry.<path> | Log and audit drains | A field from the log or audit entry being considered for forwarding. |
| error | Test assertions | The run error or null. |
| status | Test assertions | The final run status. |
| invocations | Tool-call assertions | The number of matching calls to a tool. |
Grammar
Comparisons
==, !=, <, <=, >, >=, in, not in, is, and is not.Boolean operators
Combine checks with
and, or, and not. A bare accessor is a truthiness check.Literals
Strings, numbers,
true, false, null, and list, tuple, set, or object literals.Accessors
Read nested data with dot notation or subscripts, such as
context.user.id or input["items"][0].Deliberately limited
Function calls, imports, arithmetic, assignments, and private attribute access are not supported. Expressions are limited to 2,000 characters. Invalid expressions are rejected or evaluate as false, depending on the field.
Interpolation is different
Expressions return a value for a conditional field. Interpolation inserts a value into text: use $${VAR_NAME} for environment variables and, where documented, $${context.user_id} for per-run context. Prompt templates use {name}; see Context.