Skip to main content

What is A/B Testing?

A/B testing lets you route a percentage of live traffic to a test version while the rest continues to the current live version. Both versions produce execution logs, so you can compare their performance with real data before fully switching.

Prerequisites

Before starting an A/B test, you need:
  • A policy group with a currently deployed (live) version
  • A test version that has been published (ACTIVE status)
  • Both versions must belong to the same policy group

Traffic Identity Key

A/B routing splits traffic by a single value your application sends with each execution request: contexts.trafficKey. The same key value always lands on the same version for that group. Send it in contexts, not in facts. Routing reads the contexts object only. A trafficKey placed in facts is ignored. The field used to be context, and a request that still sends context fails with 400 (C-001), even when it is empty.
If trafficKey is missing or empty, no split happens and the test version receives 0% of traffic. The test still shows as running in the console and execution logs keep accumulating, so nothing about the response reveals the problem. Choosing a value:
  • Stable per experiment unit. A customer ID, a merchant ID, a session ID, whatever you want the experiment measured on
  • Opaque. The whole contexts object is stored in the execution ledger, so send a hash or a surrogate key rather than an email address or a phone number
  • Never a value that changes every request. A request ID or a timestamp scatters one user across both versions and destroys the comparison
Bucketing is per group: the same trafficKey value gets an independent assignment in every policy group, so one experiment never skews another.

Where the key goes

GET /execution/groups/{groupId}/requirements returns an exampleRequest whose contexts does not include trafficKey. Copying that template as-is leaves an A/B test at 0%.

Starting an A/B Test

Console

Navigate to the policy group → click Start A/B Test → select the test version → set the traffic percentage.

CLI

The --traffic-rate is the percentage (1–99) of traffic routed to the test version. The remaining traffic stays on the live version.

Monitoring Results

To compare the two versions, list each version’s executions:
Each row shows the trace ID, the execution status, whether any rule matched, and the latency. For a rule-by-rule view of one execution, pass its trace ID to lexq history get --id <traceId>. lexq history stats --group-id <groupId> reports both versions combined.

Adjusting Traffic

Gradually increase the test version’s traffic as you gain confidence:

Stopping an A/B Test

Stopping reverts all traffic to the live version. The test version remains ACTIVE but no longer receives traffic.

Typical Workflow

A/B tests affect production traffic. Start with a low traffic percentage (5–10%) and monitor closely before scaling up.

Next Steps

Impact Simulation

Test against historical data before running an A/B test.

Deployments

Deploy the winning version to production.