Skip to main content

Configuration schema

Every rule document carries a schema version. Local YAML then has two optional configuration keys:

schema_version: 1
tools: {}
sources: {}

schema_version is required for newly created files. ActionRail currently supports version 1 and rejects unknown versions before installing rules. Files created during the private beta without a marker are interpreted as version 1, then normalized when saved through the Console.

Console-managed SDK responses carry the same tools rule object plus separately registered Source metadata.

Tool rule

tools:
<tool_name>:
kind: consequential
args: {}
write: {}
FieldTypeRequiredDescription
kindstringNoDefaults to consequential when loaded. Use consequential for gated tools.
argsobjectNoArgument name to argument rule.
writeobjectNoProposed-effect preview and reporting allowlist.

Argument rule

args:
<argument_name>:
policy: amount <= 200
ground:
checks: []
FieldTypeDescription
policystringOne numeric comparison using <, <=, >, >=, ==, or !=.
ground.checkslistRequired Source checks; every check must pass.

Policy and grounding can coexist on one argument.

Common check fields

- source: billing-production
match: []
on_fail: block
retry:
attempts: 0
on_error: block
FieldType/defaultDescription
sourcestring, requiredName of the configured Source.
matchlist, default existenceShared match conditions.
on_failblock or hold; default blockOutcome after a definitive mismatch.
retry.attemptsinteger; default 0Retries after the first Source exception.
retry.on_errorblock, hold, or allow; default blockOutcome after retry exhaustion.

Adapter-specific request fields:

AdapterCheck fields
SQLitequery using :name bindings.
Postgresquery using %(name)s bindings.
MySQLquery using %(name)s bindings.
HTTPpath, optional method (GET default), optional select.
MCPNo request fields in the normal convention; tool mapping lives on the Source.

Match condition

Field condition:

- column: customer_id
op: eq
ctx: customer_id

Choose one target key unless the operator is set or empty:

Target keyMeaning
ctxCompare with trusted context.
argCompare with another proposed argument.
valueCompare with a literal.
nowCompare as time against now plus an optional offset.

op defaults to eq. Supported values are eq, ne, gt, gte, lt, lte, contains, in, set, and empty.

Result-count condition:

- rows: eq
value: 0

rows accepts eq, ne, gt, gte, lt, or lte.

Write metadata

write:
preview: Refund order {order_id} for {amount}
report_args:
- amount
FieldTypeDescription
previewformat stringLocal proposed-effect preview. All model-facing values are redacted.
report_argslist of argument namesValues permitted to render in the control-plane preview. Empty by default.

Source object

schema_version: 1
sources:
<source_name>:
adapter: postgres
# adapter fields

Common field:

FieldTypeDescription
adapterstringsqlite, postgres, mysql, http, or mcp.

Adapter field references:

Environment references use ${env:VARIABLE} and resolve recursively inside Source configuration in the SDK process.

Complete example

sources:
billing-production:
adapter: postgres
host: postgres.internal
dbname: billing
user: actionrail_reader
password: ${env:BILLING_DB_PASSWORD}
sslmode: verify-full
sslrootcert: /etc/ssl/certs/postgres-ca.pem

tools:
issue_refund:
kind: consequential
args:
amount:
policy: amount <= 200
order_id:
ground:
checks:
- source: billing-production
query: >-
SELECT customer_id, status
FROM orders
WHERE order_id = %(value)s
match:
- column: customer_id
ctx: customer_id
- column: status
value: delivered
on_fail: block
retry:
attempts: 1
on_error: block
write:
preview: Refund order {order_id} for {amount}
report_args: []