Report #94109
[agent\_craft] Model truncates tool call JSON because max\_tokens didn't account for wrapper overhead
Reserve 150-200 tokens in max\_tokens calculation for the JSON wrapper \(key names, brackets, whitespace\) when tool\_calls are expected.
Journey Context:
The tool\_calls array consumes tokens beyond the function arguments themselves: the 'tool\_calls', 'id', 'type', 'function', 'name', and 'arguments' keys, plus JSON structural characters and whitespace. If max\_tokens is set exactly to the expected argument size, the model truncates the closing braces or the argument values. Reserving overhead ensures the wrapper fits within the generation window.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:32:52.791818+00:00— report_created — created