keepcalculator

06 Numbers and Powers

AI Agent Traces: Build Reliable Evaluation Datasets

Card No. 06·56901 · Updated · Standard formula, shown below

Turning AI agent traces into evaluation datasets helps you measure whether an agent completes real tasks, uses tools appropriately, and recovers from problems—not just whether its final answer sounds plausible. Start with representative, privacy-reviewed traces and a clear definition of success; the steps below turn them into labeled, reproducible test cases.

What You’ll Need

  • Agent traces that record the task, relevant inputs, assistant messages, tool calls and results, and final outcome. Include timestamps or event order where available.
  • A written task definition and criteria for success, including important safety or policy constraints.
  • A secure place to inspect and store traces, plus a dataset format such as JSONL or a table with one record per example.
  • People with enough domain knowledge to review labels, resolve ambiguous cases, and approve sensitive data handling.
  • A way to run the agent version being evaluated against a fixed set of cases and save results.

Step-by-Step

  1. Define what the evaluation should answer. Choose a narrow objective, such as whether an agent books the correct appointment, retrieves a specified fact, or asks for clarification when required information is missing. State what counts as success, partial success, and failure. Separate task completion from process requirements: an agent may reach the right answer while using an unauthorized tool or exposing private information.
  2. Set the unit of evaluation. Decide whether one example is a user request, a whole conversation, or a multi-turn task with tool use. For agent behavior, preserve the complete relevant sequence: user input, assistant reasoning or visible messages as permitted, tool name and arguments, tool response, and final response. Do not treat each tool call as an independent task unless that is the behavior you intend to measure.
  3. Export and normalize traces. Convert different logging formats to a consistent schema. Give each trace a stable identifier and retain event order. Represent tool calls and results as structured fields rather than flattening everything into prose. Record the agent, model, tool, and prompt versions when available; these help explain changes later. Keep missing values explicitly marked rather than silently filling them in.
  4. Review privacy, consent, and permissions. Remove or replace personal and confidential details before labeling or sharing. Check that the trace may be used for evaluation under your organization’s policies and applicable agreements. Redaction must cover tool outputs, pasted documents, logs, and metadata—not only the user’s first message. Restrict access to raw traces and keep a documented link between a sanitized record and its source only when necessary.
  5. Filter and sample deliberately. Remove corrupted, duplicate, irrelevant, or incomplete traces, while keeping a count and reason for each exclusion. Sample across task types, difficulty, tools, user phrasing, and important failure modes. Include successful and unsuccessful runs, but do not let frequent easy tasks dominate. For rare but important cases, create a separate, clearly identified challenge set rather than implying it reflects normal traffic.
  6. Turn each selected trace into a test case. Write a concise task statement and provide only the context the agent should receive at evaluation time. Preserve necessary tool fixtures or mock responses so the case can be replayed consistently. Do not include the original agent’s answer or hidden trace details in the prompt if those would give away the expected result.
  7. Define labels and scoring rules. Use observable criteria: required facts, allowed actions, prohibited actions, or a clearly specified end state. For example, score task completion separately from correct tool selection and policy compliance. Prefer a rubric with concrete pass, partial, and fail conditions over vague labels such as “good.” Record the evidence supporting each judgment, such as the relevant tool event or final response.
  8. Label with review and adjudication. Have two reviewers independently label a meaningful subset, especially ambiguous or high-impact cases. Compare disagreements, clarify the rubric, and have a designated reviewer resolve remaining disputes. Track agreement and disagreement reasons. If reviewers cannot determine the expected outcome from the available trace, mark the case ambiguous or exclude it; do not manufacture certainty.
  9. Split the data without leakage. Create development and held-out evaluation sets before tuning prompts or policies against the cases. Keep near-duplicate requests, related conversation turns, and traces from the same underlying task or source in one split. Otherwise, memorized wording or shared context can make results look stronger than generalization warrants. Keep the held-out set access-controlled where practical.
  10. Validate and version the dataset. Check required fields, label ranges, tool schemas, event ordering, duplicate IDs, and replayability. Manually inspect a sample from every task category. Save the schema, rubric, sampling method, exclusions, dataset version, and source-agent details alongside the records. When changing labels or cases, create a new version rather than silently overwriting the old one.
  11. Run the evaluation and inspect failures. Use fixed agent settings and tool behavior where possible, then report results by task type and criterion—not just one overall score. Review failures for patterns such as missing context, tool errors, unclear labels, or genuine agent mistakes. Update the dataset only with a documented reason, and preserve a stable benchmark version for comparisons over time.

Common Mistakes

Scoring only the final answer: This misses unsafe tool use, fabricated tool results, and successful outcomes reached by an invalid route. Score the process when it matters to the task.

Leaking answers into test prompts: Trace context may contain the original outcome or evaluator notes. Separate evaluation-time inputs from reference answers and internal annotations.

Using vague or inconsistent labels: “Helpful” can mean different things to different reviewers. Define observable criteria and provide examples of borderline cases.

Randomly splitting related traces: Similar tasks in both train and test sets can inflate scores. Group related examples before splitting.

Over-cleaning the data: Removing every messy or failed trace makes the dataset unlike real use. Remove unusable records, but retain realistic variation and document exclusions.

Tips

  • Keep raw traces immutable; make sanitized and labeled copies so corrections remain auditable.
  • Include a small set of hand-checked “gold” cases to catch evaluator or pipeline changes.
  • Use deterministic mock tools for repeatable tests, and separately evaluate behavior with live tools if that is part of the real deployment.
  • Track label provenance: who labeled a case, which rubric version they used, and whether it was adjudicated.
  • Report sample sizes and uncertainty. A small dataset may reveal useful failures but cannot support precise claims about broad performance.

Troubleshooting

Results vary between runs: Check model settings, tool data, time-dependent services, and ordering. Fix random seeds where supported, mock unstable dependencies, and report remaining sources of variation.

Reviewers disagree often: Inspect disagreement examples, tighten the rubric, and add examples for edge cases. Relabel affected records after the rubric changes; do not compare old and new labels as if they were consistent.

Many traces cannot be replayed: Logs may omit tool responses, state, or relevant context. Mark these records as non-replayable, use them only for a clearly defined offline review, or collect better traces. Do not invent missing events.

Scores improve suspiciously fast: Look for duplicate tasks across splits, reference answers in prompts, or repeated tuning on the held-out set. Rebuild the split by source or task group and reserve a fresh test set.

Privacy review finds exposed data: Stop distribution of the affected dataset, restrict access, and follow your organization’s incident and data-handling process. Redact the source and derived copies before resuming use.

Frequently Asked Questions

What should an agent trace contain?
At minimum, the task input, ordered assistant and tool events, tool results, and final outcome. Include version and context metadata when available and permitted.

Do all traces need human labels?
No. Clear, machine-verifiable outcomes can be scored automatically. Use human review for ambiguous judgments, nuanced quality, and validation of automated scoring.

How large should the dataset be?
There is no universal minimum. Begin with enough cases to cover the task categories and failure modes you care about, then add examples where results are uncertain or coverage is weak.

Should failed agent runs be included?
Yes, when the trace is valid and represents a relevant task. Failures help test recovery and expose weaknesses; label what failed rather than treating every failure as the same kind.

Can an AI model label the traces?
A model can assist with draft labels or routine checks, but validate it against human-reviewed examples. Keep the rubric explicit and review uncertain or consequential labels.

When should I update the evaluation set?
Add cases when tasks, tools, or failure patterns change, but version every update. Preserve a stable set for trend comparisons and use a separate current set for newly observed behavior.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →