Skip to content

Final answers truncated mid-sentence — max_tokens=300 cap on the chat model - #4

Merged
darieldatoon merged 1 commit into
mainfrom
issues-agent/325e0632-1613-4d63-9b1d-8e0605a09019
Jun 24, 2026
Merged

Final answers truncated mid-sentence — max_tokens=300 cap on the chat model#4
darieldatoon merged 1 commit into
mainfrom
issues-agent/325e0632-1613-4d63-9b1d-8e0605a09019

Conversation

@langsmith-engine

Copy link
Copy Markdown

The agent's LLM is constructed with a hard max_tokens=300 ceiling, so any user request that needs more than ~300 output tokens (technical walkthroughs, code-heavy explanations, multi-step setup guides) is cut off mid-sentence, mid-code-block, or mid-bullet — leaving unclosed f-strings, half-written JSON, and dangling list markers in the final assistant message. This happens systematically: every truncated trace shows the LLM span hitting output_tokens == 300, confirming the cap is the binding constraint rather than the model choosing to stop. The existing response_completeness online evaluator is already flagging these, so the failure is observable but unfixed at the source.

The 300-token ceiling truncated long-answer responses (technical
walkthroughs, code blocks) mid-sentence. 2048 is a reasonable default
for a Haiku-class chat agent and resolves the response_completeness
evaluator failures.
@darieldatoon
darieldatoon marked this pull request as ready for review June 24, 2026 17:58
@darieldatoon
darieldatoon merged commit 77d9401 into main Jun 24, 2026
1 check passed
@darieldatoon
darieldatoon deleted the issues-agent/325e0632-1613-4d63-9b1d-8e0605a09019 branch June 26, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant