Rensei docs
API ReferenceWorker Protocol

Sample MAB router for provider selection

Called by the cloud runner at session start to ask the platform's multi-armed bandit router which provider to use. The platform reads Beta-distribution posteriors and runs Thompson sampling over the caller-supplied candidates list. Returns `null` provider with a `source` reason on all error / disabled / explicit-override paths (HTTP 200 always) so the runner can always fall back to its statically resolved provider. Kill-switch: `ROUTING_SELECTOR_ENABLED` env must be exactly `"true"`; default is DARK. Explicit dispatch overrides always return `{ selectedProvider: null, source: 'explicit' }`.

POST
/api/sessions/{id}/routing-select

Authorization

headerAuthorizationBearer <JWT>

Short-lived worker runtime JWT minted by the platform. Claims bind the worker, project, organization, registration, and scopes.

Path Parameters

id*string

Request Body

application/json
  1. body
workType*string
candidates*array<string>

Candidate provider slugs to sample over.

project?string

Response Body

Provider selection result (null on disabled/fallback/explicit paths).

application/json
  1. response
selectedProvider*string|null
source*string
Value in"disabled""explicit""fallback""mab-routing"
expectedReward?number
confidence?number
Example Request
curl -X POST 'https://app.rensei.ai/api/sessions/string/routing-select' \  -H 'Content-Type: application/json' \  -d '{  "workType": "string",  "candidates": [    "string"  ]}'
Example Response
{  "selectedProvider": "string",  "source": "disabled",  "expectedReward": 0,  "confidence": 0}