New Tool Radar

AI Agents & Automation

How to A/B Test Two Agent System Prompts on the Same Tasks

A/B test two agent system prompts on the same tasks so the better prompt is chosen on evidence.

Schematic with three steps: Fix the tasks and the rubric before; Run both prompts on every task; Keep the prompt that scores higher, and.

Two system prompts can feel equally good until you test them on the same tasks. An A/B test is that test: run both prompts against the same set of tasks, score both against the same rubric, and keep the one that scores higher. LangSmith evaluation is built for this shape of work, scoring agent outputs against datasets and criteria so you can benchmark versions and catch regressions. The rules that make the test fair are simple: same tasks, same rubric, same scorer, and enough tasks that one lucky answer cannot decide it.

What you need

  • Two system prompts to compare, differing in one clear way
  • A set of test tasks with known good outcomes, at least ten
  • A scoring rubric both prompts are judged against, written before the test

Step 1: Fix the tasks and the rubric before running anything

Write the test tasks and the rubric first, and freeze them for the whole test. Changing the tasks halfway through makes the comparison meaningless.

Step 2: Run both prompts on every task

Run prompt A and prompt B on the same tasks, in the same order, with the same tools and the same model. A task run under different conditions is not a comparison.

Step 3: Keep the prompt that scores higher, and record why

Score both runs against the rubric and keep the higher scorer. Write down the score gap and the tasks where the winner won, so the next change starts from evidence.

Worked example: synthetic prompt A/B test

The table below is a synthetic example. It shows the expected result of the A/B test; no agent was run.

Task Prompt A score Prompt B score
Refund question 4 5
Order status 5 5
Price comparison 3 5
Prompt B wins overall 12 15

Expected result (UNTESTED). prompt B scores 15 against prompt A’s 12 on the same tasks and rubric, so prompt B is kept. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A test on too few tasks can be decided by luck; use at least ten tasks.
  • The rubric decides the winner, so a biased rubric picks a biased winner.
  • A prompt that wins on the test set may lose on real traffic, so re-check after shipping.
  • Only change one thing between prompts, or you will not know what caused the win.

Sources

See all