paid-python 1.3.0__tar.gz → 1.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. {paid_python-1.3.0 → paid_python-1.4.0}/PKG-INFO +3 -1
  2. {paid_python-1.3.0 → paid_python-1.4.0}/README.md +1 -0
  3. {paid_python-1.3.0 → paid_python-1.4.0}/pyproject.toml +3 -1
  4. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/client_wrapper.py +2 -2
  5. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/anthropic_patches/patches.py +5 -5
  6. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/autoinstrumentation.py +72 -17
  7. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/gemini_patches/patches.py +3 -10
  8. {paid_python-1.3.0 → paid_python-1.4.0}/LICENSE +0 -0
  9. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/__init__.py +0 -0
  10. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/client.py +0 -0
  11. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/contacts/__init__.py +0 -0
  12. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/contacts/client.py +0 -0
  13. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/contacts/raw_client.py +0 -0
  14. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/contacts/types/__init__.py +0 -0
  15. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/contacts/types/create_contact_request_roles_item.py +0 -0
  16. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/__init__.py +0 -0
  17. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/api_error.py +0 -0
  18. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/datetime_utils.py +0 -0
  19. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/file.py +0 -0
  20. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/force_multipart.py +0 -0
  21. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/http_client.py +0 -0
  22. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/http_response.py +0 -0
  23. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/http_sse/__init__.py +0 -0
  24. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/http_sse/_api.py +0 -0
  25. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/http_sse/_decoders.py +0 -0
  26. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/http_sse/_exceptions.py +0 -0
  27. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/http_sse/_models.py +0 -0
  28. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/jsonable_encoder.py +0 -0
  29. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/pydantic_utilities.py +0 -0
  30. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/query_encoder.py +0 -0
  31. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/remove_none_from_dict.py +0 -0
  32. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/request_options.py +0 -0
  33. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/core/serialization.py +0 -0
  34. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/customers/__init__.py +0 -0
  35. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/customers/client.py +0 -0
  36. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/customers/raw_client.py +0 -0
  37. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/environment.py +0 -0
  38. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/errors/__init__.py +0 -0
  39. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/errors/bad_request_error.py +0 -0
  40. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/errors/forbidden_error.py +0 -0
  41. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/errors/internal_server_error.py +0 -0
  42. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/errors/not_found_error.py +0 -0
  43. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/invoices/__init__.py +0 -0
  44. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/invoices/client.py +0 -0
  45. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/invoices/raw_client.py +0 -0
  46. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/logger.py +0 -0
  47. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/orders/__init__.py +0 -0
  48. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/orders/client.py +0 -0
  49. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/orders/raw_client.py +0 -0
  50. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/products/__init__.py +0 -0
  51. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/products/client.py +0 -0
  52. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/products/raw_client.py +0 -0
  53. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/py.typed +0 -0
  54. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/signals/__init__.py +0 -0
  55. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/signals/client.py +0 -0
  56. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/signals/raw_client.py +0 -0
  57. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/__init__.py +0 -0
  58. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/anthropic_patches/__init__.py +0 -0
  59. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/context_data.py +0 -0
  60. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/context_manager.py +0 -0
  61. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/distributed_tracing.py +0 -0
  62. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/gemini_patches/__init__.py +0 -0
  63. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/openai_agents_patches/__init__.py +0 -0
  64. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/openai_agents_patches/patches.py +0 -0
  65. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/signal.py +0 -0
  66. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/tracing.py +0 -0
  67. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/__init__.py +0 -0
  68. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/anthropic/__init__.py +0 -0
  69. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/anthropic/anthropicWrapper.py +0 -0
  70. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/bedrock/__init__.py +0 -0
  71. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/bedrock/bedrockWrapper.py +0 -0
  72. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/gemini/__init__.py +0 -0
  73. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/gemini/geminiWrapper.py +0 -0
  74. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/langchain/__init__.py +0 -0
  75. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/langchain/paidLangChainCallback.py +0 -0
  76. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/mistral/__init__.py +0 -0
  77. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/mistral/mistralWrapper.py +0 -0
  78. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/openai/__init__.py +0 -0
  79. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/openai/openAiWrapper.py +0 -0
  80. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/openai_agents/__init__.py +0 -0
  81. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +0 -0
  82. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/tracing/wrappers/utils.py +0 -0
  83. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/__init__.py +0 -0
  84. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/attribution.py +0 -0
  85. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/bulk_signals_response.py +0 -0
  86. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/contact.py +0 -0
  87. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/contact_billing_address.py +0 -0
  88. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/contact_list_response.py +0 -0
  89. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/contact_roles_item.py +0 -0
  90. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/create_order_line_attribute_request.py +0 -0
  91. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/create_order_line_request.py +0 -0
  92. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/customer.py +0 -0
  93. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/customer_attribution.py +0 -0
  94. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/customer_billing_address.py +0 -0
  95. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/customer_by_external_id.py +0 -0
  96. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/customer_by_id.py +0 -0
  97. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/customer_creation_state.py +0 -0
  98. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/customer_list_response.py +0 -0
  99. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/empty_response.py +0 -0
  100. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/error_response.py +0 -0
  101. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/invoice.py +0 -0
  102. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/invoice_line.py +0 -0
  103. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/invoice_line_payment_status.py +0 -0
  104. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/invoice_lines_response.py +0 -0
  105. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/invoice_list_response.py +0 -0
  106. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/invoice_payment_status.py +0 -0
  107. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/invoice_source.py +0 -0
  108. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/invoice_status.py +0 -0
  109. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/invoice_tax_status.py +0 -0
  110. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/order.py +0 -0
  111. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/order_creation_state.py +0 -0
  112. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/order_line.py +0 -0
  113. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/order_lines_response.py +0 -0
  114. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/order_list_response.py +0 -0
  115. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/pagination.py +0 -0
  116. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/product.py +0 -0
  117. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/product_by_external_id.py +0 -0
  118. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/product_by_id.py +0 -0
  119. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/product_list_response.py +0 -0
  120. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/signal.py +0 -0
  121. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/update_contact_request.py +0 -0
  122. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/update_contact_request_roles_item.py +0 -0
  123. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/update_customer_request.py +0 -0
  124. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/types/update_product_request.py +0 -0
  125. {paid_python-1.3.0 → paid_python-1.4.0}/src/paid/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: paid-python
