AI agent tool schemas cut 47%: the duplicate YAML key that disabled nothing
My self-hosted AI agents were slow, and I spent a while assuming the model was the problem. It wasn't. Most of every request was the agent describing its own tools to the model, over and over, for tools it never used. On 2026-08-15 I trimmed the tool schemas on five specialist agent profiles by 47%. The trim itself was a few lines of YAML. The part that cost me the most time was a duplicate key…
An AI agent tool schema optimization led to a 47% reduction in processing time. The issue stemmed from a duplicate key in the YAML configuration file, which disabled no tools but resulted in no visible change. The duplicate key caused the YAML parser to retain only the last instance, effectively rendering the list empty and leaving all tools enabled.
To address this, the reporter employed a Python script using PyYAML's safe_load to parse the configuration and ensure the duplicate key was not added. After fixing the configuration, the report measured the tools and their associated schema bytes. Specialist agent profiles, which utilized 27 tools, saw a 47% reduction in tool schema bytes and a 27% decrease in the fixed prompt size after the trim.
This resulted in significant time savings, with each specialist turn taking approximately 9 seconds less compared to the pre-trimmed configuration. The report also highlighted the importance of measuring the impact of changes rather than relying on assumptions or guesses.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.