Skip to main content
ReasonBlocks is a standard Python package on PyPI. Installation is one pip command. This page covers requirements, the full constructor signature, and the environment variables involved.

Requirements

  • Python 3.10 or later
  • langchain>=1.0
  • httpx>=0.27
Both langchain and httpx are declared as required dependencies and install automatically.

Install the package

To pin a specific version:

Optional dependencies

ImportGraph (Python import graph + blast-radius queries) requires networkx, which is not installed automatically. If you plan to use ImportGraph, install it separately:
The middleware, CodebaseMemory, E-trace injection, and the local monitor suite have no dependency on networkx. You only need it if you call ImportGraph directly.
For local development:

API key

The SDK requires an API key to authenticate with the ReasonBlocks API. Get yours from the Quickstart page in the ReasonBlocks dashboard. Keys start with rb_live_.
The ReasonBlocks constructor does not read REASONBLOCKS_API_KEY from the environment. You must pass api_key explicitly. Storing the key in an env var is still recommended — your code reads it.

Constructor parameters

str
required
Your ReasonBlocks API key. The SDK does not auto-read it from the environment.
str | None
default:"None"
Override the rb-api origin. When unset, the underlying HTTP clients fall back to the REASONBLOCKS_BASE_URL env var, then to the hosted production endpoint. Set this when running rb-api on a self-hosted host or locally.
int | None
default:"None"
Maximum token count tracked per run. Tracked-only — the FSM does not transition to SKIP based on budget consumption; the value is exposed via TraceStateManager.get_budget_used() for callers that want to query it.
dict[str, float] | None
default:"None"
Override DifficultyFSM thresholds. Recognized keys: fast_threshold, slow_threshold, skip_threshold, hysteresis_margin, fast_window, slow_window, skip_window. Unspecified values keep their defaults. See FSM states.
dict[str, str] | None
default:"None"
Map FSM state names ("FAST", "NORMAL", "SLOW", "SKIP") to model identifiers. When the middleware enters a state with a mapping, it overrides the model for that step via request.override(model=...).
bool
default:"True"
When False, E1/E2/E3 injections are not registered, so retrieval calls to rb-api never fire. The monitor steering injection still runs.
bool
default:"True"
Stream run_start / step / run_finish events to rb-api as the run unfolds. Set to False for offline mode — the local step_log still populates.
str
default:"\"coding\""
Server-side monitor weight preset. Built-in profiles: coding (default), pr_review (tuned for read-only review agents), and qa (tuned for question-answering agents). The value is forwarded to /monitors/evaluate and to MonitorSteeringInjection. See Monitor profiles for the per-profile weight tables.
list[str] | None
default:"None"
Accepted for backward compatibility but currently a no-op. The built-in monitor suite runs server-side and ignores any local list. Custom monitors require a custom injection.

Environment variables

Self-hosted deployments

If you run rb-api yourself, point the SDK at it via base_url:
When REASONBLOCKS_BASE_URL is not set, the underlying clients fall back to the hosted production endpoint baked into reasonblocks._settings.DEFAULT_BASE_URL.

Verify your installation

To check that constructor wiring is intact:
If no exception is raised, the install is healthy.