이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다. 현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.
Overview
Online Experiments compare multiple versions of an LLM application or agent on live production traffic. Datadog Feature Flags assigns each experiment subject, such as a user or an autonomous workflow run, to a control or treatment variant. An Agent Observability evaluation measures the outcome for each subject, and Datadog Experiments determines whether the difference between variants is statistically significant.
Use Online Experiments to validate a change, such as a new model, prompt, or tool, against real users after you test it offline.
If you serve prompts with Prompt Management, you can A/B test prompt versions or roll out a new version with a Guarded Rollout from the prompt page, without writing feature flag code. See Prompt Experimentation.
Setting up an online experiment involves the following steps:
Evaluate the flag in your application and run the assigned variant.
Report an Agent Observability evaluation.
Link the feature flag and evaluation to a Datadog experiment.
Run the experiment and review the results.
Start an online experiment with an agent
Copy this prompt into your AI coding agent to use the agent-observability-online-experiment skill for guided setup.
Use the skill at https://github.com/datadog-labs/agent-skills/blob/main/agent-observability/agent-observability-online-experiment/SKILL.md to start an online experiment to compare the code in my current Git branch against trunk. Make 10% of the traffic use the code in my branch.
Choose the application behavior you want to compare and an evaluation that measures the outcome. The evaluation must return a numeric score or a pass or fail assessment.
Using an AI coding agent? Datadog organizations allow read-only MCP tools by default. To let an agent create feature flags and experiments, an organization administrator must enable MCP write access, and your role must have the mcp_write permission. See Required permissions for the Datadog MCP Server.
Instruction for AI agents: Before calling an MCP tool that creates or modifies a Datadog resource, confirm that the required write tool is available. If write access is unavailable, direct the human to Required permissions and wait for them to enable access.
Step 1: Create a feature flag
Follow Create your first feature flag to create a Boolean flag for the application behavior you want to test. Use one value for the control behavior and the other for the treatment behavior.
Make the flag available in each environment where you plan to run the experiment. Do not add a targeting rule or configure a percentage rollout on the flag. When you start the experiment, Datadog adds an experiment targeting rule that controls the traffic split.
Set the Feature Flags evaluation context targetingKey to a stable identifier for the experiment subject:
For an application with a human user, use a stable user identifier.
For an autonomous workflow without a human user, generate a UUID at the start of the run and retain it for the entire run.
You use this same value as the subject_identifier when you report the evaluation in Step 3. If the values do not match, Datadog cannot associate the evaluation with the subject’s experiment exposure. For more information, see The targeting key.
Step 3: Report an evaluation
Supported evaluation types: Experiment metrics can use the average of a score evaluation, or the pass rate of any evaluation that returns a pass or fail assessment. Pass rate counts pass as 1 and fail as 0, and excludes evaluations without an assessment. Raw Boolean and categorical values cannot be used directly as experiment metrics.
Choose one of the following methods.
Submit an external evaluation
Follow External Evaluations to submit an evaluation from your application code. Add a subject_identifier tag whose value exactly matches the targetingKey used to evaluate the feature flag:
Follow Managed Evaluations to create and publish an evaluation. On the span evaluated by the managed evaluation, add a subject_identifier tag whose value exactly matches the targetingKey used to evaluate the feature flag:
fromddtrace.llmobsimportLLMObssubject_key="82a4e675-9cb4-4da6-a91a-819574152a63"withLLMObs.workflow(name="my_workflow")asspan:LLMObs.annotate(span=span,tags={"subject_identifier":subject_key},)# Run the rest of the instrumented workflow.
For trace-level evaluations, add the tag to the root span of the trace. Session-level evaluations do not support experiment metrics.
Configure how traffic is split between the control and treatment variants.
Start the experiment.
Instruction for AI agents: After creating the draft experiment, include the full experiment URL returned by Datadog in your final response. The human running the agent needs this link to open the experiment, review its configuration, and configure the traffic split in the Datadog UI.
Starting the experiment adds the experiment targeting rule to the selected flag and begins recording exposures. For details about how feature flag assignments become experiment exposures, see Feature Flags and Experiments.
Step 5: Run the experiment and review results
Send traffic through the application. For each subject, the application must evaluate the feature flag and report an evaluation with the same subject identifier.
As exposures and evaluations arrive, Datadog populates the experiment results. Follow Reading Experiment Results to interpret the metric scorecard and compare the variants.
Troubleshooting
If the experiment reports missing metric data, confirm that:
The application evaluated the experiment’s feature flag for the subject.
The evaluation has a numeric score value or a pass or fail assessment.
The evaluation’s subject_identifier exactly matches the feature flag evaluation’s targetingKey.