Merchant Features: Autopilot & Feature Flags
July 28, 2026 · View on GitHub
Every merchant-level toggle — multi-objective routing, A/B test real-payment interception, elimination, and the two self-tuning features (Autopilot and SR Auto-Calibration) — is read and set through one small feature-flag API.
List Feature Flags
curl "$BASE_URL/merchant-account/merchant_demo/features" \
--header "$AUTH_HEADER"
{
"merchant_id": "merchant_demo",
"features": [
{ "feature": "gsm-scoring-filter", "enabled": false },
{ "feature": "explore-exploit-srv3", "enabled": false },
{ "feature": "ab-test-real-payments", "enabled": true },
{ "feature": "multi-objective-routing", "enabled": true },
{ "feature": "elimination", "enabled": true },
{ "feature": "auto-calibration", "enabled": true },
{ "feature": "autopilot", "enabled": true }
]
}
Toggle A Feature
curl --location "$BASE_URL/merchant-account/merchant_demo/features/autopilot" \
--header "$AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{ "enabled": true }'
Response is the same shape as the list call, re-read after the change so you always see the current effective state of every flag.
Known Features
| Slug | What it controls |
|---|---|
gsm-scoring-filter | Filters gateway scoring using Gateway Status Mapper error-code classification. |
explore-exploit-srv3 | Explore/exploit hedging on the SRv3 scoring path. |
ab-test-real-payments | Whether active A/B test experiments intercept real /decide-gateway traffic — see A/B Testing: Results. |
multi-objective-routing | Merchant-wide default for the cost-aware post-step — see Multi-Objective Routing. Per-request enableMultiObjective overrides this. |
elimination | Gateway-level SR-based elimination (excluding gateways in downtime). |
auto-calibration | Enables the self-tuning background job (see below). Must be on together with autopilot for the job to actually write changes. |
autopilot | Master write-permission switch for the self-tuning job. With auto-calibration off, this alone does nothing. |
What Autopilot & Auto-Calibration Do
These two flags jointly control a background job — there is no separate "run autopilot" endpoint. auto-calibration gates whether the job considers a merchant at all; autopilot gates whether it's allowed to write. Both must be enabled for self-tuning to take effect.
Every polling interval (default 900s, configurable via [sr_auto_calibration] in config/*.toml or SR_AUTO_CALIBRATION_INTERVAL_SECS), the job:
- Reads recent traffic volume from ClickHouse (default 3600s lookback).
- Derives two SRv3 knobs purely from observed data — no merchant input:
- Bucket size — clamped between 100 and 2000, only rewritten on a meaningful (25-step) change.
- Hedging % — capped at 30%, with a 1.0pp minimum move before it updates.
- Writes the result back into the merchant's SR config (readable via
GET /config/routing-keysandGET /config-sr-dimension/:merchant_id), stamped with"source": "autopilot"so autopilot-written values are distinguishable from human-authored overrides.
Every calibration run also emits an analytics event (flow_type: autopilot_calibration) — this is what powers the "Autopilot Actions" panel in the simulation UI, and is queryable via Routing Events.
Reset Gateway Scores
Flushes all SR v2/v3 score and queue keys for a merchant from Redis, and strips any autopilot-written (source: "autopilot") sub-level config overrides — human-authored overrides are preserved. Used by the simulator's "Hard refresh" so a new simulation run starts from a clean slate.
Unlike the feature-flag calls above, this route requires $TENANT_HEADER in addition to $AUTH_HEADER — see Environment setup.
curl --location "$BASE_URL/gateway-score/reset" \
--header "$AUTH_HEADER" \
--header "$TENANT_HEADER" \
--header "Content-Type: application/json" \
--data '{ "merchant_id": "merchant_demo" }'
{
"merchant_id": "merchant_demo",
"deleted_keys": 214,
"removed_overrides": 3
}
This does not disable routing or delete configuration — it only clears live scoring state so the next decisions start from a fresh baseline.