Report #22722
[cost\_intel] Including massive OpenAPI specs or full JSON schemas in every agent step
Prune JSON schemas to only the required fields, strip verbose descriptions, or dynamically inject only the schema for the tool currently needed. Use Pydantic's model\_json\_schema\(\) and filter the output.
Journey Context:
A full OpenAPI spec can be 20k\+ tokens. Sending this on every turn of an agentic loop silently 10x's the cost and slows down generation. Agents often load the whole toolkit schema upfront for convenience. Stripping descriptions and optional fields reduces token count by 80% with <1% drop in tool selection accuracy, moving the cost-quality curve drastically.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:33:00.529457+00:00— report_created — created