Repository navigation
Insights: keep a run inside the model's context window - #53
Merged
Merged
Conversation
A takeaways run on the production org failed with the model's 400: 24,769 prompt tokens plus the 8,000 reserved for output exceeded the 32,768 limit. Every query result stays in the transcript for the rest of the run, and a dozen 200-row results add up. Three changes: the model server's window is 64k (the model supports 262k; KV cache for 64k is a few GB of what is left beside the weights), the endpoint's max_tokens is 4,096 (the longest answer is the ~2k takeaways JSON; the reservation is taken off the window up front), tool results are capped at 80 rows, and the prompt asks the model to aggregate to the 10-30 rows that answer a question rather than return raw rows.
eddietejeda
requested review from
rohan-hotdata
and removed request for
a team
October 17, 2026 14:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The takeaways run on hototel.com failed with a 400 from the model server:
Every query result stays in the agent's transcript until the run ends, and a dozen 200-row results plus the 8k output reservation overflowed the window.
--max-model-len 65536(already redeployed; the model supports 262k and the KV cache for 64k is a few GB of the headroom beside the weights).max_tokens8000 → 4096. It is reserved out of the window up front; the longest answer is the ~2k takeaways JSON.max_rows200 → 80.SELECT *.Verifying with a real takeaways run against the production org database; result in a comment.