﻿# How should a K2 Horizon client recognize a tool call after reasoning?

llama.cpp b12830 handles a K2 Horizon tool boundary that can occur before an explicit reasoning end marker. Test parsing and execution separately.

Author: Retrivium editorial team
Updated: 2026-11-29
Canonical URL: https://retrivium.ai/journal/daily-20261129-agents-llama-k2-horizon-tool-boundary/
Language: en

The llama.cpp snapshot b12830, published on November 28, changes chat parsing for K2 Horizon. The contributor found that the model could begin a tool call without emitting a closing marker for its reasoning block. Previously, the parser could leave the entire remainder in the reasoning stream. The new path ends reasoning when it encounters the tool start marker. The contributor reports local tests at medium and high reasoning effort.

## Reproduce the message shape with harmless fixtures

Keep a stored example for an ordinary assistant message, one with a tool after explicit closure and one with the model-specific transition. Keep fixtures approved for the project and use a no-op test tool. Capture whether the parser produces a reasoning block, chat text and a structured tool call in each case. Inputs for other model families should retain their own parsing rules.

## Validate the call after framing

Only the completed tool object should reach argument validation. Check its name against the application's registered tools and require the argument schema expected by the chosen tool. Confirm that trace and UI output preserve the distinction between reasoning and the tool invocation. Authorization at the application boundary still controls whether the validated call is executed.

## Compare streaming with a complete response

A stream can split a delimiter across frames. Use the same fixture both as a complete response and through the actual streaming adapter, varying where the frames are split. Compare the final parsed structures. Observe the client state when the generation ends partway through the tool arguments. The incomplete object should remain pending or failed according to the client contract.

## Pin the template and runtime together

Record the exact checkpoint, chat template, parser build and adapter in the result. A deployment that overrides the chat template may have a different delimiter contract. Keep the approved test fixtures with the configuration so a later template update can be checked without opening the route to real tool side effects.

## Sources

- [Primary source · llama.cpp b12830](https://github.com/ggml-org/llama.cpp/releases/tag/b12830)
- [Primary source · llama.cpp #32993](https://github.com/ggml-org/llama.cpp/pull/32993)

## Related reading

- [Related guide · Openrouter tool calling](/journal/openrouter-tool-calling/)
- [Related guide · Provider streamed tool argument assembly](/journal/provider-streamed-tool-argument-assembly/)
