Skip to content

The agent that grows with you

fix(streaming): fall back to non-stream on custom provider SSE order error (#72833)

webtecnicad7aea5b3d61c
diff --git a/agent/anthropic_adapter.py b/agent/anthropic_adapter.py
index 559af3acc2a..98fc1ba8183 100644
--- a/agent/anthropic_adapter.py
+++ b/agent/anthropic_adapter.py
@@ -715,6 +715,8 @@ def _is_stream_unavailable_error(exc: Exception) -> bool:
err_lower = str(exc).lower()
if "stream" in err_lower and "not supported" in err_lower:
return True
+ if "unexpected event order" in err_lower:
+ return True
if "invokemodelwithresponsestream" not in err_lower:
return False
from agent.bedrock_adapter import is_streaming_access_denied_error