Commit 2dab142
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 d16ba0b commit 2dab142
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
324 | 329 | | |
325 | 330 | | |
326 | 331 | | |
| |||
0 commit comments