Skip to main content
Test Runs in Freeplay provide a structured way for you to run batch tests of your LLM prompts and chains. All methods associated with the Test Runs concept in Freeplay are accessible via the client.test_runs namespace. Test runs can be completed using Completion or Trace datasets. We will focus on code in this section, but for more detail on the Test Runs concept see Test Runs.

Methods Overview

The testlist parameter accepts the name of a dataset stored in Freeplay. This parameter name is preserved for backwards compatibility. In the UI and documentation, we use “dataset” to refer to this concept.

Step by Step Usage

Create a new Test Run

Retrieve your Prompts

Retrieve the prompts needed for your Test Run

Iterate over each Test Case

For the code you want to test: loop over each test case from the dataset, make an LLM call, and record the results with a link to your test run.

Agent Test Runs

To execute tests in code, iterate through each test case in your dataset and run it through your full agent workflow. This end-to-end testing approach is particularly valuable for agentic systems, where the goal is to observe how changes—whether to prompts, tools, or orchestration logic—affect the final output. Trace-level tests allow you to simulate production-like behavior and evaluate the agent holistically. As each test case runs, its input is passed into your system, and the resulting trace is logged for evaluation and analysis. See the full example here. Below is an psuedo code example to show the general logic for test-runs: