Skip to main content

Documentation Index

Fetch the complete documentation index at: https://reasonblocks.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

FSMState is the enum at the heart of ReasonBlocks’ difficulty tracking. After scoring each reasoning step, the SDK advances a finite state machine through these states to determine whether to skip E-trace retrieval, switch models, or escalate to a more aggressive intervention. You read the current state from TraceState.current_state and from individual StepRecord.state fields in step_log.
from reasonblocks.types import FSMState

States

StateTrigger conditionBehavior
INITStart of every runTransitions to NORMAL on the first scored step
FASTAll recent steps below fast_threshold (0.2)Skips E-trace retrieval; routes to cheap model if routing is configured
NORMALDefault when difficulty is neither consistently low nor highFull E-trace pipeline runs; default model used
SLOWAll recent steps above slow_threshold (0.6)Routes to strong model if routing is configured; E-trace injection enabled
SKIPExtended struggle: 35+ consecutive steps above skip_threshold (0.85)Most severe intervention; the SDK forces a skip injection to break the loop
ENDAgent produced a final answerRun is complete; no further scoring or injection occurs

State reference

FSMState.INIT

The machine starts in INIT at the beginning of every run. It does not persist past the first scored step — the FSM transitions to NORMAL immediately after the first step is assessed. You will typically only see INIT in StepRecord.state for step index 0.

FSMState.FAST

The FSM enters FAST when all steps in the recent difficulty window fall below fast_threshold (default 0.2). In FAST state, the SDK skips the E-trace retrieval round-trip entirely — the agent is performing well and does not need steering. If you have model routing configured, the SDK routes the next LLM call to the cheaper fast model.

FSMState.NORMAL

NORMAL is the default operating state. The full E-trace pipeline runs: the SDK queries the pattern store, ranks results by similarity, and injects the best-matching guidance into the system prompt. The model specified in your ReasonBlocks config is used without rerouting.

FSMState.SLOW

The FSM transitions to SLOW when all steps in the recent window exceed slow_threshold (default 0.6). This indicates the agent is consistently struggling. E-trace injection continues, and if model routing is configured the SDK upgrades the next call to the strong model.
The FSM uses hysteresis — it requires the entire recent window to be above or below the threshold before changing state. A single high-difficulty step does not immediately push the run into SLOW.

FSMState.SKIP

SKIP is the most severe intervention state. The FSM enters SKIP after 35 or more consecutive steps where difficulty exceeds skip_threshold (default 0.85). At this point the SDK injects a hard skip directive into the system prompt, instructing the agent to exit its current approach and produce a partial answer. This is a last-resort measure to prevent infinite loops from consuming your entire token budget.
Once the FSM enters SKIP, every subsequent step receives the skip injection until the agent produces a final answer and transitions to END. You cannot manually reset the state mid-run.

FSMState.END

The FSM enters END when the agent emits a final answer. No further step scoring, E-trace retrieval, or injection occurs after this transition. The TraceState is frozen and available for inspection.

Checking the current state

After a run completes, read current_state from the middleware’s step_log:
from reasonblocks import ReasonBlocks
from reasonblocks.types import FSMState

rb = ReasonBlocks(api_key="rb_live_...")

with rb.middleware(run_id="run-1", agent_name="bugfixer", task="...") as mw:
    result = agent.invoke({"messages": [("user", "Fix the failing tests.")]})

# mw.step_log is a list[StepLogEntry], one entry per model call
for entry in mw.step_log:
    print(entry.step, entry.fsm_state, entry.difficulty)

Values

FSMState is a standard Python enum.Enum. Each member’s .value is its uppercase string name, which is also what appears in the ReasonBlocks dashboard and API responses.
FSMState.FAST.value    # "FAST"
FSMState.NORMAL.value  # "NORMAL"
FSMState.SLOW.value    # "SLOW"
FSMState.SKIP.value    # "SKIP"
FSMState.INIT.value    # "INIT"
FSMState.END.value     # "END"