← All engineering notes

Agent reliability · 2026-11-13

Correctness beyond a successful response

An HTTP 200 and valid JSON are not enough. Agent workloads need complete streams, correct tool arguments and faithful protocol behavior, so every fix here comes with a controlled comparison.

4.7% → 0tool-argument leaks in long multi-turn sessions
97 → 0empty-argument failures, 1,600 forced calls
24 → 34of 34 official interface tests after patches

The arguments leaked into the arguments

In long, multi-turn coding sessions, a small fraction of tool calls came back broken: the model wrote its own end-of-argument marker into the argument text. The cause was a worker setting that applied full constrained decoding to every request that carried tools. We reproduced it by replaying real sessions from three clients (Claude Code, Codex and opencode) and changed exactly one switch on the same worker.

Tool-argument leaks—4.7% (17 / 361)0Empty-argument failures—97 · JSON-only constraint0 · schema-constrainedLeaks: same worker, real Claude Code sessions, one setting changed, Oct 15. Failures: BFCL forced calls, 1,600 per arm, Oct 21 canary.
BeforeAfter
Fig. 1 · Two failure modes, before and after.

After the change, 467 tool calls in our own real sessions produced zero leaks and zero regressions. For forced tool calls (a named function or required), we now constrain decoding to the function's argument schema instead of generic JSON; auto is unchanged. Empty-argument failures fell from 97 to 0 and Pass@1 rose from 87.4% to 92.6%.

Guards that stay on

  • Degeneration loop guard. If more than 98% of the last 2,048 tokens are short repeated fragments, generation ends with length. In the canary it truncated 2 of 32 runs.
  • Control-token injection guard. Control-token spellings inside user text are encoded as plain text. End and tool markers take effect only by token ID.
  • A reference oracle. The same batch of requests is compared token by token against the official open-source reference implementation.

Protocol details break agents too

The same round of work fixed four compatibility problems that never showed up as errors on a health check:

  • Segmented thinking content sent to the engine as an array failed from the second turn on.
  • The gateway dropped the thinking-effort field.
  • Clients that send no output budget now get a default reservation of min(32K, remaining context).
  • A hosted search tool that some clients include by default caused requests to be rejected.

Seven interface patches for Kimi-K3

SymptomHow we measured itFix
With thinking off and temperature 1.0, about 10% of auto calls skip the tool60 runs: 54/60 at 1.0 · 59/60 at 0.6 · 60/60 at 0Default temperature 0.6 when thinking is off and none is given
Thinking on without an effort often answers in text instead of calling tools36 runs: unspecified 30/36 · high 36/36 (half the tokens)Default thinking effort = high
Named-function tool_choice reports finish_reason stopOne of the 34 official testsReport tool_calls when calls are present
Small output budgets are eaten by thinking, no answer64-token budget caseThinking capped at half the total budget
OpenAI / Anthropic effort names not recognizedMessages / Responses casesMap to the nearest K3 level
Prompt cache hits not reportedCache caseEnable prompt token details
Invalid role returns 200One of 18 cross-model testsUse the official encoder

Official interface tests went from 24/34 to 34/34; cross-model tests from 17/18 to 18/18; team acceptance passed four rounds in a row. All patches are in the interface layer; the model is untouched.

Thinking effort, and how to call us

EffortAIME 24+25Note
50 (before alignment)97.9%—
75 (high / xhigh)99.6%Default when thinking is on without a level
100 (max)99.6%About 18% more output tokens
  • Give enough output budget. Reasoning is 76–82% of output; set max_tokens to at least 4K–8K.
  • Read tool_calls. When a function is named, calls always come back as tool_calls.
  • Stream for agents. A non-streaming response cut off before a tool block closes can lose completed calls.
  • Retry with Retry-After. Overload returns a retry hint; honor it.

Drill failures before designing for them

Drill (before the rework)What happenedWhat we run now
2× overload for 5 minutesAll 523 requests returned 200; first token 17 → 148 s; health checks stayed greenConcurrency cap at the measured knee; queue cap = first-token SLO − cold prefill
Kill a worker7 streams cut after 200, with no [DONE] and no errorPrimary/standby gateways; switch after 3 failed checks; actual gap 0.28–0.49 s
Pause for 60 sOne stream silently stalled for 70 s60 s inter-token timeout; first-token timeout grows with uncached length
Client disconnectsWorker released within 7 sRetry once on another node only if no bytes were sent

Lesson: HTTP 200 is not a pass. A server must recognize a truncated stream and enforce an inter-token timeout.

Data & sources

TestObserved resultScope
Tool-argument leaks4.7% → 0Real sessions, one setting changed, Oct 15
Empty-argument failures97 → 0BFCL forced calls, 1,600 per arm
Official interface tests (K3)24/34 → 34/34After seven interface-layer patches

October 2026 engineering measurements on the stated hardware and workload. They are not a cross-model ranking or a service-level guarantee.

This work runs underneath Zenith Tokens.

Try Zenith Tokens