ReasonBlocks tracks the agent’s difficulty across every step using a finite state machine. When difficulty stays low for several consecutive steps, the FSM moves toDocumentation Index
Fetch the complete documentation index at: https://reasonblocks.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
FAST. When it stays high, the FSM moves to SLOW. Model routing maps those states to different model identifiers, so you can run a cheap fast model on easy steps and a more powerful model when the agent is struggling — with no changes to your agent code.
Model routing is disabled by default. It activates only when you pass
model_routing to the ReasonBlocks constructor.How the FSM states affect routing
The FSM has five states:INIT, FAST, NORMAL, SLOW, and SKIP. Two of them affect model routing:
| State | When it activates | Effect on routing |
|---|---|---|
FAST | Last 6 difficulty scores all below 0.2 | Routes to the FAST model; also skips E-trace retrieval |
SLOW | Last 5 difficulty scores all above 0.6 | Routes to the SLOW model |
NORMAL | Default; between FAST and SLOW thresholds | No routing override — uses the agent’s configured model |
SKIP | Last 35 difficulty scores all above 0.85 | No routing override — agent is likely stuck |
FAST state, ReasonBlocks skips the E-trace retrieval pipeline (vector search + embeddings) entirely in addition to switching models. This means fast, confident steps cost less in both LLM tokens and API calls to the pattern store.
Configure routing
Pass amodel_routing dict to ReasonBlocks mapping FSM state names ("FAST", "SLOW") to model identifiers. The identifiers follow LangChain’s init_chat_model format — "provider:model-name".
Customize FSM thresholds
The default thresholds (fast_threshold=0.2, slow_threshold=0.6, skip_threshold=0.85) work well for most coding agents. You can tune them for your workload via fsm_thresholds:
hysteresis_margin (default 0.1) that prevents thrashing at state boundaries. A state transition requires the difficulty to cross the threshold by at least this margin before switching back.
Full configuration example
This is the complete configuration from the README, combining model routing with all other available options:Inspect routing decisions
After a run,mw.step_log shows the resolved model ID for each step. The model_id field is only populated when routing overrode the agent’s default model.
NORMAL, drops to FAST for several steps, then escalates to SLOW: