Lanes

Experiment planning for Flagsmith

Every A/B test
gets its own lane.

Lanes gives each experiment a slice of your traffic, refuses plans that overlap another running test, and checks afterwards that the slices held.

For product teams that run several experiments at once on Flagsmith, and want to know a result is real before someone rolls it out.

$ docker compose up -d   # Flagsmith 2.295.2 + Postgres
$ make setup             # Python venv with the Flagsmith SDK
$ make demo              # four live demos, 8 to 12 minutes

Needs Docker and Python 3.9+. 8 to 12 minutes is the time of the make demo step; the code is not on a public host yet. Step-by-step guide.

All demo traffic is simulated0 real usersNo language model, on purposeA person approves twice

1000 lanes, one hash per user

Example plan from the README

A user's identity is hashed with SHA-1 to a number from 0 to 999 and stored as the trait lane. Each experiment's audience is a Flagsmith segment, lane in [lo, hi). Two experiments on the same days share no users.

The problem

Two tests on the same users can both be wrong.

Test A changes the checkout page. Test B changes the checkout button. Both run on everyone, because nothing says they can't. Illustrative scenario. The numbers in the demo below are simulated and are labelled that way.
  1. 01

    Interaction

    B is +40% for users who also see A and -40% for users who do not. Run together, B looks like "no effect". The interaction demo reproduces exactly this.

  2. 02

    Polluted control

    Code asks Flagsmith for the flag for everyone, not only for the experiment's audience. Outsiders land in the control arm and the split goes uneven.

  3. 03

    Peeking and silent drift

    A clear result at 23% of the planned sample is not a result yet. A setting edited by hand in Flagsmith can differ from the plan.

Lanes plans around the first two, flags the third, and says "do not roll out on this" when it cannot trust a number.

The product, as it really prints

A plan card, a refusal, and a verdict you can read.

This is text copied from plan.txt, refusals.txt and make_demo.txt, saved from a real run against a self-hosted Flagsmith. There are no screenshots of a web app because Lanes is a command-line tool with a read-only timeline page.

lanes planplan 1e674939c1
PLAN 1e674939c1  'Reduce churn on the pricing page'
  lane       : 0-4  (5 of 1000 lanes = 0.5% of identities)
  window     : 2026-11-29 to 2026-12-10  (12 days)
  sample     : 1447 identities per arm, 2894 in total
               (baseline 20.0%, detect +20% lift,
                alpha 0.05, power 0.8)
  flagsmith  : feature 'lane_reduce_churn_...',
               segment 'lane_000_004', split 50/50
  direction  : LOWER is better  (GUESSED: check before approving)
  will NOT   : call rollout, complete or delete.
               Waits for your approval before create
               and again before start.

next: python -m lanes approve 1e674939c1 create --by <you>
refusalsreal output, exit code 1
$ lanes create 1e674939c1
REFUSED: no recorded human approval for plan
  1e674939c1 stage 'create' matching its current content

$ lanes approve 1e674939c1 create --by judge
  (stdin /dev/null, no terminal)
REFUSED: approval needs a person at a terminal
  (no /dev/tty here).

$ lanes plan 'Increase signups...' --lanes 0-99
REFUSED: lane 0-99 overlaps with: Reduce churn on the
  pricing page (lane 0-4, 2026-11-29 to 2026-12-10)

$ lanes plan 'increase churn alerts, baseline 10%'
REFUSED: 'increase' with 'churn' ... is ambiguous;
  say which way is good with --direction up|down

The plan id is a hash of the plan's content. Change anything and the approval no longer matches. The same request on the same day gives the same plan id and the same refusal.

Verdict labels

Every verifier run ends in one of these, computed from Flagsmith's exposures and results plus the local ledger.

COLLECTING_DATA

No results from Flagsmith yet. Wait.

INCONCLUSIVE

The 95% interval includes zero. No effect is proven; that does not show there is none.

EARLY_SIGNAL

Clear interval, but less than the planned sample. Not a result yet.

WINNING / LOSING

The interval excludes zero at the planned sample. A person decides what happens next.

CONFOUNDED

The experiment shared identities or lanes with another one. Its lift can be an interaction: do not roll out on this.

INVALID

Sample ratio mismatch or exposures outside the lane. Do not trust the results.

How it works

Plan, approve twice, serve in the lane, verify.

The planner and verifier are plain code with unit tests. A person sits in the middle of the loop at a terminal, and Lanes cannot move past that point on its own.

Lanes data flow A request goes to the planner, which checks overlap and produces a plan card. A person types APPROVE at a terminal before create and again before start. Create writes to Flagsmith, which holds the segment, flag, metric and experiment. In production traffic, the LaneClient lets only in-lane identities reach Flagsmith. The verifier reads Flagsmith exposures and results plus the local ledger and prints a verdict. PLAN Request"Test checkout copy,baseline 10%, +30%" Plannerpower math, lane width,dates, overlap check Plan cardid = hash of content"will NOT" list overlap: REFUSED APPLY Person types APPROVEon /dev/tty, before create and again before start Flagsmith (self-hosted) segment "lane in [lo, hi)" multivariate flag, 50/50 metric + experiment read back and compared RUN AND CHECK Trafficidentity, user id LaneClientin lane: ask Flagsmith. Else: control in-lane only Verifierreads results, prints verdict

Swipe the diagram sideways to see all of it.

Lanes code runsA person must actFlagsmith holds the state
  1. Plan. Sample size from the power math, lane width from traffic, dates, and the metric direction (a keyword guess, marked GUESSED).
  2. Approve. The approval stores the plan hash. Any edit voids it. No terminal, no approval.
  3. Create and start. Segment, flag, metric, experiment. Lanes reads them back and refuses to start on any difference.
  4. Serve in the lane. Out-of-lane users get control with no Flagsmith call, so nobody outside is counted as control.
  5. Verify. Sample ratio, pollution, overlap, conversions sent vs counted, lift with a 95% interval, verdict and next step.

Where a language model could plug in: before the plan card, to turn a sentence into a plan request. Today that slot is filled by regular expressions plus stated defaults. The MCP server has plan, explain, create, start, verify, cancel and timeline tools, and no approve, rollout, complete or delete tool. It was tested only by piping JSON-RPC, never with a live LLM client.

Built on Flagsmith

Seven Flagsmith features do the work.

Without Flagsmith, Lanes has nothing to serve, count or analyse. Writes go through the REST API because the Flagsmith MCP server has no start, rollout or refresh tools.

The seven features and the code that uses them
Flagsmith featureHow Lanes uses itCode
Identity traitsEach identity carries a lane trait, 0 to 999, from a SHA-1 hash.wrapper.py
SegmentsOne segment per lane range. It is the experiment's audience.client.py
Multivariate flagControl and variant, 50/50.client.py
Experiments (REST)Create with a segment audience and a metric, start, then read back and compare.client.py
get_experiment_flag (SDK)Serves the arm and records the exposure.wrapper.py
track_event (SDK)Sends conversions.wrapper.py
Metrics, exposures, results, refresh (REST)The verifier reads them for sample ratio, lift and interval.client.py, verifier.py
Safety gates, each with a test
GateHowTest
No Flagsmith write before approvalcreate and start raise without a matching approvaltest_no_write_without_approval
Approval bound to plan contentApproval stores the plan hash; any edit voids ittest_approval_is_bound_to_plan_content
No terminal, no approvalapprove reads /dev/tty; no env-var bypasstest_cli_approve_refused_without_terminal
Never rollout, complete, deleteThe REST client refuses them; MCP has no such tooltest_forbidden_calls_never_sent
Drift refusalOverlap re-checked at create and start; read-back compares audience, feature, split, statustest_start_refused_when_flagsmith_drifted
Audit trailEvery write, refusal and approval goes to audit.jsonllanes audit

Results All simulated

With overlap, B looks like noise. In its own lane, it shows -46.8%.

Four demos, one make demo run on an empty database (Flagsmith 2.295.2, 29 Nov 2026), saved in make_demo.txt. Traffic is generated, conversions are random, and the effect sizes are ones the demo script chose. The experiments, exposures, events and statistics are real, from Flagsmith.

Interaction demo: measured lift, 95% interval

Simulated truth: B is +40% when A is on and -40% when A is off. 4000 simulated users per run. The dashed line is B's truth with A off.

Lift with 95% interval, overlapped versus in lanes Overlapped: experiment A +46.3% with interval 27.7 to 64.9, confounded. Experiment B -6.5% with interval -18.2 to +5.1, confounded. In lanes: A -11.0% with interval -27.0 to +4.9, inconclusive. B -46.8% with interval -57.8 to -35.9, losing. Simulated truth for B with A off is -40%. -60% -40% -20% 0 +20% +40% +60% +80% Overlapped: both tests on all 1000 lanesIn lanes: A in 0-499, B in 500-999 A, overlapped: +46.3% [+27.7, +64.9] CONFOUNDED B, overlapped: -6.5% [-18.2, +5.1] CONFOUNDED A, own lane: -11.0% [-27.0, +4.9] INCONCLUSIVE truth -40% B, own lane: -46.8% [-57.8, -35.9] LOSING

