Skip to main content
There are two ways to run experiments in your CI/CD pipeline:
  1. Platform Experiments - Configure the experiment in LangWatch, then trigger it from CI/CD with a single line
  2. Experiments via SDK - Define the entire experiment in code and run it in CI/CD
Choose based on your needs:

Option 1: Platform Experiments

Configure your experiment once in the LangWatch Experiments via UI, then trigger it from CI/CD.

Setup

  1. Create your experiment in the Experiments via UI
    • Add your dataset
    • Configure targets (prompts, models, or API endpoints)
    • Select evaluators
    • Run it once to verify it works
  2. Get your experiment slug from the URL:
    Or open the Run Options menu in the experiment toolbar and choose Run in CI/CD for ready-to-copy snippets.
  3. Run from CI/CD:
That’s it! The experiment runs with the configuration saved in LangWatch.

GitHub Actions Example

Options

Reading per-row results

run(...) waits for the run to finish and gives you the per-row results, so you can assert on them in CI or inspect them locally:

Choosing what to evaluate

By default the run uses the dataset attached to the experiment. You can override the data from CI without changing the platform configuration:
  • parameters — constant inputs merged into every row (and the single row when there is no dataset), handy for a feature flag or a model name
  • data — inline rows to evaluate
  • dataset_id — a different platform dataset by id (data and dataset_id are mutually exclusive)
  • row_indices — a subset of dataset row indices to evaluate, instead of the whole dataset

Option 2: Experiments via SDK

Define your entire experiment in code. This gives you full control and version control over your experiment configuration.

Basic Example

GitHub Actions Example

Where scripts/run_evaluation.py contains your full experiment code.

Comparing Multiple Configurations

SDK experiments shine when comparing different configurations:

Results Summary

Both approaches output a CI-friendly summary:
The print_summary() method:
  • Outputs results in a structured format
  • Returns exit code 1 if any evaluations failed (unless exit_on_failure=False)
  • Provides a link to view detailed results in LangWatch

CI Platform Examples

GitLab CI

CircleCI


Error Handling


REST API (Platform Experiments)

For custom integrations, you can use the REST API directly:

Start a Run

Response:

Poll for Status

Response (completed):

Fetch Results

Returns the per-row dataset entries (input, output, trace id, duration) and evaluation scores for the run.

Next Steps

Experiments via UI

Create experiments in the platform UI

Experiments via SDK

Full guide to SDK experiments

Evaluators

Browse available evaluators

Datasets

Manage your test datasets