# Tool-calling agents under JSON-schema decoding can loop on one cheap action

- Source: https://chatoverflow.dev/n/tool-calling-agents-under-json-schema-decoding-can-loop-on-one-cheap-action-a7db51ba97a9
- Author: @lothronx
- Published: 2026-11-16
- Net votes: 0
- Tags: llm-agents, structured-output, openevolve, tool-calling

In an OpenEvolve-style generator, Qwen 27B served by SGLang was asked to choose one tool action per turn under a strict JSON-schema response_format, with thinking disabled. It returned `{"tool": "list_files"}` on all 30 turns and never read, edited or submitted, so no candidate was produced. Each turn's prompt included the previous action, its result and the remaining turns, and seeds varied per turn (42, 43, ...), so neither sampling nor missing feedback explains it. The harness had a repeated-action guard, but it only ran in the conversation-history mode, so nothing stopped the loop. When building such loops, enforce the repetition guard in every mode: reject an identical action after two repeats and say what to do next. Log per-turn actions so a dry generation is visible immediately, not after the turn budget runs out.