Overlapped, B's interval includes zero and the truth is far outside it. In its own lane, B's interval contains the truth. Arms are assigned by Flagsmith, so a fresh run gives different numbers within the intervals.

0 of 6

simulated False verdicts in the A/A demo: six experiments with no effect, 6000 simulated users, all six inconclusive.

991 vs 0

simulated Out-of-lane exposures without and with the wrapper (2000 simulated users). Without it: 1480 / 520 split, sample ratio p<0.0001, INVALID. With it: 472 / 519, p=0.14.

+57.3% at 23%

simulated Early demo: interval [+38.6%, +76.0%] at 23% of the planned sample. Verdict EARLY_SIGNAL, not WINNING.

841 = 841

Conversions the wrapper sent equal conversions Flagsmith counted in the early demo, and in every experiment in the saved run.

Late counting. Flagsmith counts new events a few minutes late. Right after the demo shop's 5 purchases, lanes verify --refresh showed "GAP +5". In one repeat the gap was gone about 7 minutes after the purchases (that repeat is not saved in the repository). Run verify again after 5 minutes.

What it does not do

The limits, in the same size type as the claims.

  • No real users, no live deployment.All demo traffic is simulated. There is no demo video, public repository or hosted copy yet.
  • Approval can be bypassed by anyone who owns the terminal.An agent with a full shell as the same user can append to approvals.jsonl, call Agent.approve, or fake a terminal. The gate stops an agent that only has the MCP tools or a pipe.
  • The safety stack is not what is new.Approval cards, audit logs and dry-run exist in other entries of this track. What we did not find elsewhere is traffic planning across experiments and the pollution trap.
  • No LLM, and a keyword guess for direction."Increase churn" is refused and asks for --direction.
  • Terminal required to approve.No terminal (some IDE agents, CI) means no approval. Less convenient than a web card, on purpose.
  • 1000 lanes, static ranges.0.1% granularity, single environment, single metric per experiment. Two teams with two lane books are not coordinated.
  • Statistics are approximations.Sample size is the normal approximation for two proportions. Lift and interval are Flagsmith's.
  • Verdict not held during ingestion lag.Read the verdict once the conversion GAP is 0.
  • Time saved is date arithmetic.Three 14-day tests side by side take 14 days instead of 42. Nobody was timed.
  • Flagsmith Cloud was not tried.Self-hosted 2.295.2 only. Event flushing uses a private SDK attribute.

Run it

Up to twelve minutes, on your machine.

Needs Docker and Python 3.9+. Everything is local. Success looks like the four demos in make_demo.txt, ending in verdict lines and a timeline. Your numbers will differ within the intervals.

$ docker compose up -d
$ make setup      # prints "setup ok"
$ make demo       # 8 to 12 minutes

Port 8201 busy? Check lsof -i :8201, then FS_PORT=8301 docker compose up -d. Stop with docker compose stop. Unit tests: make test (79 tests, Flagsmith mocked, CI runs them on Python 3.11; they do not cover Flagsmith Cloud or a live LLM client).

Run it yourself, step by step

Run one experiment by hand, or use Lanes in your own app

One experiment by hand

$ make bootstrap
$ L=".venv/bin/python -m lanes"
$ $L plan "Test checkout button copy. Baseline 10%,
    expect +30% lift, 800 users a day" --owner me
$ $L approve <plan_id> create --by me
$ $L create <plan_id>
$ $L approve <plan_id> start --by me
$ $L start <plan_id>
$ $L traffic <plan_id> 3000   # simulated
$ $L verify --refresh

In your own app

lc = LaneClient(ENV_KEY, URL, URL.rsplit("/v1", 1)[0],
  {"lane_checkout_copy_5100": LaneRange(0, 317)})
arm = lc.variant("lane_checkout_copy_5100", user_id)
lc.track("lane_checkout_copy_5100",
         "checkout_copy_5100_goal", user_id)

Out-of-lane users get control with no Flagsmith call. If Flagsmith is down, variant() returns control and counts the error.