Skip to main content
The main entity that you are evaluating in an eval is represented by a runner. The runner is any callable that takes an input and returns a final value. Any harness works if it follows the instructions set in Building an eval and Runner.

Set your API keys

Every eval needs your PromptLayer key plus whatever provider your agent already uses. Export them once in your shell — both the AI and manual paths below assume these are set:

Set up with AI

Paste this prompt into Cursor (or any coding agent) in the repo that has your agent. It scaffolds an eval for you to review and run.

Scaffold a PromptLayer SDK eval from this codebase

Open in Cursor

After the agent finishes

With your keys set, review the generated evals/ file, then run it:

Write an eval yourself

Pick the tab that matches your stack. If you use a framework helper (OpenAI Agents, Claude, Vercel AI), tool spans are collected for you. For a custom agent with no helper, see Runner.
Call instrument_openai_agents / instrumentOpenAIAgents once at the top of your file, then run your Agent from the eval runner. Tool spans are collected automatically — no traceTool needed. The same helper works outside evals via the OpenAI Agents SDK integration.

Run it

Point promptlayer eval run at a directory (runs every *.eval.* file) or a single file:

What you get

The CLI prints progress, per-scorer results, and a dashboard URL:
Each run also writes a Table experiment sheet with Input, Output, and (when you score traces) a Trace group with price and latency. The score panel shows each scorer — here Trajectory on Trace and Contains on Output — plus the overall pass rate.
weather-agent-eval experiment sheet showing Input, Output, Trace, and 100% pass for Trajectory and Contains

Next

Building an eval

Anatomy of evaluate(...) — dataset, runner, scorers, and options.

Datasets

Inline cases or a dashboard Table as the dataset.

Runner

Runner contract, Tool: spans, and traceTool.

Scorers

Typed helpers: Trajectory, Contains, Compare, and more.

CLI and CI

Run files locally and fail CI on a pass bar.