3
- Version: 1.3.0
3
+ Version: 1.4.0
4
4
  Summary:
5
5
  Requires-Python: >=3.10,<3.14
6
6
  Classifier: Intended Audience :: Developers
@@ -21,6 +21,7 @@ Requires-Dist: httpx (>=0.21.2)
21
21
  Requires-Dist: mutagen (>=1.47.0)
22
22
  Requires-Dist: openinference-instrumentation-anthropic (>=0.1.20,<1.0.0)
23
23
  Requires-Dist: openinference-instrumentation-bedrock (>=0.1.0)
24
+ Requires-Dist: openinference-instrumentation-claude-agent-sdk (>=0.1.0)
24
25
  Requires-Dist: openinference-instrumentation-google-genai (>=0.1.8)
25
26
  Requires-Dist: openinference-instrumentation-instructor (>=0.1.0)
26
27
  Requires-Dist: openinference-instrumentation-langchain (>=0.1.55)
@@ -381,6 +382,7 @@ anthropic - Anthropic SDK
381
382
  gemini - Google Generative AI (google-generativeai)
382
383
  openai - OpenAI Python SDK
383
384
  openai-agents - OpenAI Agents SDK
385
+ claude-agent-sdk - Claude Agent SDK
384
386
  bedrock - AWS Bedrock (boto3)
385
387
  langchain - LangChain framework
386
388
  instructor - Instructor
@@ -344,6 +344,7 @@ anthropic - Anthropic SDK
344
344
  gemini - Google Generative AI (google-generativeai)
345
345
  openai - OpenAI Python SDK
346
346
  openai-agents - OpenAI Agents SDK
347
+ claude-agent-sdk - Claude Agent SDK
347
348
  bedrock - AWS Bedrock (boto3)
348
349
  langchain - LangChain framework
349
350
  instructor - Instructor
@@ -4,7 +4,7 @@ dynamic = ["version"]
4
4
 
5
5
  [tool.poetry]
6
6
  name = "paid-python"
