How to evaluate AI agent libraries: the example of transformers and traces over answers

An AI agent can return the correct answer but get there via the most expensive route: reading unnecessary code, guessing APIs, failing on errors and rebuilding the solution from scratch. For library developers, this is no longer a minor detail but a separate layer of tool quality. Using the transformers library as an example, we examine how to set up an evaluation bench that analyzes agent traces, tokens, time and errors.

AI-processed from Habr AI; edited by Hamidun News
How to evaluate AI agent libraries: the example of transformers and traces over answers
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1The example analysis is built on the transformers library
Key metric #2Not only the final answer is evaluated, but also the path the agent took to reach it
Key metricscall traces, token consumption, execution time, errors

Developers of libraries for AI agents face a problem: blind checking of the final agent response does not show how efficiently the agent arrived at that response. An agent can return a correct string and at the same time take the most expensive route to it — read unnecessary code, guess API signatures, fail on errors, and reassemble the solution from scratch.

Why One Correct Answer Is Not Enough

For a library developer, an incorrect path by an agent is already not a cosmetic problem, but a signal about a new layer of quality of the tool itself. If an agent regularly spends extra steps guessing the API or reading unnecessary code, it indicates that the documentation, function signatures, or library structure are not clear enough for agent use — even if the end result is formally correct.

  • The example analysis is built on the transformers library
  • Not only the final answer is evaluated, but also the path the agent took to reach it
  • Key metrics: call traces, token consumption, execution time, errors
  • Behavioral markers are separately recorded — for example, repeated API guessing

What Is Included in the Evaluation Stand

The evaluation stand built on the transformers example collects complete traces of agent work: what tool calls it made, how many tokens it spent, how long the solution took, and what errors occurred along the way. Behavioral markers are separately accounted for — repeating patterns that indicate the agent is unsure about the API and acts by trial and error instead of immediately applying the required tool.

What This Means

As libraries and SDKs are increasingly used not by humans directly, but by AI agents, the quality of the tool begins to be measured not only by the correctness of documentation for humans, but also by how predictably and cheaply the agent is capable of working with it. Evaluation by traces and behavioral markers becomes a new standard for developers who want their library to be convenient to use specifically by agents.

Story

Key Questions Answered

Why One Correct Answer Is Not Enough?

For a library developer, an incorrect path by an agent is already not a cosmetic problem, but a signal about a new layer of quality of the tool itself. If an agent regularly spends extra steps guessing the API or reading unnecessary code, it indicates that the documentation, function signatures, or library structure are not clear enough for agent use — even if the end result is formally correct. The example analysis is built on the transformers library Not only the final answer is evaluated, but also the path the agent took to reach it Key metrics: call traces, token consum

What Is Included in the Evaluation Stand?

The evaluation stand built on the transformers example collects complete traces of agent work: what tool calls it made, how many tokens it spent, how long the solution took, and what errors occurred along the way. Behavioral markers are separately accounted for — repeating patterns that indicate the agent is unsure about the API and acts by trial and error instead of immediately applying the required tool.

What This Means?

As libraries and SDKs are increasingly used not by humans directly, but by AI agents, the quality of the tool begins to be measured not only by the correctness of documentation for humans, but also by how predictably and cheaply the agent is capable of working with it. Evaluation by traces and behavioral markers becomes a new standard for developers who want their library to be convenient to use specifically by agents.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Hands-On AI Engineering · Hamidun Academy

Build & Ship Production AI Agents Without Boilerplate Code

Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.

Start 72h Free Trial →Vibe-Coding Intensive
What do you think?
Loading comments…