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:
Use the sections in this guide to tune three parts of that step:
- Reasoner selection controls which logic and/or prescriptive reasoner PyRel uses for a workload.
- Logic reasoner settings control constraint reporting and incremental maintenance.
- Polling behavior controls how PyRel waits for long-running operations.
Each section shows the raiconfig.yaml form, the programmatic form, and a quick way to verify the setting.
Select which reasoners to use
Section titled “Select which reasoners to use”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:
| Workflow | Use it when |
|---|---|
| Create a new reasoner and use it | You have no existing reasoners and need to fully manage them from config. |
| Use a reasoner that already exists | You 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.
Create a new reasoner and use it
Section titled “Create a new reasoner and use it”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:
rai reasoners:create --type logic --name team_logic --size HIGHMEM_X64_S --waitThen configure PyRel to use that reasoner name and size:
connections: # ...
reasoners: logic: name: team_logic size: HIGHMEM_X64_Sfrom relationalai.config import create_config
cfg = create_config( reasoners={ "logic": { "name": "team_logic", "size": "HIGHMEM_X64_S", } })
print(cfg.reasoners.logic.name)print(cfg.reasoners.logic.size)If you want to create the prescriptive reasoner yourself first, use the CLI:
rai reasoners:create --type prescriptive --name team_prescriptive --size HIGHMEM_X64_S --waitThen configure PyRel to use that reasoner name and size:
connections: # ...
reasoners: prescriptive: name: team_prescriptive size: HIGHMEM_X64_Sfrom relationalai.config import create_config
cfg = create_config( reasoners={ "prescriptive": { "name": "team_prescriptive", "size": "HIGHMEM_X64_S", } })
print(cfg.reasoners.prescriptive.name)print(cfg.reasoners.prescriptive.size)- If
nameandsizeare 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 a reasoner that already exists
Section titled “Use a reasoner that already exists”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_logicfrom relationalai.config import create_config
cfg = create_config( reasoners={ "logic": { "name": "team_logic", } })
print(cfg.reasoners.logic.name)reasoners.logic.nametells PyRel which existing logic reasoner to use for model work.- The example omits
sizebecause the reasoner already exists. - PyRel uses the named reasoner as-is and does not change its size from config.
Set reasoners.prescriptive.name to the existing prescriptive reasoner name:
connections: # ...
reasoners: prescriptive: name: team_prescriptivefrom relationalai.config import create_config
cfg = create_config( reasoners={ "prescriptive": { "name": "team_prescriptive", } })
print(cfg.reasoners.prescriptive.name)reasoners.prescriptive.nameis the public config field for solver workloads.- The example omits
sizebecause the prescriptive reasoner already exists. - PyRel uses the existing reasoner as-is and does not resize it 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
sizeisHIGHMEM_X64_S.
Configure logic reasoner settings
Section titled “Configure logic reasoner settings”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:
| Subsection | Use it when |
|---|---|
| Constraint emission | You want more detail about requirement failures for debugging. |
| Incremental maintenance | You want to tune repeated runs that process small data changes. |
Enable or disable constraint emission
Section titled “Enable or disable constraint emission”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.
-
Set
reasoners.logic.emit_constraintsinraiconfig.yaml:connections:# ...reasoners:logic:emit_constraints: true -
Verify the configured value:
from relationalai.config import create_configfrom relationalai.semantics import Modelcfg = create_config()# Use the config.m = Model("MyModel", config=cfg)# Verify the configured value.print(m.config.reasoners.logic.emit_constraints)
Set reasoners.logic.emit_constraints with LogicReasonerConfig or a plain Python dict.
-
Set the value with a typed config class:
from relationalai.config import LogicReasonerConfig, ReasonersConfig, create_configfrom relationalai.semantics import Modelcfg = create_config(reasoners=ReasonersConfig(logic=LogicReasonerConfig(emit_constraints=True,)))# Use the config.m = Model("MyModel", config=cfg)# Verify the configured value.print(m.config.reasoners.logic.emit_constraints) -
Alternatively, set the value with a dict:
from relationalai.config import create_configfrom relationalai.semantics import Modelcfg = create_config(reasoners={"logic": {"emit_constraints": True,}})# Use the config.m = Model("MyModel", config=cfg)# Verify the configured value.print(m.config.reasoners.logic.emit_constraints)
Enable or disable incremental maintenance
Section titled “Enable or disable incremental maintenance”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.
-
Set
reasoners.logic.incremental_maintenanceinraiconfig.yaml:connections:# ...reasoners:logic:incremental_maintenance: "auto" -
Verify the configured value:
from relationalai.config import create_configfrom relationalai.semantics import Modelcfg = create_config()# Use the config.m = Model("MyModel", config=cfg)# Verify the configured value.print(m.config.reasoners.logic.incremental_maintenance)
Set reasoners.logic.incremental_maintenance with LogicReasonerConfig or a plain Python dict.
-
Set the value with a typed config class:
from relationalai.config import LogicReasonerConfig, ReasonersConfig, create_configfrom relationalai.semantics import Modelcfg = create_config(reasoners=ReasonersConfig(logic=LogicReasonerConfig(incremental_maintenance="auto",)))# Use the config.m = Model("MyModel", config=cfg)# Verify the configured value.print(m.config.reasoners.logic.incremental_maintenance) -
Alternatively, set the value with a dict:
from relationalai.config import create_configfrom relationalai.semantics import Modelcfg = create_config(reasoners={"logic": {"incremental_maintenance": "auto",}})# Use the config.m = Model("MyModel", config=cfg)# Verify the configured value.print(m.config.reasoners.logic.incremental_maintenance)
Configure reasoner polling behavior
Section titled “Configure reasoner polling behavior”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.
-
Set polling settings under
reasonersinraiconfig.yaml:connections:# ...reasoners:poll_initial_delay_s: 0.5poll_overhead_rate: 0.2poll_max_delay_s: 2.0 -
Verify the configured values:
from relationalai.config import create_configfrom relationalai.semantics import Modelcfg = 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)
Set polling settings with ReasonersConfig or a plain Python dict.
-
Set the values with a typed config class:
from relationalai.config import ReasonersConfig, create_configfrom relationalai.semantics import Modelcfg = create_config(reasoners=ReasonersConfig(poll_initial_delay_s=0.1,poll_overhead_rate=0.25,poll_max_delay_s=5.0,))# Use the config.m = Model("MyModel", config=cfg)# Verify the configured values.print(m.config.reasoners.poll_initial_delay_s)print(m.config.reasoners.poll_overhead_rate)print(m.config.reasoners.poll_max_delay_s) -
Alternatively, set the values with a dict:
from relationalai.config import create_configfrom relationalai.semantics import Modelcfg = create_config(reasoners={"poll_initial_delay_s": 0.1,"poll_overhead_rate": 0.25,"poll_max_delay_s": 5.0,})# Use the config.m = Model("MyModel", config=cfg)# Verify the configured values.print(m.config.reasoners.poll_initial_delay_s)print(m.config.reasoners.poll_overhead_rate)print(m.config.reasoners.poll_max_delay_s)