7
- version = "1.3.0"
7
+ version = "1.4.0"
8
8
  description = ""
9
9
  readme = "README.md"
10
10
  authors = []
@@ -44,6 +44,7 @@ openinference-instrumentation-instructor = ">=0.1.0"
44
44
  openinference-instrumentation-langchain = ">=0.1.55"
45
45
  openinference-instrumentation-openai = ">=0.1.40"
46
46
  openinference-instrumentation-openai-agents = ">=1.0.0"
47
+ openinference-instrumentation-claude-agent-sdk = ">=0.1.0"
47
48
  opentelemetry-api = ">=1.23.0"
48
49
  opentelemetry-exporter-otlp-proto-http = ">=1.23.0"
49
50
  opentelemetry-sdk = ">=1.23.0"
@@ -59,6 +60,7 @@ pytest-xdist = "^3.6.1"
59
60
  python-dateutil = "^2.9.0"
60
61
  types-python-dateutil = "^2.9.0.20240316"
61
62
  anthropic = ">=0.57.0"
63
+ claude-agent-sdk = ">=0.1.0"
62
64
  google-genai = ">=1.19.0"
63
65
  instructor = ">=1.0.0"
64
66
  langchain-core = ">=0.1.0"
@@ -24,12 +24,12 @@ class BaseClientWrapper:
24
24
  import platform
25
25
 
26
26
  headers: typing.Dict[str, str] = {
27
- "User-Agent": "paid-python/1.3.0",
27
+ "User-Agent": "paid-python/1.4.0",
28
28
  "X-Fern-Language": "Python",
29
29
  "X-Fern-Runtime": f"python/{platform.python_version()}",
30
30
  "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}",
31
31
  "X-Fern-SDK-Name": "paid-python",
32
- "X-Fern-SDK-Version": "1.3.0",
32
+ "X-Fern-SDK-Version": "1.4.0",
33
33
  **(self.get_custom_headers() or {}),
34
34
  }
35
35
  headers["Authorization"] = f"Bearer {self._get_token()}"
@@ -39,6 +39,7 @@ def uninstrument_anthropic() -> None:
39
39
  if _original_async_messages_stream is not None:
40
40
  try:
41
41
  from anthropic.resources.messages import AsyncMessages
42
+
42
43
  AsyncMessages.stream = _original_async_messages_stream # type: ignore[method-assign]
43
44
  except Exception:
44
45
  pass
@@ -47,6 +48,7 @@ def uninstrument_anthropic() -> None:
47
48
  _uninstrument_beta_messages()
48
49
  _uninstrument_response_id_patches()
49
50
 
51
+
50
52
  def _patch_stream_context_managers() -> None:
51
53
  try:
