Skip to main content
In addition to being able to evaluate your agent via our dashboard, you can create an evaluation directly in code with our SDK. Each eval has four parts:
  • Dataset — user messages (and optional expected output / expected tool trajectory)
  • Runner — your agent harness (OpenAI Agents, Claude, LangChain, or any callable that takes input and returns a final value)
  • Columns - optional steps to manipulate your dataset or agent trace
  • Scorers — scorecard checks such as Trajectory and Contains

Why use SDK evals

Use SDK evals when your agent needs to run on your own infrastructure. For example when you need access to internal data, actual tool execution code, and custom harnesses. This also makes evals a natural fit for CI/CD: run promptlayer eval run in your pipeline to catch trajectory or output regressions before they ship, while every result still lands on a PromptLayer Table for you to inspect.

How a run works

Using our evaluate method, wire your dataset, runner, and scorers together in one file, then kick it off with promptlayer eval run <path>. Each case runs under its own Eval: <name> span, and results stream to a Table sheet on our dashboard for comparison. The OpenAI Agents example below instruments the harness, uses the agent as the runner, and scores both tool trajectory and final output. See the Quickstart for the same pattern across Claude, Vercel AI, LangChain, and other stacks.

Where to go next

Quickstart

Scaffold with AI, or copy an example for a common agent stack.

Building an eval

Dataset, runner, scorers, and the rest of evaluate(...).

Scorers

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

CLI and CI

Run files locally and fail CI on a pass bar.