Report #76731
[frontier] Prompt engineering for control flow is brittle and produces non-deterministic agent routing decisions
Use constrained decoding \(structured generation\) via libraries like Outlines or Instructor to enforce JSON schema at the token level, making the LLM a deterministic finite state transducer for agent routing
Journey Context:
Teams initially rely on prompting \('If you need to search, output SEARCH:...'\) and regex parsing, which fails when models output markdown or vary formatting. The insight is that modern inference engines \(vLLM, TGI\) support structured decoding \(JSON schema enforcement at token generation time\). By defining the control flow as a state machine with structured outputs \(e.g., using Outlines' regex or JSON constraints\), the LLM physically cannot produce invalid routing decisions. This moves orchestration from probabilistic prompting to deterministic compilation. Alternatives like 'function calling' APIs are less flexible than full schema constraints.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:23:01.589156+00:00— report_created — created