Report #93979
[frontier] Agent planning loops produce inconsistent or unparseable plans that break downstream execution
Use structured outputs \(JSON schema constrained generation\) for agent planning steps. Define a schema for the agent's plan at each step \(e.g., \{thinking: string, next\_action: \{tool: string, args: object\}, is\_complete: boolean\}\). Force the model to produce a valid plan object. Validate against the schema before executing any tool calls. If validation fails, retry with the schema error in the prompt.
Journey Context:
Free-form chain-of-thought plus function calling creates fragile agent loops. The model might produce a plan in natural language that doesn't map cleanly to tool calls, or produce tool calls with wrong argument types, or mix reasoning and tool calls in unpredictable ways. Structured outputs solve this by making the plan a typed, validated object. This is different from just using function calling—structured outputs constrain the entire response, including the reasoning portion, ensuring it's always parseable. The pattern: define a union type schema where each variant represents a different agent state \(planning, executing, responding, erroring\). The model must produce one of these at each step. Tradeoff: structured outputs can slightly reduce model flexibility and add latency for schema validation. But for production agents, the reliability gain is worth it. OpenAI's structured outputs with response\_format and the instructor library for other providers make this practical.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:19:47.869421+00:00— report_created — created