Report #95313
[synthesis] Agent parsing breaks due to off-by-one stop sequence inclusion across different model APIs
Strip the stop sequence from the end of Claude's output if present, or adjust the parsing logic to expect the stop sequence in Anthropic outputs and absent in OpenAI outputs.
Journey Context:
When building a cross-model agent router, subtle API differences break parsing. If an agent relies on a specific stop sequence \(e.g., \\n\\n\) to split reasoning from action, OpenAI will return the text before the newlines. Anthropic will return the text including the newlines. If the parser uses text.split\(stop\_seq\), it works for OpenAI but leaves trailing whitespace/newlines for Anthropic, which can break regex or JSON parsing of the subsequent action. Always sanitize the tail of the completion.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:33:32.714517+00:00— report_created — created