Skip to main content
This is the default integration surface for ReasonBlocks: route agent traffic through your hosted gateway, capture workflow traces, and serve a cheaper task-specific model with frontier-model fallback through the same URL. For the step-by-step flow, start with Quickstart. The gateway base URL and the two-line shim are both required; the only choice left is whether install() alone covers the process or each job needs run() — see Integrating your agent.

Gateway URL

Your tenant gateway URL, issued at onboarding:

Agent environment variables

ANTHROPIC_BASE_URL

Required for capture and serving.
string
required
Your tenant’s hosted gateway URL. Must be set before the agent process starts. The same URL is kept after training, when your trained model goes live.

ANTHROPIC_API_KEY

Your Anthropic API key. ReasonBlocks forwards it to upstream on each request. It is not persisted in capture storage.

RBTRACE_DISABLE

Escape hatch, not a supported mode.
string
default:"unset"
Set to 1 to disable the client shim without removing code. Capture continues through the gateway, but for as long as it is set the agent degrades to gateway-only passive inference and its runs are largely not minable. See Integrating your agent — Kill switches.

Client shim (required)

Install in the agent environment alongside the gateway base URL. It is required for every client whose HTTP transport it can patch — httpx, httpx2, aiohttp and botocore, which between them carry the Anthropic, OpenAI, google-genai and boto3 Python SDKs and the frameworks built on them. Without it, run boundaries are inferred rather than proven and most runs never become minable:
function
Call once at process startup. Stamps X-RB-Run and X-RB-Seq on outbound LLM HTTP requests. Patches every transport it finds importable: httpx and httpx2 (the Anthropic and OpenAI Python SDKs), aiohttp (google-genai’s async client) and botocore (boto3 — which sends through urllib3, so it gets botocore’s before-send event hook instead of a patched client; the hook fires after SigV4 signing, so the headers stay outside the signature). Returns False if it patched nothing, and warns by name when google-genai + aiohttp or boto3 are installed but unpatched. Does not replace the gateway; ANTHROPIC_BASE_URL must still point at ReasonBlocks.
function
Only needed for a boto3 client or session built before install() ran — install() registers botocore’s hook for every session built after it, and cannot reach one that already exists. Accepts a boto3 client, a boto3 Session, a botocore Session, an event emitter, or nothing for boto3’s default session if one has been created. Returns whether it registered; repeat calls are no-ops.
function
The transports actually patched, as a tuple. Worth asserting at start-up: an unpatched transport looks exactly like a working one until the runs turn out not to be minable.
context manager
One fresh run id per with block. Needed whenever one process handles more than one logical job — batch loops, worker pools, threaded workers — so distinct jobs do not merge into one trace. A single-job process needs install() only.
Full decision guide, and the clients the shim cannot reach: Integrating your agent.

What the gateway captures

Each Anthropic Messages request/response pair that transits the gateway is written to hosted storage. ReasonBlocks reconstructs runs server-side and labels them: The shim is what makes golden the common case rather than the exception; scoping run() per job is what keeps it that way in multi-job processes. For OpenAI Chat Completions, Responses API, Gemini, and other paths, see Endpoint compatibility.

Training and trained model serving (hosted)

Training and serving your trained model run on ReasonBlocks infrastructure under your tenant. See Quickstart for the end-to-end flow. After training, serving uses the same ANTHROPIC_BASE_URL with a flat transcript contract (render_flat).

Other deployment models

The hosted gateway is the supported path. For the gateway on your own infrastructure, on-prem serving, or another deployment model, reach out.