Commit 0776889
fix(agents): estimate the tools breakdown from serialized schemas [review #4596]
`approxTokens(opts.tools)` hit approxTokens' array branch, which charges a flat
~64 per non-text block — so the "Tools" segment was ~64×toolCount regardless of
how large each tool's name/description/parameter schema actually is, and the
shortfall silently inflated the "Messages" remainder. Serialize the tool array
first so the estimate reflects what really occupies the prompt.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent c055d7e commit 0776889
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
328 | 333 | | |
329 | 334 | | |
330 | 335 | | |
| |||
0 commit comments