Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions py/src/braintrust/wrappers/claude_agent_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from braintrust.logger import NOOP_SPAN, current_span, init_logger

from ._wrapper import _create_client_wrapper_class, _create_tool_wrapper_class, _wrap_tool_factory
from ._wrapper import _create_client_wrapper_class, _create_tool_wrapper_class


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -69,7 +69,6 @@ def setup_claude_agent_sdk(

original_client = claude_agent_sdk.ClaudeSDKClient if hasattr(claude_agent_sdk, "ClaudeSDKClient") else None
original_tool_class = claude_agent_sdk.SdkMcpTool if hasattr(claude_agent_sdk, "SdkMcpTool") else None
original_tool_fn = claude_agent_sdk.tool if hasattr(claude_agent_sdk, "tool") else None

if original_client:
wrapped_client = _create_client_wrapper_class(original_client)
Expand All @@ -89,15 +88,6 @@ def setup_claude_agent_sdk(
if getattr(module, "SdkMcpTool", None) is original_tool_class:
setattr(module, "SdkMcpTool", wrapped_tool_class)

if original_tool_fn:
wrapped_tool_fn = _wrap_tool_factory(original_tool_fn)
claude_agent_sdk.tool = wrapped_tool_fn

for module in list(sys.modules.values()):
if module and hasattr(module, "tool"):
if getattr(module, "tool", None) is original_tool_fn:
setattr(module, "tool", wrapped_tool_fn)

return True
except ImportError:
# Not installed - this is expected when using auto_instrument()
Expand Down
Loading
Loading