All Products
Search
Document Center

AgentLoop:Experiment operation guide

Last Updated:Dec 04, 2026

The experiment feature in AgentLoop allows you to use datasets to repeatedly test LLMs or AI Agents. You can verify optimization results, run regression tests, and discover issues through structured experiment plans.

LLM experiments and Agent experiments

Experiments are classified by the object being tested into LLM experiments and Agent experiments.

LLM experiments

LLM experiments test your model services. Common scenarios include:

  1. Model comparison testing — Use the same prompts to test different models, then evaluate output metrics such as hallucination and correctness to select the best model for your specific scenario.

  2. Prompt tuning — For the same set of questions, test models with different prompts and evaluate related metrics to find the optimal prompt.

  3. Model degradation detection — Use a set of challenging questions to periodically test the model service provided by your model service provider and evaluate the correctness of model outputs. A significant drop in related metrics often indicates an issue with the model.

Agent experiments

Agent experiments test your deployed AI Agents. Common scenarios include:

  1. Agent regression testing — After each Agent change, use the same dataset to run a round of regression tests and evaluate whether Agent performance on key metrics (such as accuracy, hallucination, and evidence support) has significantly declined.

  2. Agent tuning verification — After targeted optimization for current bad cases, use those bad cases to run a round of regression tests on the optimized Agent and verify whether Agent performance on key metrics (such as accuracy, hallucination, and evidence support) has improved.

Online experiments and offline experiments

During experiments, HTTP requests are sent to your LLM or Agent service. This involves network isolation issues — your LLM service or Agent service may not be reachable from the AgentLoop server. However, your environment must be able to access the AgentLoop server through the public network or internal network. Therefore, experiments are distinguished into offline experiments and online experiments.

The core difference between offline and online experiments is whether the experiment is initiated from the AgentLoop server or from your own environment. The overall differences are as follows:

Item

Online experiment

Offline experiment

Initiation environment

AgentLoop server

Your local environment

Network requirement

AgentLoop server must be able to reach your service

Your environment must be able to reach the AgentLoop server

Experiment group configuration

Required

Not required

Execution method

Configured and run on the platform

Copy generated code to run locally

Architecture of online and offline experiments

Trace propagation during experiments

When experiments are initiated through HTTP calls, regardless of whether they are online or offline experiments, a traceparent request header that carries traceId information in compliance with the W3C specification is added to the HTTP request headers. For example: traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01.

If your AI Agent has been integrated in accordance with the relevant integration guide in the AgentLoop Integration Center, the traceId of the experiment request and the traceId of the Agent processing request are consistent, and the evaluators configured in the experiment plan can correctly obtain the Agent execution trajectory.

Prerequisites

Before you create an experiment, ensure that the following conditions are met:

  • Your AI Agent has been integrated in accordance with the relevant integration guide in the AgentLoop Integration Center. This is required for evaluators to correctly obtain the Agent execution trajectory.

  • Your environment can access the AgentLoop server through the public network or internal network.

  • For online experiments, the AgentLoop server must be able to reach your LLM or Agent service.

Create an online experiment

(Optional) Step 1: Register a model or Agent service

If you want to test a custom model service or Agent service rather than a built-in model service in AgentLoop, register it first.

Go to System Management > Service Registration to register your model service or Agent service.

If you plan to use a built-in model service in AgentLoop, you can skip this step.

Step 2: Create a dataset

Go to Data Center > Dataset and click Create Dataset. Ensure that the dataset contains at least one data record. If you already have a dataset created through other methods, you can skip this step.

Step 3: Create an online experiment plan

  1. On the Experiment page, click Create Plan.

  2. Enter the plan name and plan description, select Online, and select the dataset to associate with this experiment.

  3. Click Create Plan.

After you click Create Plan, the experiment configuration page appears. This page is divided into three main sections:

Experiment configuration section

This section displays the experiment group configurations. Each experiment configuration contains two phases:

  1. Select the endpoint for this experiment. This can be a built-in model service in AgentLoop, or a model service or Agent service that you registered in the previous steps.

  2. Fill in the prompt template to send to the model, or the HTTP request body template to send to the Agent service. In the template, you can reference dataset column names using double curly braces.

Evaluation metrics section

In the evaluation metrics section, click the configuration button on the right to select zero or more evaluators. After you select evaluators, check the variable mapping section of the evaluators. The following variables are available for configuring variable mappings in evaluators:

Variable

Description

experiment_input

The input of a single experiment run, which is the content of the prompt template or request body template after variable substitution.

experiment_output

The output of a single experiment run, which is the response content from the model or your Agent.

experiment_agent_trajectory

The execution trajectory of your Agent in this experiment. This variable can only be replaced with the actual Agent trajectory during evaluation if your Agent application has been integrated according to the relevant integration guide in the AgentLoop Integration Center.

dataset.xxx

A column in the dataset. Replace xxx with the column name of the dataset.

Dataset display section

The leftmost column displays the current dataset data. After the experiment completes, experiment results are displayed in columns on the right side, with one column for each experiment group.

Step 4: Run the experiment

Click the experiment button in the upper-right corner to start the experiment. After the experiment completes, results are displayed in the dataset display section. Each experiment group shows its results in a separate column alongside the dataset data.

Create an offline experiment

The prerequisite steps for offline experiments are the same as for online experiments. However, on the offline experiment configuration page, you do not need to configure experiment groups. Instead, a Python code snippet for local execution is generated based on the current experiment configuration. You can copy and adjust the code, then run it locally.

To create and run an offline experiment:

  1. Create an experiment plan and select Offline as the experiment type.

  2. Configure the evaluators for your experiment.

  3. Click Get Local Experiment Config in the upper-right corner to open the local execution panel. Check the experiment information shown in the panel.

    Install the experiment SDK in your local environment:

    pip install agentloop-experiment-sdk

    Ensure that the RAM user associated with the AccessKey has the permissions required to run the experiment. Configure the following environment variables. Replace the placeholder values with your AccessKey ID and AccessKey secret.

    export AGENTLOOP_AK="your-access-key-id"
    export AGENTLOOP_SK="your-access-key-secret"

    In the code execution section, select a single-turn or multi-turn experiment. Then select one of the following three execution methods based on how you want to initiate the experiment locally:

    • Initiate the experiment through an HTTP request.

    • Initiate the experiment by executing a bash command.

    • Other cases where you fully customize how the experiment is executed and what content it returns.

  4. Copy the code for the selected execution method, adjust it as instructed in the panel, and run it in your local environment. For HTTP execution, replace the url, headers, body_builder, and timeout parameters in the http_solution_with function call with your actual configuration.

For more information about reporting offline experiment results, see Report offline experiment results.

View experiment results

Regardless of whether it is an offline or online experiment, after each experiment run completes, an experiment record appears on the Experiment Records page.

On the Experiment Records page, select two experiment records (typically two records from the same experiment plan) and click Compare. You can view the response result differences and scoring differences for each data entry between the two experiment runs.