Can Agents Design Libraries for Agents?

Gabriel Orlanski, Alex L. Zhang, Avi Trost, Vincent Sunn Chen, Frederic Sala, Aws Albarghouthi, Ludwig SchmidtarXiv 2026

TL;DR

Researchers have introduced LibraryDesignBench, the first benchmark to evaluate whether AI agents can design software libraries that other agents can actually use effectively. The study finds that while top-tier models like Claude 3.5 Opus can design libraries that rival or even surpass human-written production code in specific tasks, downstream agents often struggle with "rigid" interfaces and frequently reimplement features the library already provides.

What Problem Does This Paper Address?

As AI agents become more prevalent in software engineering, we are reaching a point where agents will spend more time interacting with code written by other agents than by humans. Currently, agents tend to reimplement logic from scratch rather than reusing existing abstractions, leading to bloated and fragile codebases.

The challenge is that evaluating a library is much harder than evaluating a single script. Standard tests only check for correctness, not usability. A library might be technically "correct" but have such a convoluted API that a downstream agent gives up and writes its own helper functions instead. This paper seeks to quantify "agent-to-agent" library design: Can an agent build a set of abstractions that make a future agent’s job easier?

Methods

The authors propose a two-phase evaluation framework:

  1. Design Phase: A "Designer" agent is given a non-prescriptive specification (what the library should do, but not how the API should look) and four hours to implement a full-featured library in one of four languages (Python, Rust, TypeScript, or Haskell).
  2. Evaluation Phase: Three different "Implementer" agents (typically smaller or less capable models) are tasked with solving 242 programming problems using the newly created library.

The final Library Score is a product of two metrics:

  • Correctness: The fraction of test cases the implementer agents pass.
  • Simplicity: A measure of how much the library reduces code volume and complexity (Cyclomatic, Cognitive, etc.) compared to an expert-written reference solution.
Figure 1: LibraryDesignBench’s two-phase setup evaluates the library through real usage. The agent under evaluation designs the library from a non-prescriptive specification. Three downstream agents then solve problems with it. The score reflects how correct and simple their programs are.

Datasets

The authors introduced LibraryDesignBench, which consists of:

  • 15 Library Tasks: Ranging from CLI construction (clirs) and dataframes (pyda) to traffic simulation (roadkill) and parser combinators (weft).
  • 242 Expert-Validated Problems: Real-world use cases seeded from open-source repositories.
  • Four Languages: Python, Rust, Haskell, and TypeScript.
  • Production Baselines: The benchmark compares agent-written libraries against industry standards like pandas, fastapi, and clap.

Key Insights and Ideas

  • Agents are Mimics: In 11 out of 15 tasks, agent designers converged on the same abstractions used in human-written production libraries (e.g., the "builder pattern" in Rust).
  • The "Rigidity" Trap: When downstream agents failed to use a library effectively, it wasn't usually because a feature was missing. Instead, 64% of failures were due to Rigidity (interfaces that couldn't be adapted to the specific task) or Verbosity (the library required so much boilerplate that it was easier to write the logic by hand).
  • Agents Don't Read the Docs: Downstream agents are surprisingly "lazy." Under minimal prompting, 24% of agents never even opened the library files, relying instead on their internal memory of common libraries, which leads to errors when using a custom-designed agent library.
  • "Neuralese" Helps: The authors experimented with "agent-first" guidance—telling the designer to optimize for "token economy" and to test their design with sub-agents during the design phase. This improved downstream reuse and yielded simpler programs.

Key Results

The study compared several frontier models acting as designers. As shown in the results table below, Claude 3.5 Opus emerged as the strongest designer, even slightly outperforming human-written production libraries in terms of the final score.

Table 1: Overall results for each library setup by designer. All results average the same imple- menter set. Designers use mini-SWE-agent (Yang et al., 2025) unless another harness is named in parentheses, where CC is Claude Code. Production and No library are settings in which the implementer is given a human-written library or no library at all (Listing 2), respectively. “Library $” is the average cost, in USD, to generate a single library, while “Problem $” is the average implementer cost per evaluation problem. “% Pass” is the mean share of tests passed, not of fully solved problems. Scores show 95% CIs. Other values show clustered standard errors (Section 2.3). Bold marks the best per column.
  • Opus 5.5 achieved a score of 48.9, surpassing the Production Library baseline of 46.6.
  • Haskell is a Hurdle: Agents struggled significantly with Haskell; in 70% of Haskell tasks, using an agent-written library actually resulted in a worse score than using no library at all.
  • Performance Delta: Figure 2 illustrates that while agents can beat production libraries on some tasks (like plaid or rubberband), they still lag behind on complex Python tasks like roadkill or sapi.
Figure 2: Agent-written libraries outperform production libraries on a subset of tasks. Difference in score per task compared with that of the production library. The rightmost column is the no-library setup. Outlined cells score below no library.

Limitations and Future Work

The authors acknowledge several limitations:

  • Scope: The benchmark measures static complexity and correctness but does not account for runtime efficiency, security, or long-term maintainability.
  • Optimization: The reference programs are optimized for idiomatic use, but they are not necessarily the "global optimum" for simplicity.
  • Generalization: The results are tied to the specific 15 tasks and may not generalize to all software domains.

Future work could explore how agents might evolve entirely new "agent-native" programming paradigms (Neuralese) that prioritize token efficiency over human readability.

Summary updated

BibTeX
@misc{orlanski2026can,
  author = {Gabriel Orlanski and Alex L. Zhang and Avi Trost and Vincent Sunn Chen and Frederic Sala and Aws Albarghouthi and Ludwig Schmidt},
  title = {{Can Agents Design Libraries for Agents?}},
  year = {2026},
  eprint = {2609.36730},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.36730},
}
Figure