@arizeai/phoenix-evals
Don’t have traces yet? Let your coding agent set up tracing for you: start Phoenix, then run
npx -y @arizeai/phoenix-cli setup from your app’s root directory. See Agent-Assisted Setup.Why Should I Use Evaluators?
Simply running an application or agent tells you what it does. Evaluations reveal how well it performs, why it succeeds or fails, and where it needs improvement. Ad-hoc runs make it hard to measure progress or compare changes over time. Evaluations add structure and repeatability: they let you test the agent across a controlled datasets and surface hidden failure patterns that casual testing would miss. With evaluations, you can make informed decisions about improving your agent, verify that updates help without introducing regressions elsewhere, and build confidence in its performance before deployment.If you’d like to follow along with this evaluation example, you can check out the application here: https://github.com/Arize-ai/phoenix/tree/main/js/examples/apps/demo-document-relevancy-experiment
1
Set up and Connect to Phoenix
Before running your experiment and evaluations, make sure Phoenix is running and your environment is set up with the required dependencies.No uv? Phoenix serves its UI and OTLP HTTP on port 6006, and OTLP gRPC on port 4317. For a local instance that’s http://localhost:6006 — leave it running while you work.Then install the dependencies this guide uses into your TypeScript project:Include these in your
- Local
- Container
- Self-Host
pip install arize-phoenix && phoenix serve does the same thing. See Terminal setup for customization..env file. PHOENIX_ENDPOINT is what @arizeai/phoenix-client reads for datasets and experiments; PHOENIX_COLLECTOR_ENDPOINT is what @arizeai/phoenix-otel reads when exporting spans — point both at the same Phoenix instance.2
Define a Task
Simply put, the task defines how your application should behave. The task specifies exactly which input fields to pass in and how the application should process that input. By standardizing execution across examples, tasks ensure that evaluations are consistent, repeatable, and comparable as your application evolves.This example assumes the
task function is calling the spaceKnowledgeApplication that retrieves context from a knowledge base to answer questions:3
Define a Dataset
A meaningful evaluation starts with a well-constructed dataset. This dataset should contain a diverse set of examples that capture both typical success cases and realistic failure modes.Each row in your dataset represents a single scenario the application or agent will encounter, including the input and, when applicable, the expected output. The goal is to build a small but representative slice of the real world your application is meant to handle. A thoughtfully designed dataset ensures that the evaluation results are meaningful and aligned with the application’s capabilities.
4
Create an Evaluator
Once a task and dataset are defined, the final piece of the experimentation workflow is the evaluator.Evaluators determine whether the task output for each example is “good,” “bad,” or somewhere in between. You can use Phoenix pre-built evaluators or define custom evaluators that give you full control over the metrics and logic used to judge application behavior. The evaluator you choose should align with the specific quality or capability you want to measure.In this example, we’ll use Phoenix’s pre-built Retrieval Relevance evaluator. This evaluator checks whether retrieved context actually contains the information needed to answer the user’s question—ensuring your application is grounding its responses in the right documents.
5
Run the Experiment
An experiment ties the dataset, task, and evaluator together into an end-to-end process.When you run an experiment, each dataset example is passed through the task, generating outputs that are then automatically scored by the evaluator. Experiments provide a structured, repeatable framework for testing the application’s performance and collecting metrics at scale. Running the experiment produces a full set of scores, explanations, and traces for analysis.
6
View Results in Phoenix
After the experiment completes, the results provide a detailed breakdown of how the application performed across all examples. You can quickly identify success cases, pinpoint failure modes, and analyze patterns across the dataset.For LLM-as-a-Judge evaluators, the explanation field is especially valuable—it highlights why the evaluator scored a response a certain way. These explanations often reveal actionable insights, such as missing reasoning steps, misinterpretations, or opportunities to refine prompts. By reviewing these results holistically, you can iteratively improve your application and build confidence in its performance.

