@@ -579,6 +579,68 @@ print(response)
579
579
] ,
580
580
} ;
581
581
582
+ const anthropicSdkStep = {
583
+ type : StepType . CONFIGURE ,
584
+ description : tct (
585
+ 'Import and initialize the Sentry SDK with the [code:AnthropicIntegration] to instrument the Anthropic SDK:' ,
586
+ { code : < code /> }
587
+ ) ,
588
+ configurations : [
589
+ {
590
+ code : [
591
+ {
592
+ label : 'Python' ,
593
+ value : 'python' ,
594
+ language : 'python' ,
595
+ code : `
596
+ import sentry_sdk
597
+ from sentry_sdk.integrations.anthropic import AnthropicIntegration
598
+
599
+ sentry_sdk.init(
600
+ dsn="${ params . dsn . public } ",
601
+ traces_sample_rate=1.0,
602
+ # Add data like inputs and responses to/from LLMs and tools;
603
+ # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
604
+ send_default_pii=True,
605
+ # this is optional:
606
+ integrations=[
607
+ AnthropicIntegration(
608
+ # pass in any options here
609
+ ),
610
+ ],
611
+ )` ,
612
+ } ,
613
+ ] ,
614
+ } ,
615
+ {
616
+ code : [
617
+ {
618
+ label : 'Python' ,
619
+ value : 'python' ,
620
+ language : 'python' ,
621
+ code : `
622
+ from anthropic import Anthropic
623
+
624
+ with sentry_sdk.start_transaction(name="anthropic"):
625
+ client = Anthropic()
626
+ message = client.messages.create(
627
+ max_tokens=1024,
628
+ messages=[
629
+ {
630
+ "role": "user",
631
+ "content": "Tell me a joke",
632
+ }
633
+ ],
634
+ model="claude-sonnet-4-20250514",
635
+ )
636
+ print(message.content)
637
+ ` ,
638
+ } ,
639
+ ] ,
640
+ } ,
641
+ ] ,
642
+ } ;
643
+
582
644
const manualStep = {
583
645
type : StepType . CONFIGURE ,
584
646
description : tct (
@@ -628,6 +690,9 @@ with sentry_sdk.start_span(op="gen_ai.chat", name="chat o3-mini") as span:
628
690
if ( selected === 'openai' ) {
629
691
return [ openaiSdkStep ] ;
630
692
}
693
+ if ( selected === 'anthropic' ) {
694
+ return [ anthropicSdkStep ] ;
695
+ }
631
696
if ( selected === 'manual' ) {
632
697
return [ manualStep ] ;
633
698
}
0 commit comments