Pull requests / #787

#787 fix: parse tool calls inside reasoning

closed · @kossum · 0 comments · View on GitHub

Server & APILinux

Description

I have been running into agent turns that stop after thinking, with no answer or tool call. One case is when the model writes a complete  before closing . The parser treats it as reasoning text, so the client never gets the call.

This patch lets the reasoning state use the existing tool-call parser too. After the call, it goes back to reasoning until  arrives. It also keeps partial `<tool_call>` tags buffered when they're split across chunks.

This only handles the tool fragment being swallowed. It doesn't change stop tokens or try to continue a reply that contains nothing but reasoning.

## Tests

`python -m unittest serve.test_reasoning_tools` passes. Covers tool calls in reasoning and normal content, tags split across chunks, and unfinished calls.

These checks ran in a Linux Docker container with Python 3.12. They don't include a GPU inference test.

Related on strata.com

Editorial links to help you install, pick models, or read release notes — not part of the upstream thread.