52
54
  from openinference.instrumentation.anthropic._stream import (
@@ -96,6 +98,7 @@ def _patch_stream_context_managers() -> None:
96
98
  # losing the high-level MessageStream (.text_stream, .get_final_message()).
97
99
  # We delegate to the real __enter__ instead, then wrap in _MessagesStream for tracing.
98
100
 
101
+
99
102
  def _patch_message_stream_manager() -> None:
100
103
  try:
101
104
  from openinference.instrumentation.anthropic._stream import _MessagesStream
@@ -122,6 +125,7 @@ def _patch_message_stream_manager() -> None:
122
125
 
123
126
  # Fix 3: openinference only wraps sync Messages.stream, not AsyncMessages.stream.
124
127
 
128
+
125
129
  class _AsyncMessageStreamManagerProxy(ObjectProxy): # type: ignore[misc]
126
130
  """Wraps AsyncMessageStreamManager with span lifecycle management."""
127
131
 
@@ -195,8 +199,6 @@ def _wrap_async_messages_stream() -> None:
195
199
  logger.debug("Wrapped AsyncMessages.stream for instrumentation")
196
200
 
197
201
 
198
-
199
-
200
202
  def _patch_response_accumulator_for_beta() -> None:
201
203
  """Extend _MessageResponseAccumulator.process_chunk to handle beta event types and capture response IDs."""
202
204
  try:
@@ -428,9 +430,7 @@ def _wrap_beta_messages() -> None:
428
430
 
429
431
  def _beta_async_stream_wrapper(wrapped, instance, args, kwargs): # type: ignore[misc]
430
432
  beta_tracer = tracing.paid_tracer_provider.get_tracer("paid.anthropic")
431
- span = beta_tracer.start_span(
432
- name="AsyncMessagesStream", record_exception=False, set_status_on_exception=False
433
- )
433
+ span = beta_tracer.start_span(name="AsyncMessagesStream", record_exception=False, set_status_on_exception=False)
434
434
 
435
435
  try:
436
436
  if kwargs.get("model"):
@@ -38,6 +38,14 @@ except Exception:
38
38
  logger.debug("OpenAI Agents instrumentation library not available, skipping instrumentation")
39
39
  OPENAI_AGENTS_AVAILABLE = False
40
40
 
41
+ try:
42
+ from openinference.instrumentation.claude_agent_sdk import ClaudeAgentSDKInstrumentor
43
+
44
+ CLAUDE_AGENT_SDK_AVAILABLE = True
45
+ except Exception:
46
+ logger.debug("Claude Agent SDK instrumentation library not available, skipping instrumentation")
47
+ CLAUDE_AGENT_SDK_AVAILABLE = False
48
+
41
49
  try:
42
50
  from openinference.instrumentation.bedrock import BedrockInstrumentor
43
51
 
@@ -87,6 +95,7 @@ def paid_autoinstrument(libraries: Optional[List[str]] = None) -> None:
87
95
  - "anthropic": Anthropic library
88
96
  - "openai": OpenAI library
89
97
  - "openai-agents": OpenAI Agents SDK
98
+ - "claude-agent-sdk": Claude Agent SDK
90
99
  - "bedrock": AWS Bedrock
91
100
  - "langchain": LangChain library
92
101
  - "google-genai": Google GenAI library
@@ -120,12 +129,22 @@ def paid_autoinstrument(libraries: Optional[List[str]] = None) -> None:
120
129
 
121
130
  logger.debug(
122
131
  "[paid:autoinstrument] tracer_provider type=%s, requested libraries=%s",
123
- type(tracing.paid_tracer_provider).__name__, libraries,
132
+ type(tracing.paid_tracer_provider).__name__,
133
+ libraries,
124
134
  )
125
135
 
126
136
  # Default to all supported libraries if none specified
127
137
  if libraries is None:
128
- libraries = ["anthropic", "openai", "openai-agents", "bedrock", "langchain", "google-genai", "instructor"]
138
+ libraries = [
139
+ "anthropic",
140
+ "openai",
141
+ "openai-agents",
142
+ "claude-agent-sdk",
143
+ "bedrock",
144
+ "langchain",
145
+ "google-genai",
146
+ "instructor",
147
+ ]
129
148
  logger.debug("[paid:autoinstrument] No libraries specified, defaulting to all: %s", libraries)
130
149
 
131
150
  for library in libraries:
@@ -139,6 +158,8 @@ def paid_autoinstrument(libraries: Optional[List[str]] = None) -> None:
139
158
  _instrument_openai()
140
159
  elif library == "openai-agents":
141
160
  _instrument_openai_agents()
161
+ elif library == "claude-agent-sdk":
162
+ _instrument_claude_agent_sdk()
142
163
  elif library == "bedrock":
143
164
  _instrument_bedrock()
144
165
  elif library == "langchain":
@@ -149,7 +170,9 @@ def paid_autoinstrument(libraries: Optional[List[str]] = None) -> None:
149
170
  _instrument_instructor()
150
171
  else:
151
172
  logger.warning(
152
- f"Unknown library '{library}' - supported libraries: anthropic, openai, openai-agents, bedrock, langchain, google-genai, instructor"
173
+ "Unknown library '%s' - supported libraries: anthropic, openai, openai-agents, "
174
+ "claude-agent-sdk, bedrock, langchain, google-genai, instructor",
175
+ library,
153
176
  )
154
177
 
155
178
  logger.info(f"Auto-instrumentation enabled for: {', '.join(_initialized_instrumentors)}")
@@ -168,8 +191,10 @@ def _instrument_anthropic() -> None:
168
191
 
169
192
  from .anthropic_patches import instrument_anthropic
170
193
 
171
- logger.debug("[paid:autoinstrument] Instrumenting anthropic with AnthropicInstrumentor, provider=%s",
172
- type(tracing.paid_tracer_provider).__name__)
194
+ logger.debug(
195
+ "[paid:autoinstrument] Instrumenting anthropic with AnthropicInstrumentor, provider=%s",
196
+ type(tracing.paid_tracer_provider).__name__,
197
+ )
173
198
  AnthropicInstrumentor().instrument(tracer_provider=tracing.paid_tracer_provider)
174
199
 
175
200
  instrument_anthropic()
@@ -186,8 +211,10 @@ def _instrument_openai() -> None:
186
211
  logger.warning("OpenAI library not available, skipping instrumentation")
187
212
  return
188
213
 
189
- logger.debug("[paid:autoinstrument] Instrumenting openai with OpenAIInstrumentor, provider=%s",
190
- type(tracing.paid_tracer_provider).__name__)
214
+ logger.debug(
215
+ "[paid:autoinstrument] Instrumenting openai with OpenAIInstrumentor, provider=%s",
216
+ type(tracing.paid_tracer_provider).__name__,
217
+ )
191
218
  # Instrument OpenAI with Paid's tracer provider
192
219
  OpenAIInstrumentor().instrument(tracer_provider=tracing.paid_tracer_provider)
193
220
 
@@ -205,8 +232,10 @@ def _instrument_openai_agents() -> None:
205
232
 
206
233
  from .openai_agents_patches import instrument_openai_agents
207
234
 
208
- logger.debug("[paid:autoinstrument] Instrumenting openai-agents with OpenAIAgentsInstrumentor, provider=%s",
209
- type(tracing.paid_tracer_provider).__name__)
235
+ logger.debug(
236
+ "[paid:autoinstrument] Instrumenting openai-agents with OpenAIAgentsInstrumentor, provider=%s",
237
+ type(tracing.paid_tracer_provider).__name__,
238
+ )
210
239
  # Instrument OpenAI Agents with Paid's tracer provider
211
240
  OpenAIAgentsInstrumentor().instrument(tracer_provider=tracing.paid_tracer_provider)
212
241
  instrument_openai_agents()
@@ -215,6 +244,24 @@ def _instrument_openai_agents() -> None:
215
244
  logger.info("OpenAI Agents auto-instrumentation enabled")
216
245
 
217
246
 
247
+ def _instrument_claude_agent_sdk() -> None:
248
+ """
249
+ Instrument the Claude Agent SDK using openinference-instrumentation-claude-agent-sdk.
250
+ """
251
+ if not CLAUDE_AGENT_SDK_AVAILABLE:
252
+ logger.warning("Claude Agent SDK instrumentation library not available, skipping instrumentation")
253
+ return
254
+
255
+ logger.debug(
256
+ "[paid:autoinstrument] Instrumenting claude-agent-sdk with ClaudeAgentSDKInstrumentor, provider=%s",
257
+ type(tracing.paid_tracer_provider).__name__,
258
+ )
259
+ ClaudeAgentSDKInstrumentor().instrument(tracer_provider=tracing.paid_tracer_provider)
260
+
261
+ _initialized_instrumentors.append("claude-agent-sdk")
262
+ logger.info("Claude Agent SDK auto-instrumentation enabled")
263
+
264
+
218
265
  def _instrument_bedrock() -> None:
219
266
  """
220
267
  Instrument AWS Bedrock using openinference-instrumentation-bedrock.
@@ -223,8 +270,10 @@ def _instrument_bedrock() -> None:
223
270
  logger.warning("Bedrock instrumentation library not available, skipping instrumentation")
224
271
  return
225
272
 
226
- logger.debug("[paid:autoinstrument] Instrumenting bedrock with BedrockInstrumentor, provider=%s",
227
- type(tracing.paid_tracer_provider).__name__)
273
+ logger.debug(
274
+ "[paid:autoinstrument] Instrumenting bedrock with BedrockInstrumentor, provider=%s",
275
+ type(tracing.paid_tracer_provider).__name__,
276
+ )
228
277
  # Instrument Bedrock with Paid's tracer provider
229
278
  BedrockInstrumentor().instrument(tracer_provider=tracing.paid_tracer_provider)
230
279
 
@@ -240,8 +289,10 @@ def _instrument_langchain() -> None:
240
289
  logger.warning("LangChain instrumentation library not available, skipping instrumentation")
241
290
  return
242
291
 
243
- logger.debug("[paid:autoinstrument] Instrumenting langchain with LangChainInstrumentor, provider=%s",
244
- type(tracing.paid_tracer_provider).__name__)
292
+ logger.debug(
293
+ "[paid:autoinstrument] Instrumenting langchain with LangChainInstrumentor, provider=%s",
294
+ type(tracing.paid_tracer_provider).__name__,
295
+ )
245
296
  # Instrument LangChain with Paid's tracer provider
246
297
  LangChainInstrumentor().instrument(tracer_provider=tracing.paid_tracer_provider)
247
298
 
@@ -262,8 +313,10 @@ def _instrument_google_genai() -> None:
262
313
 
263
314
  from .gemini_patches import instrument_google_genai
264
315
 
265
- logger.debug("[paid:autoinstrument] Instrumenting google-genai with GoogleGenAIInstrumentor, provider=%s",
266
- type(tracing.paid_tracer_provider).__name__)
316
+ logger.debug(
317
+ "[paid:autoinstrument] Instrumenting google-genai with GoogleGenAIInstrumentor, provider=%s",
318
+ type(tracing.paid_tracer_provider).__name__,
319
+ )
267
320
  GoogleGenAIInstrumentor().instrument(tracer_provider=tracing.paid_tracer_provider)
268
321
 
269
322
  instrument_google_genai()
@@ -280,8 +333,10 @@ def _instrument_instructor() -> None:
280
333
  logger.warning("Instructor library not available, skipping instrumentation")
281
334
  return
282
335
 
283
- logger.debug("[paid:autoinstrument] Instrumenting instructor with InstructorInstrumentor, provider=%s",
284
- type(tracing.paid_tracer_provider).__name__)
336
+ logger.debug(
337
+ "[paid:autoinstrument] Instrumenting instructor with InstructorInstrumentor, provider=%s",
338
+ type(tracing.paid_tracer_provider).__name__,
339
+ )
285
340
  InstructorInstrumentor().instrument(tracer_provider=tracing.paid_tracer_provider)
286
341
  _initialized_instrumentors.append("instructor")
287
342
  logger.info("Instructor auto-instrumentation enabled")
@@ -54,8 +54,7 @@ def _patch_response_id_extraction() -> None:
54
54
  )
55
55
  except ImportError:
56
56
  logger.debug(
57
- "Could not import openinference google_genai _response_attributes_extractor, "
58
- "skipping response ID patch"
57
+ "Could not import openinference google_genai _response_attributes_extractor, skipping response ID patch"
59
58
  )
60
59
  return
61
60
 
@@ -68,10 +67,7 @@ def _patch_response_id_extraction() -> None:
68
67
  yield _ATTR_RESPONSE_ID, response_id
69
68
 
70
69
  mod._ResponseAttributesExtractor._get_attributes_from_generate_content = _patched # type: ignore[method-assign]
71
- logger.debug(
72
- "Patched _ResponseAttributesExtractor._get_attributes_from_generate_content "
73
- "to also yield response ID"
74
- )
70
+ logger.debug("Patched _ResponseAttributesExtractor._get_attributes_from_generate_content to also yield response ID")
75
71
 
76
72
 
77
73
  def _patch_streaming_response_id_extraction() -> None:
@@ -79,10 +75,7 @@ def _patch_streaming_response_id_extraction() -> None:
79
75
  try:
80
76
  from openinference.instrumentation.google_genai import _stream as stream_mod
81
77
  except ImportError:
82
- logger.debug(
83
- "Could not import openinference google_genai _stream, "
84
- "skipping streaming response ID patch"
85
- )
78
+ logger.debug("Could not import openinference google_genai _stream, skipping streaming response ID patch")
86
79
  return
87
80
 
88
81
  _original_get_extra = stream_mod._ResponseExtractor.get_extra_attributes
File without changes