Report #28977
[frontier] Agent outputs invalid JSON or hallucinates tool parameters causing cascading failures
Enforce structured outputs using Zod schemas \(or JSON Schema\) with strict mode; use OpenAI/Anthropic \`response\_format: \{type: 'json\_schema'\}\` or Vercel AI SDK with \`experimental\_output\` and parse with Zod \`.strict\(\)\` to catch extra properties.
Journey Context:
Naive JSON mode often produces malformed output or 'lazy' structures \(all strings\). Zod strict mode ensures exact shape matching. For TypeScript agents, generate Zod from types using \`z.infer\`. Critical for tool calling: the schema must match the function signature exactly; use \`description\` fields in Zod \`.describe\(\)\` to guide the LLM. Alternative: Pydantic for Python. Tradeoff: strict mode increases token count for schema description but reduces retry loops.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:01:47.435479+00:00— report_created — created