How to Evaluate Libraries for AI Agents: transformers as a Case Study, and Traces Instead of Answers
An AI agent can return the right answer and still reach it by the most expensive route: reading unnecessary code, guessing at APIs, crashing 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, this piece walks through how to build an evaluation harness that analyzes an agent's traces, tokens, time and errors.
AI-processed from Habr AI; edited by Hamidun News
Developers of libraries for AI agents face a problem: blindly checking an agent's final answer does not show how efficiently it got there. An agent can return the correct string and still take the most expensive route to it, reading unnecessary code, guessing API signatures, failing on errors and rebuilding the solution from zero.
Why a correct answer is not enough
For a library developer, an agent's flawed path is no longer a cosmetic issue but a signal of a new layer of quality in the tool itself. If an agent regularly spends extra steps guessing at APIs or reading code it does not need, that points to documentation, function signatures or library structure that are not clear enough for agent use, even when the end result is formally correct.
- The walkthrough is built on the transformers library
- Not only the final answer is evaluated, but the agent's path to it
- Key metrics: call traces, token consumption, execution time, errors
- Behavioral markers are recorded separately, for example repeated API guessing
What the evaluation harness includes
The evaluation harness, built using transformers as the example, collects full traces of the agent's work: which tool calls it made, how many tokens it spent, how long the solution took and which errors occurred along the way. Behavioral markers are tracked separately: repeating patterns showing that the agent is unsure about the API and works by trial and error instead of applying the right tool immediately.
What this means
As libraries and SDKs are increasingly used not directly by people but by AI agents, tool quality starts to be measured not only by how correct the documentation is for a human, but by how predictably and cheaply an agent can work with it. Evaluation based on traces and behavioral markers is becoming the new standard for developers who want their library to be convenient for agents in particular.
- Nov 2, 2026Karpathy builds a YouTube clone with 6454 videos from Hacker News recommendations in two hours
- Nov 2, 2026Karpathy used Claude to build HackerTube from 6,454 videos recommended on Hacker News
- Nov 2, 2026Arca gives AI agents finance tasks lasting up to 10 days, but leaves the trades to humans
- Nov 2, 2026DeepSeek open-sources Super-agent prototype: p95 task completion time of 15.7 minutes vs. 29.5
Key Questions Answered
Why a correct answer is not enough?
For a library developer, an agent's flawed path is no longer a cosmetic issue but a signal of a new layer of quality in the tool itself. If an agent regularly spends extra steps guessing at APIs or reading code it does not need, that points to documentation, function signatures or library structure that are not clear enough for agent use, even when the end result is formally correct. The walkthrough is built on the transformers library Not only the final answer is evaluated, but the agent's path to it Key metrics: call traces, token consumption, execution time, errors Behav
What the evaluation harness includes?
The evaluation harness, built using transformers as the example, collects full traces of the agent's work: which tool calls it made, how many tokens it spent, how long the solution took and which errors occurred along the way. Behavioral markers are tracked separately: repeating patterns showing that the agent is unsure about the API and works by trial and error instead of applying the right tool immediately.
What this means?
As libraries and SDKs are increasingly used not directly by people but by AI agents, tool quality starts to be measured not only by how correct the documentation is for a human, but by how predictably and cheaply an agent can work with it. Evaluation based on traces and behavioral markers is becoming the new standard for developers who want their library to be convenient for agents in particular.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.