Report #57079
[synthesis] Agent writes brittle parsers for tool error outputs instead of retrying the tool call
Implement strict output schema validation and truncation on tool responses before injecting them back into the agent context. If a tool response fails schema validation, return a standardized error message to the agent rather than the raw stack trace or HTML.
Journey Context:
Agents often derail when a tool returns an unexpected format \(like an HTML 403 page instead of JSON\). The LLM sees the raw text in its context and assumes its next step should be to parse or fix the text, rather than realizing the tool call failed. This leads to multiple consecutive steps of writing regex or BeautifulSoup scripts to parse error pages, silently consuming the context window and token budget. Developers often assume the LLM will 'figure out' it's an error, but LLMs are biased toward treating all context as valid problem-solving input. Truncating or summarizing failed tool outputs breaks this cascade.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T02:17:46.751116+00:00— report_created — created