<|tool_calls_section_begin|> token appears in `reasoning_delta` causing agent execution failures
Environment
- Model: kimi-k2-thinking
Description
When using the kimi-k2-thinking model with streaming enabled (stream=True), I've observed that special tool-calling tokens such as <|tool_calls_section_begin|> appear within the reasoning_delta stream. This causes parsing failures in standard agent frameworks that expect reasoning_content to contain only natural language reasoning text.
Expected Behavior
According to the official documentation:
-
reasoning_contentshould contain the model's thinking/reasoning process - Tool calls should be properly structured in the
tool_callsfield - Special tokens like
<|tool_calls_section_begin|>should be part of the internal token structure, not exposed in the reasoning stream
Actual Behavior
The reasoning_delta field contains raw special tokens:
stream log from our side
Thanks a lot for the feedback. Could you please provide more details, including: (1) this problem occurred in Moonshot API or open-source engine such as vllm? (2) What's your original prompt message? We will reproduce and further debug base on the info above.
same problem. i use sglang as the engine .
same problem,openrouter api ,langchain can not use to call tools
same issue. kimi-k2 0905 instruct
same issue, vertex api endpoint