CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.
Python agent-frameworkagent-harnessagent-runtimeagentic-aiai-agentsai-frameworkanthropicharnessharness-engineeringharness-frameworklanggraphlanggraph-alternativellmmcpopenaipi-agentpi-agent-corepythonpython-agent
fix(providers): guard anthropic stream-error classification to SDK-originated exceptions
xf gong1c6ae785f61e
diff --git a/cubepi/providers/anthropic.py b/cubepi/providers/anthropic.pyindex 6bde0d7..2313413 100644--- a/cubepi/providers/anthropic.py+++ b/cubepi/providers/anthropic.py@@ -308,7 +308,13 @@ class AnthropicProvider(BaseProvider):except Exception as _sdk_exc:from cubepi.errors import classify_and_raise- classify_and_raise(_sdk_exc, model=model, messages=messages)+ # Guard: only classify Anthropic SDK errors, not local+ # callback/processing exceptions (on_response, _handle_event,+ # _convert_response, _assemble_response).+ if type(_sdk_exc).__module__.startswith("anthropic"):+ classify_and_raise(_sdk_exc, model=model, messages=messages)+ else:+ raiseexcept BaseException as e:exc = ediff --git a/tests/providers/test_anthropic.py b/tests/providers/test_anthropic.pyindex aa49519..16aea57 100644--- a/tests/providers/test_anthropic.py+++ b/tests/providers/test_anthropic.py@@ -1374,6 +1374,8 @@ class TestAnthropicBaseUrl:class _FakeAnthropicExc(Exception):"""Minimal fake Anthropic SDK exception with configurable status_code."""+ __module__ = "anthropic" # so the __module__ guard in classify_and_raise allows it+def __init__(self, message: str, *, status_code: int | None = None) -> None:super().__init__(message)if status_code is not None: