1010
1111Usage:
1212 import sentry_sdk
13- from sentry_sdk.integrations.claude_code_sdk import ClaudeCodeSDKIntegration
13+ from sentry_sdk.integrations.claude_agent_sdk import ClaudeCodeSDKIntegration
1414
1515 sentry_sdk.init(
1616 dsn="...",
5757 from sentry_sdk .tracing import Span
5858
5959
60- class ClaudeCodeSDKIntegration (Integration ):
60+ class ClaudeAgentSDKIntegration (Integration ):
6161 """
6262 Integration for Claude Agent SDK.
6363
@@ -66,7 +66,7 @@ class ClaudeCodeSDKIntegration(Integration):
6666 Requires send_default_pii=True in Sentry init. Defaults to True.
6767 """
6868
69- identifier = "claude_code_sdk "
69+ identifier = "claude_agent_sdk "
7070 origin = f"auto.ai.{ identifier } "
7171
7272 def __init__ (self , include_prompts : bool = True ) -> None :
@@ -75,7 +75,7 @@ def __init__(self, include_prompts: bool = True) -> None:
7575 @staticmethod
7676 def setup_once () -> None :
7777 version = package_version ("claude_agent_sdk" )
78- _check_minimum_version (ClaudeCodeSDKIntegration , version )
78+ _check_minimum_version (ClaudeAgentSDKIntegration , version )
7979
8080 # Patch the query function
8181 claude_agent_sdk .query = _wrap_query (original_query )
@@ -97,7 +97,7 @@ def _capture_exception(exc: "Any") -> None:
9797 event , hint = event_from_exception (
9898 exc ,
9999 client_options = sentry_sdk .get_client ().options ,
100- mechanism = {"type" : "claude_code_sdk " , "handled" : False },
100+ mechanism = {"type" : "claude_agent_sdk " , "handled" : False },
101101 )
102102 sentry_sdk .capture_event (event , hint = hint )
103103
@@ -106,10 +106,10 @@ def _set_span_input_data(
106106 span : "Span" ,
107107 prompt : "str" ,
108108 options : "Optional[Any]" ,
109- integration : "ClaudeCodeSDKIntegration " ,
109+ integration : "ClaudeAgentSDKIntegration " ,
110110) -> None :
111111 """Set input data on the span."""
112- set_data_normalized (span , SPANDATA .GEN_AI_SYSTEM , "claude-code " )
112+ set_data_normalized (span , SPANDATA .GEN_AI_SYSTEM , "claude-agent-sdk-python " )
113113 set_data_normalized (span , SPANDATA .GEN_AI_OPERATION_NAME , "chat" )
114114
115115 # Extract configuration from options if available
@@ -187,7 +187,7 @@ def _extract_tool_calls(message: "Any") -> "Optional[list]":
187187def _set_span_output_data (
188188 span : "Span" ,
189189 messages : "list" ,
190- integration : "ClaudeCodeSDKIntegration " ,
190+ integration : "ClaudeAgentSDKIntegration " ,
191191) -> None :
192192 """Set output data on the span from collected messages."""
193193 response_texts = []
@@ -273,7 +273,7 @@ def _wrap_query(original_func: "Any") -> "Any":
273273 async def wrapper (
274274 * , prompt : str , options : "Optional[Any]" = None , ** kwargs : "Any"
275275 ) -> "AsyncGenerator[Any, None]" :
276- integration = sentry_sdk .get_client ().get_integration (ClaudeCodeSDKIntegration )
276+ integration = sentry_sdk .get_client ().get_integration (ClaudeAgentSDKIntegration )
277277 if integration is None :
278278 async for message in original_func (prompt = prompt , options = options , ** kwargs ):
279279 yield message
@@ -285,8 +285,8 @@ async def wrapper(
285285
286286 span = get_start_span_function ()(
287287 op = OP .GEN_AI_CHAT ,
288- name = f"claude-code query { model } " .strip (),
289- origin = ClaudeCodeSDKIntegration .origin ,
288+ name = f"claude-agent-sdk query { model } " .strip (),
289+ origin = ClaudeAgentSDKIntegration .origin ,
290290 )
291291 span .__enter__ ()
292292
@@ -315,7 +315,7 @@ def _wrap_client_query(original_method: "Any") -> "Any":
315315
316316 @wraps (original_method )
317317 async def wrapper (self : "Any" , prompt : str , ** kwargs : "Any" ) -> "Any" :
318- integration = sentry_sdk .get_client ().get_integration (ClaudeCodeSDKIntegration )
318+ integration = sentry_sdk .get_client ().get_integration (ClaudeAgentSDKIntegration )
319319 if integration is None :
320320 return await original_method (self , prompt , ** kwargs )
321321
@@ -330,8 +330,8 @@ async def wrapper(self: "Any", prompt: str, **kwargs: "Any") -> "Any":
330330
331331 span = get_start_span_function ()(
332332 op = OP .GEN_AI_CHAT ,
333- name = f"claude-code client { model } " .strip (),
334- origin = ClaudeCodeSDKIntegration .origin ,
333+ name = f"claude-agent-sdk client { model } " .strip (),
334+ origin = ClaudeAgentSDKIntegration .origin ,
335335 )
336336 span .__enter__ ()
337337
@@ -367,7 +367,7 @@ def _wrap_receive_response(original_method: "Any") -> "Any":
367367
368368 @wraps (original_method )
369369 async def wrapper (self : "Any" , ** kwargs : "Any" ) -> "AsyncGenerator[Any, None]" :
370- integration = sentry_sdk .get_client ().get_integration (ClaudeCodeSDKIntegration )
370+ integration = sentry_sdk .get_client ().get_integration (ClaudeAgentSDKIntegration )
371371 if integration is None :
372372 async for message in original_method (self , ** kwargs ):
373373 yield message
0 commit comments