Prerequisites
To complete this guide, you need the following:- A LaunchDarkly account.
- LaunchDarkly installed and initialized in your application. To learn more, read SDK overview.
- A feature or agent behavior you want to optimize.
Define success metrics before the experiment runsBefore you run an experiment, take the time to determine which metrics will indicate success. Changing metrics mid-experiment will invalidate the results.
How continuous experimentation works
The pattern is the same for code and for AgentControl configs: create variations, expose them to real users, measure what wins, promote it, and repeat. This table shows where each product applies:| Path | What you experiment on |
|---|---|
| CodeControl | Feature behavior, UI variations, application logic |
| AgentControl | Prompts, model selection, agent parameters |
Step 1: Create variations and define success metrics
For code with CodeControl, create a multivariate feature flag with a variation for each option you want to test. Define the metrics that constitute a win, such as conversion rate, error rate, engagement, latency, or any business metric you can measure. To learn more, read Creating new flags Here is an example of evaluating a multivariate flag:Step 2: Expose variations to production traffic
Use LaunchDarkly’s Experimentation feature to split traffic across your variations. LaunchDarkly handles assigning traffic to variations, so each user or context consistently receives the same variation. The experiment tracks results for each variation against your defined metrics. Start with enough traffic to reach statistical significance in a reasonable timeframe. If you want to run many experiments at the same time, prioritize the ones tied to your highest-impact metrics.Step 3: Measure and promote the winner
As results accumulate, performance information appears for each variation. When a variation’s results reach reach statistical significance, do the following:- Promote the winner by updating the flag or AgentControl config to serve the winning variation to 100% of traffic.
- Confirm the change takes effect immediately. No redeploy is required.
- Archive the losing variations to keep your flag and config inventory clean.
Step 4: Keep the loop running
Promotion isn’t the end of the experiment. It’s the start of the next one. After you promote a winner:- Generate new variations against the new baseline established by your previous results.
- Run the next experiment on the highest-impact question, which may have changed based on previous experiment results.
- Let production data, not assumptions, drive each decision.
Next steps
To continue, explore the following topics:- Experimentation to configure traffic splits, metrics, and statistical analysis.
- AgentControl to manage prompt and model variations for agent experiments.
- Metrics to measure business and system impact for each variation.
- Guarded releases to add safety guardrails to experiments in high-risk areas.