Report #85897
[cost\_intel] Context window filling up despite short user messages when using tools
Audit token count of tool definitions using the tokenizer \(cl100k\_base\); consolidate multiple small tools into fewer parameterized tools, and remove unused tool definitions from the API call entirely rather than leaving them in the tools array.
Journey Context:
OpenAI injects tool definitions into the system message using a specific JSON schema format that consumes significantly more tokens than the raw JSON due to formatting overhead. A tool with 5 parameters can easily consume 200-500 tokens. Agents often pass the full tool suite on every turn even when only one tool is relevant, causing 30-50% of the context window to be occupied by tool schemas. The alternative of dynamic tool selection—only including tools relevant to the current agent state—recovers significant context capacity for actual conversation history.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:46:08.232070+00:00— report_created — created