Skip to content

Configure reasoners

Use reasoner settings to choose which reasoners PyRel uses for your workloads and how PyRel waits for results. This guide covers reasoner selection, logic reasoner settings, and polling behavior.

  • You have access to a Snowflake account with the RelationalAI Native App installed. If you are unsure, contact your Snowflake administrator.
  • You have a working PyRel installation. See Set Up Your Environment for instructions.

Understand what reasoner configuration covers

Section titled “Understand what reasoner configuration covers”

These settings apply after PyRel submits work and a reasoner runs your job:

1. Load and validateconfiguration2. Build modeland query3. SubmitRelationalAI job4. Run job withreasoners5. Materializeresults

Use the sections in this guide to tune three parts of that step:

Each section shows the raiconfig.yaml form, the programmatic form, and a quick way to verify the setting.

Use reasoner name and size settings to configure specific reasoners for PyRel to use.

There are a couple of common patterns for using these settings. Use the following table to choose the workflow that matches your use case:

WorkflowUse it when
Create a new reasoner and use itYou have no existing reasoners and need to fully manage them from config.
Use a reasoner that already existsYou already have a named reasoner and want PyRel to use it as-is.

The following examples show both the raiconfig.yaml and programmatic config patterns for each workflow.

Use this workflow when you have no existing reasoners and want to manage them from your config.

If you want to create the logic reasoner yourself first, use the CLI:

Terminal window
rai reasoners:create --type logic --name team_logic --size HIGHMEM_X64_S --wait

Then configure PyRel to use that reasoner name and size:

connections:
# ...
reasoners:
logic:
name: team_logic
size: HIGHMEM_X64_S
  • If name and size are configured and the named reasoner does not exist, PyRel creates it using the configured size.
  • If the named reasoner already exists, PyRel uses it as-is and does not resize it from config.

Use this workflow when the named reasoner already exists and you want PyRel to use it.

Set reasoners.logic.name to the existing logic reasoner name:

connections:
# ...
reasoners:
logic:
name: team_logic
  • reasoners.logic.name tells PyRel which existing logic reasoner to use for model work.
  • The example omits size because the reasoner already exists.
  • PyRel uses the named reasoner as-is and does not change its size from config.
  • If the reasoner is ever deleted, PyRel will create a new one with the same name if necessary, but it will use the default size for that reasoner type instead of the old size.
  • For both logic and prescriptive reasoners, the default size is HIGHMEM_X64_S.

The logic reasoner runs the rules-based parts of your semantic model. PyRel uses it when it evaluates definitions, requirements, and queries.

The settings in this section live under reasoners.logic.*. Most users can leave them at their defaults. If you do need to change a setting, use this table to find the right subsection:

SubsectionUse it when
Constraint emissionYou want more detail about requirement failures for debugging.
Incremental maintenanceYou want to tune repeated runs that process small data changes.

Use emit_constraints when you need more detail while debugging a failed require() check. This setting controls whether PyRel asks the logic reasoner for additional diagnostics when a requirement fails.

Requirements still pass or fail the same way whether this setting is on or off. It defaults to false, so PyRel returns its usual failure information unless you enable it. When extra diagnostics are available, they may include backend-dependent details such as the violated requirement text or the entities involved in the failing case.

Select the tab for your preferred configuration method and follow the steps to set emit_constraints and verify it.

  1. Set reasoners.logic.emit_constraints in raiconfig.yaml:

    connections:
    # ...
    reasoners:
    logic:
    emit_constraints: true
  2. Verify the configured value:

    from relationalai.config import create_config
    from relationalai.semantics import Model
    cfg = create_config()
    # Use the config.
    m = Model("MyModel", config=cfg)
    # Verify the configured value.
    print(m.config.reasoners.logic.emit_constraints)

Use reasoners.logic.incremental_maintenance to control whether the logic reasoner reuses work from an earlier run when you rerun the same query after your source data changes. This matters most when you regularly rerun the same query or regenerate the same report on refreshed data, such as rerunning the same weekly report after the underlying source tables update.

Leave this setting at "off" unless that repeated-query pattern is important for your workload. "off" is the default and the safest place to start.

Choose one of these modes:

  • "off" (default): Do not use incremental updates.
  • "auto": Use incremental updates where they are supported.
  • "all": Try incremental updates more broadly than "auto".

Select the tab for your preferred configuration method and follow the steps to set incremental_maintenance and verify it.

  1. Set reasoners.logic.incremental_maintenance in raiconfig.yaml:

    connections:
    # ...
    reasoners:
    logic:
    incremental_maintenance: "auto"
  2. Verify the configured value:

    from relationalai.config import create_config
    from relationalai.semantics import Model
    cfg = create_config()
    # Use the config.
    m = Model("MyModel", config=cfg)
    # Verify the configured value.
    print(m.config.reasoners.logic.incremental_maintenance)

Polling settings control how often PyRel checks the status of a long-running reasoner operation. Most users should keep the defaults. Change them only if the default wait behavior is already a problem, for example if status updates feel too slow or you need to reduce polling noise.

Select the tab for your preferred configuration method and follow the steps to set the polling settings and verify them.

  1. Set polling settings under reasoners in raiconfig.yaml:

    connections:
    # ...
    reasoners:
    poll_initial_delay_s: 0.5
    poll_overhead_rate: 0.2
    poll_max_delay_s: 2.0
  2. Verify the configured values:

    from relationalai.config import create_config
    from relationalai.semantics import Model
    cfg = create_config()
    # Use the config.
    m = Model("MyModel", config=cfg)
    # Verify the polling settings.
    print(m.config.reasoners.poll_initial_delay_s)
    print(m.config.reasoners.poll_overhead_rate)
    print(m.config.reasoners.poll_max_delay_s)