anthropic 1.61.0 → 1.63.0

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 (662) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +50 -0
  3. data/README.md +1 -1
  4. data/lib/anthropic/client.rb +29 -5
  5. data/lib/anthropic/errors.rb +6 -0
  6. data/lib/anthropic/helpers/aws/client.rb +9 -17
  7. data/lib/anthropic/helpers/aws_auth.rb +13 -2
  8. data/lib/anthropic/helpers/bedrock/client.rb +19 -17
  9. data/lib/anthropic/helpers/google_cloud/client.rb +16 -27
  10. data/lib/anthropic/helpers/messages.rb +21 -15
  11. data/lib/anthropic/helpers/streaming/message_stream.rb +37 -8
  12. data/lib/anthropic/helpers/tools/base_tool.rb +69 -10
  13. data/lib/anthropic/helpers/tools/mcp.rb +2 -2
  14. data/lib/anthropic/helpers/tools/runner.rb +33 -19
  15. data/lib/anthropic/helpers/vertex/client.rb +24 -13
  16. data/lib/anthropic/internal/type/base_model.rb +5 -1
  17. data/lib/anthropic/internal/type/base_stream.rb +10 -0
  18. data/lib/anthropic/models/anthropic_beta.rb +3 -0
  19. data/lib/anthropic/models/beta/agent_create_params.rb +39 -2
  20. data/lib/anthropic/models/beta/agent_update_params.rb +39 -2
  21. data/lib/anthropic/models/beta/beta_advisor_message_iteration_usage.rb +2 -2
  22. data/lib/anthropic/models/beta/beta_citations_delta.rb +59 -0
  23. data/lib/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rb +22 -0
  24. data/lib/anthropic/models/beta/beta_cloud_config.rb +29 -0
  25. data/lib/anthropic/models/beta/beta_cloud_config_params.rb +32 -3
  26. data/lib/anthropic/models/beta/beta_code_execution_tool_20260120.rb +3 -3
  27. data/lib/anthropic/models/beta/beta_code_execution_tool_20260521.rb +2 -2
  28. data/lib/anthropic/models/beta/beta_content_block.rb +89 -0
  29. data/lib/anthropic/models/beta/beta_content_block_param.rb +112 -7
  30. data/lib/anthropic/models/beta/beta_content_block_source_content.rb +28 -0
  31. data/lib/anthropic/models/beta/beta_context_management_config.rb +39 -0
  32. data/lib/anthropic/models/beta/beta_context_management_response.rb +26 -0
  33. data/lib/anthropic/models/beta/beta_diagnostics.rb +36 -3
  34. data/lib/anthropic/models/beta/beta_diagnostics_param.rb +3 -3
  35. data/lib/anthropic/models/beta/beta_document_block.rb +24 -0
  36. data/lib/anthropic/models/beta/beta_dream.rb +18 -7
  37. data/lib/anthropic/models/beta/beta_dream_input.rb +28 -2
  38. data/lib/anthropic/models/beta/beta_dream_memory_store_input.rb +3 -1
  39. data/lib/anthropic/models/beta/beta_dream_model_config.rb +5 -5
  40. data/lib/anthropic/models/beta/beta_dream_model_config_param.rb +4 -4
  41. data/lib/anthropic/models/beta/beta_environment.rb +30 -6
  42. data/lib/anthropic/models/beta/beta_fallback_block.rb +3 -3
  43. data/lib/anthropic/models/beta/beta_fallback_block_param.rb +3 -3
  44. data/lib/anthropic/models/beta/beta_fallback_credit_not_applied.rb +2 -2
  45. data/lib/anthropic/models/beta/beta_fallback_credit_token_param.rb +3 -3
  46. data/lib/anthropic/models/beta/beta_fallback_credit_usage.rb +29 -2
  47. data/lib/anthropic/models/beta/beta_fallback_info.rb +2 -2
  48. data/lib/anthropic/models/beta/beta_fallback_info_param.rb +2 -2
  49. data/lib/anthropic/models/beta/beta_fallback_message_iteration_usage.rb +3 -3
  50. data/lib/anthropic/models/beta/beta_fallback_param.rb +32 -3
  51. data/lib/anthropic/models/beta/beta_image_block_param.rb +30 -0
  52. data/lib/anthropic/models/beta/beta_iterations_usage.rb +39 -0
  53. data/lib/anthropic/models/beta/beta_limited_network.rb +2 -2
  54. data/lib/anthropic/models/beta/beta_limited_network_params.rb +3 -3
  55. data/lib/anthropic/models/beta/beta_managed_agents_advisor_params.rb +3 -3
  56. data/lib/anthropic/models/beta/beta_managed_agents_agent.rb +60 -2
  57. data/lib/anthropic/models/beta/beta_managed_agents_agent_params.rb +3 -3
  58. data/lib/anthropic/models/beta/beta_managed_agents_agent_tool_config.rb +20 -0
  59. data/lib/anthropic/models/beta/beta_managed_agents_agent_tool_config_params.rb +22 -2
  60. data/lib/anthropic/models/beta/beta_managed_agents_agent_toolset20260401_bash_input.rb +4 -4
  61. data/lib/anthropic/models/beta/beta_managed_agents_agent_toolset20260401_edit_input.rb +3 -3
  62. data/lib/anthropic/models/beta/beta_managed_agents_agent_toolset20260401_glob_input.rb +3 -3
  63. data/lib/anthropic/models/beta/beta_managed_agents_agent_toolset20260401_grep_input.rb +3 -3
  64. data/lib/anthropic/models/beta/beta_managed_agents_agent_toolset20260401_read_input.rb +3 -3
  65. data/lib/anthropic/models/beta/beta_managed_agents_agent_toolset_default_config.rb +20 -0
  66. data/lib/anthropic/models/beta/beta_managed_agents_agent_toolset_default_config_params.rb +22 -2
  67. data/lib/anthropic/models/beta/beta_managed_agents_agent_with_overrides_params.rb +45 -7
  68. data/lib/anthropic/models/beta/beta_managed_agents_cron_schedule.rb +2 -2
  69. data/lib/anthropic/models/beta/beta_managed_agents_cron_schedule_params.rb +3 -3
  70. data/lib/anthropic/models/beta/beta_managed_agents_custom_tool_params.rb +3 -3
  71. data/lib/anthropic/models/beta/beta_managed_agents_deleted_memory_store.rb +2 -2
  72. data/lib/anthropic/models/beta/beta_managed_agents_delta_event.rb +3 -3
  73. data/lib/anthropic/models/beta/beta_managed_agents_deployment.rb +3 -3
  74. data/lib/anthropic/models/beta/beta_managed_agents_deployment_initial_event.rb +30 -0
  75. data/lib/anthropic/models/beta/beta_managed_agents_deployment_initial_event_params.rb +30 -0
  76. data/lib/anthropic/models/beta/beta_managed_agents_deployment_paused_reason.rb +22 -0
  77. data/lib/anthropic/models/beta/beta_managed_agents_deployment_paused_reason_error.rb +44 -0
  78. data/lib/anthropic/models/beta/beta_managed_agents_deployment_run.rb +53 -3
  79. data/lib/anthropic/models/beta/beta_managed_agents_deployment_user_define_outcome_event.rb +24 -0
  80. data/lib/anthropic/models/beta/beta_managed_agents_deployment_user_message_event.rb +32 -0
  81. data/lib/anthropic/models/beta/beta_managed_agents_github_repository_resource_config.rb +24 -0
  82. data/lib/anthropic/models/beta/beta_managed_agents_github_repository_resource_params.rb +24 -0
  83. data/lib/anthropic/models/beta/beta_managed_agents_mcp_tool_config.rb +20 -0
  84. data/lib/anthropic/models/beta/beta_managed_agents_mcp_tool_config_params.rb +20 -0
  85. data/lib/anthropic/models/beta/beta_managed_agents_mcp_toolset_default_config.rb +20 -0
  86. data/lib/anthropic/models/beta/beta_managed_agents_mcp_toolset_default_config_params.rb +20 -0
  87. data/lib/anthropic/models/beta/beta_managed_agents_mcp_toolset_params.rb +2 -2
  88. data/lib/anthropic/models/beta/beta_managed_agents_memory_store.rb +3 -3
  89. data/lib/anthropic/models/beta/beta_managed_agents_memory_store_resource_config.rb +2 -2
  90. data/lib/anthropic/models/beta/beta_managed_agents_memory_store_resource_param.rb +2 -2
  91. data/lib/anthropic/models/beta/beta_managed_agents_model_config.rb +28 -2
  92. data/lib/anthropic/models/beta/beta_managed_agents_model_config_params.rb +2 -2
  93. data/lib/anthropic/models/beta/beta_managed_agents_multiagent.rb +28 -2
  94. data/lib/anthropic/models/beta/beta_managed_agents_multiagent_coordinator.rb +28 -2
  95. data/lib/anthropic/models/beta/beta_managed_agents_multiagent_coordinator_params.rb +3 -3
  96. data/lib/anthropic/models/beta/beta_managed_agents_multiagent_params.rb +3 -3
  97. data/lib/anthropic/models/beta/beta_managed_agents_outcome_evaluation_resource.rb +2 -2
  98. data/lib/anthropic/models/beta/beta_managed_agents_schedule.rb +2 -2
  99. data/lib/anthropic/models/beta/beta_managed_agents_schedule_params.rb +3 -3
  100. data/lib/anthropic/models/beta/beta_managed_agents_session.rb +2 -2
  101. data/lib/anthropic/models/beta/beta_managed_agents_session_agent.rb +61 -3
  102. data/lib/anthropic/models/beta/beta_managed_agents_session_agent_update.rb +41 -3
  103. data/lib/anthropic/models/beta/beta_managed_agents_session_multiagent_coordinator.rb +38 -0
  104. data/lib/anthropic/models/beta/beta_managed_agents_session_resource_config.rb +41 -0
  105. data/lib/anthropic/models/beta/beta_managed_agents_session_stats.rb +2 -2
  106. data/lib/anthropic/models/beta/beta_managed_agents_session_thread_agent.rb +58 -0
  107. data/lib/anthropic/models/beta/beta_managed_agents_session_updated_event.rb +4 -4
  108. data/lib/anthropic/models/beta/beta_managed_agents_session_usage.rb +2 -2
  109. data/lib/anthropic/models/beta/beta_managed_agents_session_usage_event.rb +2 -2
  110. data/lib/anthropic/models/beta/beta_managed_agents_skill_params.rb +24 -0
  111. data/lib/anthropic/models/beta/beta_managed_agents_start_event.rb +3 -3
  112. data/lib/anthropic/models/beta/beta_managed_agents_start_event_preview.rb +25 -0
  113. data/lib/anthropic/models/beta/beta_managed_agents_trigger_context.rb +22 -0
  114. data/lib/anthropic/models/beta/beta_managed_agents_url_mcp_server_params.rb +2 -2
  115. data/lib/anthropic/models/beta/beta_managed_agents_user_tool_result_event.rb +40 -4
  116. data/lib/anthropic/models/beta/beta_memory_tool_20250818_command.rb +46 -0
  117. data/lib/anthropic/models/beta/beta_message_iteration_usage.rb +2 -2
  118. data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
  119. data/lib/anthropic/models/beta/beta_output_behavior.rb +49 -0
  120. data/lib/anthropic/models/beta/beta_output_behavior_create_new.rb +33 -0
  121. data/lib/anthropic/models/beta/beta_output_behavior_update_existing.rb +39 -0
  122. data/lib/anthropic/models/beta/beta_raw_content_block_delta.rb +47 -0
  123. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +90 -0
  124. data/lib/anthropic/models/beta/beta_raw_message_stream_event.rb +43 -0
  125. data/lib/anthropic/models/beta/beta_refusal_stop_details.rb +2 -2
  126. data/lib/anthropic/models/beta/beta_request_document_block.rb +36 -0
  127. data/lib/anthropic/models/beta/beta_request_tool_addition_block.rb +29 -3
  128. data/lib/anthropic/models/beta/beta_request_tool_removal_block.rb +29 -3
  129. data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +24 -0
  130. data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +24 -0
  131. data/lib/anthropic/models/beta/beta_text_citation.rb +59 -0
  132. data/lib/anthropic/models/beta/beta_text_citation_param.rb +57 -0
  133. data/lib/anthropic/models/beta/beta_thinking_config_param.rb +29 -0
  134. data/lib/anthropic/models/beta/beta_token_task_budget.rb +2 -2
  135. data/lib/anthropic/models/beta/beta_tool_choice.rb +31 -0
  136. data/lib/anthropic/models/beta/beta_tool_choice_any.rb +2 -2
  137. data/lib/anthropic/models/beta/beta_tool_choice_auto.rb +2 -2
  138. data/lib/anthropic/models/beta/beta_tool_choice_tool.rb +2 -2
  139. data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +42 -0
  140. data/lib/anthropic/models/beta/beta_tool_use_block.rb +24 -0
  141. data/lib/anthropic/models/beta/beta_tool_use_block_param.rb +24 -0
  142. data/lib/anthropic/models/beta/beta_tunnel.rb +2 -2
  143. data/lib/anthropic/models/beta/beta_tunnel_token.rb +2 -2
  144. data/lib/anthropic/models/beta/beta_user_profile.rb +56 -26
  145. data/lib/anthropic/models/beta/beta_web_fetch_tool_20260309.rb +2 -2
  146. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block.rb +24 -0
  147. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rb +24 -0
  148. data/lib/anthropic/models/beta/beta_web_search_tool_result_block.rb +24 -0
  149. data/lib/anthropic/models/beta/beta_web_search_tool_result_block_param.rb +24 -0
  150. data/lib/anthropic/models/beta/beta_webhook_event_data.rb +114 -0
  151. data/lib/anthropic/models/beta/deployment_create_params.rb +42 -0
  152. data/lib/anthropic/models/beta/deployment_update_params.rb +42 -0
  153. data/lib/anthropic/models/beta/dream_create_params.rb +14 -1
  154. data/lib/anthropic/models/beta/environment_create_params.rb +27 -0
  155. data/lib/anthropic/models/beta/environment_update_params.rb +30 -2
  156. data/lib/anthropic/models/beta/environments/beta_self_hosted_work.rb +3 -3
  157. data/lib/anthropic/models/beta/environments/beta_self_hosted_work_queue_stats.rb +4 -4
  158. data/lib/anthropic/models/beta/environments/beta_self_hosted_work_update_request.rb +2 -2
  159. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_actor.rb +40 -1
  160. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_api_actor.rb +3 -3
  161. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_content_sha256_precondition.rb +4 -4
  162. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_error.rb +46 -0
  163. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory.rb +4 -4
  164. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_list_item.rb +42 -0
  165. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_prefix.rb +4 -4
  166. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version.rb +8 -8
  167. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_precondition.rb +4 -4
  168. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_service_account_actor.rb +30 -0
  169. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_session_actor.rb +3 -3
  170. data/lib/anthropic/models/beta/memory_stores/memory_version_list_params.rb +9 -1
  171. data/lib/anthropic/models/beta/messages/batch_create_params.rb +4 -4
  172. data/lib/anthropic/models/beta/messages/beta_message_batch_individual_response.rb +3 -3
  173. data/lib/anthropic/models/beta/messages/beta_message_batch_result.rb +28 -0
  174. data/lib/anthropic/models/beta/session_create_params.rb +70 -0
  175. data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_custom_tool_use_event.rb +3 -3
  176. data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_mcp_tool_result_event.rb +36 -0
  177. data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_mcp_tool_use_event.rb +2 -2
  178. data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_message_event.rb +22 -0
  179. data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_received_event.rb +35 -3
  180. data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_sent_event.rb +35 -3
  181. data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_result_event.rb +36 -0
  182. data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_use_event.rb +2 -2
  183. data/lib/anthropic/models/beta/sessions/beta_managed_agents_base64_image_source.rb +2 -2
  184. data/lib/anthropic/models/beta/sessions/beta_managed_agents_billing_error.rb +22 -0
  185. data/lib/anthropic/models/beta/sessions/beta_managed_agents_credential_host_unreachable_error.rb +22 -0
  186. data/lib/anthropic/models/beta/sessions/beta_managed_agents_document_block.rb +32 -0
  187. data/lib/anthropic/models/beta/sessions/beta_managed_agents_event_params.rb +54 -0
  188. data/lib/anthropic/models/beta/sessions/beta_managed_agents_github_repository_resource.rb +24 -0
  189. data/lib/anthropic/models/beta/sessions/beta_managed_agents_image_block.rb +34 -0
  190. data/lib/anthropic/models/beta/sessions/beta_managed_agents_mcp_authentication_failed_error.rb +22 -0
  191. data/lib/anthropic/models/beta/sessions/beta_managed_agents_mcp_connection_failed_error.rb +22 -0
  192. data/lib/anthropic/models/beta/sessions/beta_managed_agents_memory_store_resource.rb +2 -2
  193. data/lib/anthropic/models/beta/sessions/beta_managed_agents_model_overloaded_error.rb +22 -0
  194. data/lib/anthropic/models/beta/sessions/beta_managed_agents_model_rate_limited_error.rb +22 -0
  195. data/lib/anthropic/models/beta/sessions/beta_managed_agents_model_request_failed_error.rb +22 -0
  196. data/lib/anthropic/models/beta/sessions/beta_managed_agents_send_session_events.rb +60 -0
  197. data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_error_event.rb +44 -2
  198. data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_event.rb +160 -0
  199. data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_requires_action.rb +4 -4
  200. data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_resource.rb +51 -0
  201. data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_status_idle_event.rb +30 -0
  202. data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread.rb +38 -0
  203. data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_stats.rb +2 -2
  204. data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_idle_event.rb +30 -0
  205. data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_usage.rb +2 -2
  206. data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_usage_snapshot.rb +2 -2
  207. data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_model_usage.rb +2 -2
  208. data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_end_event.rb +4 -4
  209. data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_ongoing_event.rb +4 -4
  210. data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_start_event.rb +2 -2
  211. data/lib/anthropic/models/beta/sessions/beta_managed_agents_stream_session_events.rb +170 -0
  212. data/lib/anthropic/models/beta/sessions/beta_managed_agents_stream_session_thread_events.rb +170 -0
  213. data/lib/anthropic/models/beta/sessions/beta_managed_agents_text_rubric_params.rb +2 -2
  214. data/lib/anthropic/models/beta/sessions/beta_managed_agents_unknown_error.rb +22 -0
  215. data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event.rb +38 -2
  216. data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event_params.rb +38 -2
  217. data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event.rb +27 -3
  218. data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event_params.rb +28 -0
  219. data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_interrupt_event.rb +2 -2
  220. data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_interrupt_event_params.rb +2 -2
  221. data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_message_event.rb +32 -0
  222. data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_message_event_params.rb +32 -0
  223. data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_tool_confirmation_event.rb +2 -2
  224. data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_tool_confirmation_event_params.rb +2 -2
  225. data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_tool_result_event_params.rb +40 -4
  226. data/lib/anthropic/models/beta/sessions/resource_retrieve_response.rb +50 -0
  227. data/lib/anthropic/models/beta/sessions/resource_update_response.rb +50 -0
  228. data/lib/anthropic/models/beta/user_profile_create_params.rb +32 -4
  229. data/lib/anthropic/models/beta/user_profile_update_params.rb +28 -1
  230. data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential.rb +34 -0
  231. data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential_networking_params.rb +26 -0
  232. data/lib/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_auth_response.rb +26 -0
  233. data/lib/anthropic/models/beta/vaults/beta_managed_agents_limited_credential_networking_params.rb +2 -2
  234. data/lib/anthropic/models/beta/vaults/beta_managed_agents_limited_credential_networking_response.rb +2 -2
  235. data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_params.rb +24 -0
  236. data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_response.rb +22 -0
  237. data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_update_params.rb +22 -0
  238. data/lib/anthropic/models/beta/vaults/credential_create_params.rb +40 -0
  239. data/lib/anthropic/models/beta/vaults/credential_update_params.rb +36 -0
  240. data/lib/anthropic/models/beta_error.rb +36 -0
  241. data/lib/anthropic/models/beta_monetary_amount.rb +2 -2
  242. data/lib/anthropic/models/citations_delta.rb +59 -0
  243. data/lib/anthropic/models/code_execution_tool_20260120.rb +3 -3
  244. data/lib/anthropic/models/code_execution_tool_20260521.rb +2 -2
  245. data/lib/anthropic/models/content_block.rb +67 -0
  246. data/lib/anthropic/models/content_block_param.rb +86 -7
  247. data/lib/anthropic/models/content_block_source_content.rb +28 -0
  248. data/lib/anthropic/models/document_block.rb +24 -0
  249. data/lib/anthropic/models/document_block_param.rb +32 -0
  250. data/lib/anthropic/models/error_object.rb +36 -0
  251. data/lib/anthropic/models/image_block_param.rb +26 -0
  252. data/lib/anthropic/models/message_param.rb +3 -3
  253. data/lib/anthropic/models/messages/batch_create_params.rb +4 -4
  254. data/lib/anthropic/models/messages/message_batch_individual_response.rb +3 -3
  255. data/lib/anthropic/models/messages/message_batch_result.rb +28 -0
  256. data/lib/anthropic/models/raw_content_block_delta.rb +39 -0
  257. data/lib/anthropic/models/raw_content_block_start_event.rb +67 -0
  258. data/lib/anthropic/models/raw_message_stream_event.rb +41 -0
  259. data/lib/anthropic/models/refusal_stop_details.rb +2 -2
  260. data/lib/anthropic/models/server_tool_use_block.rb +24 -0
  261. data/lib/anthropic/models/server_tool_use_block_param.rb +24 -0
  262. data/lib/anthropic/models/text_citation.rb +59 -0
  263. data/lib/anthropic/models/text_citation_param.rb +57 -0
  264. data/lib/anthropic/models/thinking_config_param.rb +29 -0
  265. data/lib/anthropic/models/tool_choice.rb +31 -0
  266. data/lib/anthropic/models/tool_choice_any.rb +2 -2
  267. data/lib/anthropic/models/tool_choice_auto.rb +2 -2
  268. data/lib/anthropic/models/tool_choice_tool.rb +2 -2
  269. data/lib/anthropic/models/tool_result_block_param.rb +42 -0
  270. data/lib/anthropic/models/tool_use_block.rb +24 -0
  271. data/lib/anthropic/models/tool_use_block_param.rb +24 -0
  272. data/lib/anthropic/models/web_fetch_tool_20260309.rb +2 -2
  273. data/lib/anthropic/models/web_fetch_tool_result_block.rb +24 -0
  274. data/lib/anthropic/models/web_fetch_tool_result_block_param.rb +24 -0
  275. data/lib/anthropic/models/web_search_tool_result_block.rb +24 -0
  276. data/lib/anthropic/models/web_search_tool_result_block_param.rb +24 -0
  277. data/lib/anthropic/models.rb +0 -2
  278. data/lib/anthropic/resources/beta/agents.rb +6 -6
  279. data/lib/anthropic/resources/beta/deployment_runs.rb +2 -2
  280. data/lib/anthropic/resources/beta/deployments.rb +6 -6
  281. data/lib/anthropic/resources/beta/dreams.rb +8 -3
  282. data/lib/anthropic/resources/beta/environments/work.rb +9 -9
  283. data/lib/anthropic/resources/beta/environments.rb +7 -7
  284. data/lib/anthropic/resources/beta/files.rb +2 -2
  285. data/lib/anthropic/resources/beta/memory_stores/memories.rb +6 -6
  286. data/lib/anthropic/resources/beta/memory_stores/memory_versions.rb +4 -1
  287. data/lib/anthropic/resources/beta/memory_stores.rb +6 -6
  288. data/lib/anthropic/resources/beta/messages/batches.rb +6 -6
  289. data/lib/anthropic/resources/beta/messages.rb +9 -9
  290. data/lib/anthropic/resources/beta/models.rb +3 -3
  291. data/lib/anthropic/resources/beta/sessions/events.rb +4 -4
  292. data/lib/anthropic/resources/beta/sessions/resources.rb +6 -6
  293. data/lib/anthropic/resources/beta/sessions/threads/events.rb +2 -2
  294. data/lib/anthropic/resources/beta/sessions/threads.rb +2 -2
  295. data/lib/anthropic/resources/beta/sessions.rb +6 -6
  296. data/lib/anthropic/resources/beta/skills/versions.rb +10 -10
  297. data/lib/anthropic/resources/beta/skills.rb +8 -8
  298. data/lib/anthropic/resources/beta/tunnels/certificates.rb +6 -6
  299. data/lib/anthropic/resources/beta/tunnels.rb +3 -3
  300. data/lib/anthropic/resources/beta/user_profiles.rb +15 -11
  301. data/lib/anthropic/resources/beta/vaults/credentials.rb +6 -6
  302. data/lib/anthropic/resources/beta/vaults.rb +6 -6
  303. data/lib/anthropic/resources/completions.rb +6 -6
  304. data/lib/anthropic/resources/messages/batches.rb +6 -6
  305. data/lib/anthropic/resources/messages.rb +9 -9
  306. data/lib/anthropic/resources/models.rb +3 -3
  307. data/lib/anthropic/version.rb +1 -1
  308. data/lib/anthropic.rb +4 -2
  309. data/rbi/anthropic/client.rbi +5 -0
  310. data/rbi/anthropic/errors.rbi +8 -0
  311. data/rbi/anthropic/helpers/bedrock/client.rbi +4 -0
  312. data/rbi/anthropic/helpers/google_cloud/client.rbi +5 -9
  313. data/rbi/anthropic/helpers/tools/base_tool.rbi +17 -0
  314. data/rbi/anthropic/helpers/vertex/client.rbi +5 -0
  315. data/rbi/anthropic/internal/type/base_stream.rbi +8 -0
  316. data/rbi/anthropic/models/anthropic_beta.rbi +5 -0
  317. data/rbi/anthropic/models/beta/agent_create_params.rbi +53 -3
  318. data/rbi/anthropic/models/beta/agent_update_params.rbi +53 -3
  319. data/rbi/anthropic/models/beta/beta_citations_delta.rbi +60 -0
  320. data/rbi/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rbi +10 -0
  321. data/rbi/anthropic/models/beta/beta_cloud_config.rbi +23 -0
  322. data/rbi/anthropic/models/beta/beta_cloud_config_params.rbi +25 -0
  323. data/rbi/anthropic/models/beta/beta_content_block.rbi +142 -0
  324. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +163 -1
  325. data/rbi/anthropic/models/beta/beta_content_block_source_content.rbi +38 -0
  326. data/rbi/anthropic/models/beta/beta_context_management_config.rbi +55 -0
  327. data/rbi/anthropic/models/beta/beta_context_management_response.rbi +23 -0
  328. data/rbi/anthropic/models/beta/beta_diagnostics.rbi +18 -0
  329. data/rbi/anthropic/models/beta/beta_document_block.rbi +12 -0
  330. data/rbi/anthropic/models/beta/beta_dream.rbi +20 -3
  331. data/rbi/anthropic/models/beta/beta_dream_input.rbi +15 -1
  332. data/rbi/anthropic/models/beta/beta_dream_memory_store_input.rbi +3 -1
  333. data/rbi/anthropic/models/beta/beta_dream_model_config.rbi +2 -2
  334. data/rbi/anthropic/models/beta/beta_dream_model_config_param.rbi +2 -2
  335. data/rbi/anthropic/models/beta/beta_environment.rbi +27 -5
  336. data/rbi/anthropic/models/beta/beta_fallback_credit_usage.rbi +30 -0
  337. data/rbi/anthropic/models/beta/beta_fallback_param.rbi +37 -0
  338. data/rbi/anthropic/models/beta/beta_image_block_param.rbi +21 -0
  339. data/rbi/anthropic/models/beta/beta_iterations_usage.rbi +34 -0
  340. data/rbi/anthropic/models/beta/beta_managed_agents_agent.rbi +51 -0
  341. data/rbi/anthropic/models/beta/beta_managed_agents_agent_tool_config.rbi +10 -0
  342. data/rbi/anthropic/models/beta/beta_managed_agents_agent_tool_config_params.rbi +10 -0
  343. data/rbi/anthropic/models/beta/beta_managed_agents_agent_toolset_default_config.rbi +10 -0
  344. data/rbi/anthropic/models/beta/beta_managed_agents_agent_toolset_default_config_params.rbi +10 -0
  345. data/rbi/anthropic/models/beta/beta_managed_agents_agent_with_overrides_params.rbi +55 -3
  346. data/rbi/anthropic/models/beta/beta_managed_agents_deployment_initial_event.rbi +43 -0
  347. data/rbi/anthropic/models/beta/beta_managed_agents_deployment_initial_event_params.rbi +43 -0
  348. data/rbi/anthropic/models/beta/beta_managed_agents_deployment_paused_reason.rbi +33 -0
  349. data/rbi/anthropic/models/beta/beta_managed_agents_deployment_paused_reason_error.rbi +10 -0
  350. data/rbi/anthropic/models/beta/beta_managed_agents_deployment_run.rbi +14 -0
  351. data/rbi/anthropic/models/beta/beta_managed_agents_deployment_user_define_outcome_event.rbi +20 -0
  352. data/rbi/anthropic/models/beta/beta_managed_agents_deployment_user_message_event.rbi +39 -0
  353. data/rbi/anthropic/models/beta/beta_managed_agents_github_repository_resource_config.rbi +20 -0
  354. data/rbi/anthropic/models/beta/beta_managed_agents_github_repository_resource_params.rbi +20 -0
  355. data/rbi/anthropic/models/beta/beta_managed_agents_mcp_tool_config.rbi +10 -0
  356. data/rbi/anthropic/models/beta/beta_managed_agents_mcp_tool_config_params.rbi +10 -0
  357. data/rbi/anthropic/models/beta/beta_managed_agents_mcp_toolset_default_config.rbi +10 -0
  358. data/rbi/anthropic/models/beta/beta_managed_agents_mcp_toolset_default_config_params.rbi +10 -0
  359. data/rbi/anthropic/models/beta/beta_managed_agents_model_config.rbi +10 -0
  360. data/rbi/anthropic/models/beta/beta_managed_agents_multiagent.rbi +21 -0
  361. data/rbi/anthropic/models/beta/beta_managed_agents_multiagent_coordinator.rbi +21 -0
  362. data/rbi/anthropic/models/beta/beta_managed_agents_session_agent.rbi +55 -0
  363. data/rbi/anthropic/models/beta/beta_managed_agents_session_agent_update.rbi +52 -0
  364. data/rbi/anthropic/models/beta/beta_managed_agents_session_multiagent_coordinator.rbi +53 -0
  365. data/rbi/anthropic/models/beta/beta_managed_agents_session_resource_config.rbi +46 -0
  366. data/rbi/anthropic/models/beta/beta_managed_agents_session_thread_agent.rbi +55 -0
  367. data/rbi/anthropic/models/beta/beta_managed_agents_skill_params.rbi +18 -0
  368. data/rbi/anthropic/models/beta/beta_managed_agents_start_event_preview.rbi +15 -0
  369. data/rbi/anthropic/models/beta/beta_managed_agents_trigger_context.rbi +14 -0
  370. data/rbi/anthropic/models/beta/beta_managed_agents_user_tool_result_event.rbi +50 -0
  371. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_command.rbi +39 -0
  372. data/rbi/anthropic/models/beta/beta_output_behavior.rbi +42 -0
  373. data/rbi/anthropic/models/beta/beta_output_behavior_create_new.rbi +71 -0
  374. data/rbi/anthropic/models/beta/beta_output_behavior_update_existing.rbi +83 -0
  375. data/rbi/anthropic/models/beta/beta_raw_content_block_delta.rbi +50 -0
  376. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +144 -0
  377. data/rbi/anthropic/models/beta/beta_raw_message_stream_event.rbi +72 -0
  378. data/rbi/anthropic/models/beta/beta_request_document_block.rbi +25 -0
  379. data/rbi/anthropic/models/beta/beta_request_tool_addition_block.rbi +14 -0
  380. data/rbi/anthropic/models/beta/beta_request_tool_removal_block.rbi +14 -0
  381. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +10 -0
  382. data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +10 -0
  383. data/rbi/anthropic/models/beta/beta_text_citation.rbi +60 -0
  384. data/rbi/anthropic/models/beta/beta_text_citation_param.rbi +58 -0
  385. data/rbi/anthropic/models/beta/beta_thinking_config_param.rbi +37 -0
  386. data/rbi/anthropic/models/beta/beta_tool_choice.rbi +21 -0
  387. data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +62 -0
  388. data/rbi/anthropic/models/beta/beta_tool_use_block.rbi +10 -0
  389. data/rbi/anthropic/models/beta/beta_tool_use_block_param.rbi +10 -0
  390. data/rbi/anthropic/models/beta/beta_user_profile.rbi +125 -45
  391. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block.rbi +10 -0
  392. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbi +10 -0
  393. data/rbi/anthropic/models/beta/beta_web_search_tool_result_block.rbi +10 -0
  394. data/rbi/anthropic/models/beta/beta_web_search_tool_result_block_param.rbi +10 -0
  395. data/rbi/anthropic/models/beta/beta_webhook_event_data.rbi +25 -0
  396. data/rbi/anthropic/models/beta/deployment_create_params.rbi +49 -0
  397. data/rbi/anthropic/models/beta/deployment_update_params.rbi +49 -0
  398. data/rbi/anthropic/models/beta/dream_create_params.rbi +40 -0
  399. data/rbi/anthropic/models/beta/environment_create_params.rbi +30 -0
  400. data/rbi/anthropic/models/beta/environment_update_params.rbi +34 -2
  401. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_actor.rbi +31 -1
  402. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_error.rbi +20 -0
  403. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_list_item.rbi +53 -0
  404. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version.rbi +8 -4
  405. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_service_account_actor.rbi +44 -0
  406. data/rbi/anthropic/models/beta/memory_stores/memory_version_list_params.rbi +11 -0
  407. data/rbi/anthropic/models/beta/messages/beta_message_batch_result.rbi +14 -0
  408. data/rbi/anthropic/models/beta/session_create_params.rbi +85 -0
  409. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_mcp_tool_result_event.rbi +50 -0
  410. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_message_event.rbi +14 -0
  411. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_received_event.rbi +39 -0
  412. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_sent_event.rbi +39 -0
  413. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_result_event.rbi +50 -0
  414. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_billing_error.rbi +10 -0
  415. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_credential_host_unreachable_error.rbi +10 -0
  416. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_document_block.rbi +30 -0
  417. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_event_params.rbi +79 -0
  418. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_github_repository_resource.rbi +20 -0
  419. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_image_block.rbi +27 -0
  420. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_mcp_authentication_failed_error.rbi +10 -0
  421. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_mcp_connection_failed_error.rbi +10 -0
  422. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_model_overloaded_error.rbi +10 -0
  423. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_model_rate_limited_error.rbi +10 -0
  424. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_model_request_failed_error.rbi +10 -0
  425. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_send_session_events.rbi +89 -0
  426. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_error_event.rbi +34 -0
  427. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_event.rbi +203 -0
  428. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_resource.rbi +60 -0
  429. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_status_idle_event.rbi +18 -0
  430. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread.rbi +53 -0
  431. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_idle_event.rbi +18 -0
  432. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_stream_session_events.rbi +222 -0
  433. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_stream_session_thread_events.rbi +222 -0
  434. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_unknown_error.rbi +10 -0
  435. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event.rbi +50 -0
  436. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event_params.rbi +50 -0
  437. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event.rbi +20 -0
  438. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event_params.rbi +21 -0
  439. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_message_event.rbi +39 -0
  440. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_message_event_params.rbi +39 -0
  441. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_tool_result_event_params.rbi +50 -0
  442. data/rbi/anthropic/models/beta/sessions/resource_retrieve_response.rbi +60 -0
  443. data/rbi/anthropic/models/beta/sessions/resource_update_response.rbi +60 -0
  444. data/rbi/anthropic/models/beta/user_profile_create_params.rbi +77 -4
  445. data/rbi/anthropic/models/beta/user_profile_update_params.rbi +67 -0
  446. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential.rbi +40 -0
  447. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential_networking_params.rbi +20 -0
  448. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_auth_response.rbi +19 -0
  449. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_params.rbi +17 -0
  450. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_response.rbi +10 -0
  451. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_update_params.rbi +17 -0
  452. data/rbi/anthropic/models/beta/vaults/credential_create_params.rbi +49 -0
  453. data/rbi/anthropic/models/beta/vaults/credential_update_params.rbi +45 -0
  454. data/rbi/anthropic/models/beta_error.rbi +10 -0
  455. data/rbi/anthropic/models/citations_delta.rbi +60 -0
  456. data/rbi/anthropic/models/content_block.rbi +109 -0
  457. data/rbi/anthropic/models/content_block_param.rbi +123 -2
  458. data/rbi/anthropic/models/content_block_source_content.rbi +36 -0
  459. data/rbi/anthropic/models/document_block.rbi +12 -0
  460. data/rbi/anthropic/models/document_block_param.rbi +14 -0
  461. data/rbi/anthropic/models/error_object.rbi +10 -0
  462. data/rbi/anthropic/models/image_block_param.rbi +13 -0
  463. data/rbi/anthropic/models/messages/message_batch_result.rbi +12 -0
  464. data/rbi/anthropic/models/raw_content_block_delta.rbi +35 -0
  465. data/rbi/anthropic/models/raw_content_block_start_event.rbi +111 -0
  466. data/rbi/anthropic/models/raw_message_stream_event.rbi +62 -0
  467. data/rbi/anthropic/models/server_tool_use_block.rbi +10 -0
  468. data/rbi/anthropic/models/server_tool_use_block_param.rbi +10 -0
  469. data/rbi/anthropic/models/text_citation.rbi +60 -0
  470. data/rbi/anthropic/models/text_citation_param.rbi +58 -0
  471. data/rbi/anthropic/models/thinking_config_param.rbi +33 -0
  472. data/rbi/anthropic/models/tool_choice.rbi +21 -0
  473. data/rbi/anthropic/models/tool_result_block_param.rbi +60 -0
  474. data/rbi/anthropic/models/tool_use_block.rbi +10 -0
  475. data/rbi/anthropic/models/tool_use_block_param.rbi +10 -0
  476. data/rbi/anthropic/models/web_fetch_tool_result_block.rbi +10 -0
  477. data/rbi/anthropic/models/web_fetch_tool_result_block_param.rbi +10 -0
  478. data/rbi/anthropic/models/web_search_tool_result_block.rbi +10 -0
  479. data/rbi/anthropic/models/web_search_tool_result_block_param.rbi +10 -0
  480. data/rbi/anthropic/models.rbi +0 -3
  481. data/rbi/anthropic/resources/beta/agents.rbi +2 -2
  482. data/rbi/anthropic/resources/beta/dreams.rbi +9 -0
  483. data/rbi/anthropic/resources/beta/environments.rbi +2 -1
  484. data/rbi/anthropic/resources/beta/memory_stores/memory_versions.rbi +3 -0
  485. data/rbi/anthropic/resources/beta/user_profiles.rbi +22 -3
  486. data/sig/anthropic/client.rbs +1 -0
  487. data/sig/anthropic/errors.rbs +4 -0
  488. data/sig/anthropic/helpers/bedrock/client.rbs +2 -0
  489. data/sig/anthropic/helpers/google_cloud/client.rbs +2 -6
  490. data/sig/anthropic/helpers/vertex/client.rbs +2 -0
  491. data/sig/anthropic/internal/type/base_stream.rbs +4 -0
  492. data/sig/anthropic/models/anthropic_beta.rbs +2 -0
  493. data/sig/anthropic/models/beta/agent_create_params.rbs +30 -0
  494. data/sig/anthropic/models/beta/agent_update_params.rbs +30 -0
  495. data/sig/anthropic/models/beta/beta_citations_delta.rbs +63 -0
  496. data/sig/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rbs +14 -0
  497. data/sig/anthropic/models/beta/beta_cloud_config.rbs +17 -0
  498. data/sig/anthropic/models/beta/beta_cloud_config_params.rbs +17 -0
  499. data/sig/anthropic/models/beta/beta_content_block.rbs +130 -0
  500. data/sig/anthropic/models/beta/beta_content_block_param.rbs +194 -1
  501. data/sig/anthropic/models/beta/beta_content_block_source_content.rbs +20 -0
  502. data/sig/anthropic/models/beta/beta_context_management_config.rbs +32 -0
  503. data/sig/anthropic/models/beta/beta_context_management_response.rbs +18 -0
  504. data/sig/anthropic/models/beta/beta_diagnostics.rbs +28 -0
  505. data/sig/anthropic/models/beta/beta_document_block.rbs +17 -0
  506. data/sig/anthropic/models/beta/beta_dream.rbs +5 -0
  507. data/sig/anthropic/models/beta/beta_dream_input.rbs +15 -0
  508. data/sig/anthropic/models/beta/beta_environment.rbs +19 -4
  509. data/sig/anthropic/models/beta/beta_fallback_credit_usage.rbs +15 -0
  510. data/sig/anthropic/models/beta/beta_fallback_param.rbs +20 -0
  511. data/sig/anthropic/models/beta/beta_image_block_param.rbs +22 -0
  512. data/sig/anthropic/models/beta/beta_iterations_usage.rbs +46 -0
  513. data/sig/anthropic/models/beta/beta_managed_agents_agent.rbs +47 -0
  514. data/sig/anthropic/models/beta/beta_managed_agents_agent_tool_config.rbs +11 -0
  515. data/sig/anthropic/models/beta/beta_managed_agents_agent_tool_config_params.rbs +11 -0
  516. data/sig/anthropic/models/beta/beta_managed_agents_agent_toolset_default_config.rbs +11 -0
  517. data/sig/anthropic/models/beta/beta_managed_agents_agent_toolset_default_config_params.rbs +11 -0
  518. data/sig/anthropic/models/beta/beta_managed_agents_agent_with_overrides_params.rbs +30 -0
  519. data/sig/anthropic/models/beta/beta_managed_agents_deployment_initial_event.rbs +24 -0
  520. data/sig/anthropic/models/beta/beta_managed_agents_deployment_initial_event_params.rbs +24 -0
  521. data/sig/anthropic/models/beta/beta_managed_agents_deployment_paused_reason.rbs +13 -0
  522. data/sig/anthropic/models/beta/beta_managed_agents_deployment_paused_reason_error.rbs +49 -0
  523. data/sig/anthropic/models/beta/beta_managed_agents_deployment_run.rbs +76 -0
  524. data/sig/anthropic/models/beta/beta_managed_agents_deployment_user_define_outcome_event.rbs +15 -0
  525. data/sig/anthropic/models/beta/beta_managed_agents_deployment_user_message_event.rbs +27 -0
  526. data/sig/anthropic/models/beta/beta_managed_agents_github_repository_resource_config.rbs +15 -0
  527. data/sig/anthropic/models/beta/beta_managed_agents_github_repository_resource_params.rbs +15 -0
  528. data/sig/anthropic/models/beta/beta_managed_agents_mcp_tool_config.rbs +11 -0
  529. data/sig/anthropic/models/beta/beta_managed_agents_mcp_tool_config_params.rbs +11 -0
  530. data/sig/anthropic/models/beta/beta_managed_agents_mcp_toolset_default_config.rbs +11 -0
  531. data/sig/anthropic/models/beta/beta_managed_agents_mcp_toolset_default_config_params.rbs +11 -0
  532. data/sig/anthropic/models/beta/beta_managed_agents_model_config.rbs +18 -0
  533. data/sig/anthropic/models/beta/beta_managed_agents_multiagent.rbs +17 -0
  534. data/sig/anthropic/models/beta/beta_managed_agents_multiagent_coordinator.rbs +17 -0
  535. data/sig/anthropic/models/beta/beta_managed_agents_session_agent.rbs +47 -0
  536. data/sig/anthropic/models/beta/beta_managed_agents_session_agent_update.rbs +30 -0
  537. data/sig/anthropic/models/beta/beta_managed_agents_session_multiagent_coordinator.rbs +30 -0
  538. data/sig/anthropic/models/beta/beta_managed_agents_session_resource_config.rbs +29 -0
  539. data/sig/anthropic/models/beta/beta_managed_agents_session_thread_agent.rbs +47 -0
  540. data/sig/anthropic/models/beta/beta_managed_agents_skill_params.rbs +17 -0
  541. data/sig/anthropic/models/beta/beta_managed_agents_start_event_preview.rbs +14 -0
  542. data/sig/anthropic/models/beta/beta_managed_agents_trigger_context.rbs +13 -0
  543. data/sig/anthropic/models/beta/beta_managed_agents_user_tool_result_event.rbs +34 -0
  544. data/sig/anthropic/models/beta/beta_memory_tool_20250818_command.rbs +45 -0
  545. data/sig/anthropic/models/beta/beta_output_behavior.rbs +30 -0
  546. data/sig/anthropic/models/beta/beta_output_behavior_create_new.rbs +32 -0
  547. data/sig/anthropic/models/beta/beta_output_behavior_update_existing.rbs +39 -0
  548. data/sig/anthropic/models/beta/beta_raw_content_block_delta.rbs +39 -0
  549. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +130 -0
  550. data/sig/anthropic/models/beta/beta_raw_message_stream_event.rbs +39 -0
  551. data/sig/anthropic/models/beta/beta_request_document_block.rbs +32 -0
  552. data/sig/anthropic/models/beta/beta_request_tool_addition_block.rbs +20 -0
  553. data/sig/anthropic/models/beta/beta_request_tool_removal_block.rbs +20 -0
  554. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +15 -0
  555. data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +15 -0
  556. data/sig/anthropic/models/beta/beta_text_citation.rbs +63 -0
  557. data/sig/anthropic/models/beta/beta_text_citation_param.rbs +59 -0
  558. data/sig/anthropic/models/beta/beta_thinking_config_param.rbs +20 -0
  559. data/sig/anthropic/models/beta/beta_tool_choice.rbs +21 -0
  560. data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +49 -0
  561. data/sig/anthropic/models/beta/beta_tool_use_block.rbs +15 -0
  562. data/sig/anthropic/models/beta/beta_tool_use_block_param.rbs +15 -0
  563. data/sig/anthropic/models/beta/beta_user_profile.rbs +42 -18
  564. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block.rbs +15 -0
  565. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbs +15 -0
  566. data/sig/anthropic/models/beta/beta_web_search_tool_result_block.rbs +15 -0
  567. data/sig/anthropic/models/beta/beta_web_search_tool_result_block_param.rbs +15 -0
  568. data/sig/anthropic/models/beta/beta_webhook_event_data.rbs +283 -0
  569. data/sig/anthropic/models/beta/deployment_create_params.rbs +31 -0
  570. data/sig/anthropic/models/beta/deployment_update_params.rbs +31 -0
  571. data/sig/anthropic/models/beta/dream_create_params.rbs +9 -0
  572. data/sig/anthropic/models/beta/environment_create_params.rbs +15 -0
  573. data/sig/anthropic/models/beta/environment_update_params.rbs +15 -0
  574. data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_actor.rbs +26 -0
  575. data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_error.rbs +59 -0
  576. data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_memory_list_item.rbs +30 -0
  577. data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_service_account_actor.rbs +26 -0
  578. data/sig/anthropic/models/beta/memory_stores/memory_version_list_params.rbs +7 -0
  579. data/sig/anthropic/models/beta/messages/beta_message_batch_result.rbs +21 -0
  580. data/sig/anthropic/models/beta/session_create_params.rbs +50 -0
  581. data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_mcp_tool_result_event.rbs +34 -0
  582. data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_message_event.rbs +13 -0
  583. data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_received_event.rbs +27 -0
  584. data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_sent_event.rbs +27 -0
  585. data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_result_event.rbs +34 -0
  586. data/sig/anthropic/models/beta/sessions/beta_managed_agents_billing_error.rbs +14 -0
  587. data/sig/anthropic/models/beta/sessions/beta_managed_agents_credential_host_unreachable_error.rbs +14 -0
  588. data/sig/anthropic/models/beta/sessions/beta_managed_agents_document_block.rbs +28 -0
  589. data/sig/anthropic/models/beta/sessions/beta_managed_agents_event_params.rbs +54 -0
  590. data/sig/anthropic/models/beta/sessions/beta_managed_agents_github_repository_resource.rbs +15 -0
  591. data/sig/anthropic/models/beta/sessions/beta_managed_agents_image_block.rbs +22 -0
  592. data/sig/anthropic/models/beta/sessions/beta_managed_agents_mcp_authentication_failed_error.rbs +14 -0
  593. data/sig/anthropic/models/beta/sessions/beta_managed_agents_mcp_connection_failed_error.rbs +14 -0
  594. data/sig/anthropic/models/beta/sessions/beta_managed_agents_model_overloaded_error.rbs +14 -0
  595. data/sig/anthropic/models/beta/sessions/beta_managed_agents_model_rate_limited_error.rbs +14 -0
  596. data/sig/anthropic/models/beta/sessions/beta_managed_agents_model_request_failed_error.rbs +14 -0
  597. data/sig/anthropic/models/beta/sessions/beta_managed_agents_send_session_events.rbs +75 -0
  598. data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_error_event.rbs +65 -0
  599. data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_event.rbs +313 -0
  600. data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_resource.rbs +43 -0
  601. data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_status_idle_event.rbs +19 -0
  602. data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_thread.rbs +30 -0
  603. data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_idle_event.rbs +19 -0
  604. data/sig/anthropic/models/beta/sessions/beta_managed_agents_stream_session_events.rbs +325 -0
  605. data/sig/anthropic/models/beta/sessions/beta_managed_agents_stream_session_thread_events.rbs +325 -0
  606. data/sig/anthropic/models/beta/sessions/beta_managed_agents_unknown_error.rbs +14 -0
  607. data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event.rbs +34 -0
  608. data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event_params.rbs +34 -0
  609. data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event.rbs +15 -0
  610. data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event_params.rbs +15 -0
  611. data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_message_event.rbs +27 -0
  612. data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_message_event_params.rbs +27 -0
  613. data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_tool_result_event_params.rbs +34 -0
  614. data/sig/anthropic/models/beta/sessions/resource_retrieve_response.rbs +43 -0
  615. data/sig/anthropic/models/beta/sessions/resource_update_response.rbs +43 -0
  616. data/sig/anthropic/models/beta/user_profile_create_params.rbs +20 -0
  617. data/sig/anthropic/models/beta/user_profile_update_params.rbs +16 -0
  618. data/sig/anthropic/models/beta/vaults/beta_managed_agents_credential.rbs +27 -0
  619. data/sig/anthropic/models/beta/vaults/beta_managed_agents_credential_networking_params.rbs +13 -0
  620. data/sig/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_auth_response.rbs +13 -0
  621. data/sig/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_params.rbs +17 -0
  622. data/sig/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_response.rbs +14 -0
  623. data/sig/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_update_params.rbs +14 -0
  624. data/sig/anthropic/models/beta/vaults/credential_create_params.rbs +33 -0
  625. data/sig/anthropic/models/beta/vaults/credential_update_params.rbs +28 -0
  626. data/sig/anthropic/models/beta_error.rbs +42 -0
  627. data/sig/anthropic/models/citations_delta.rbs +63 -0
  628. data/sig/anthropic/models/content_block.rbs +91 -0
  629. data/sig/anthropic/models/content_block_param.rbs +140 -1
  630. data/sig/anthropic/models/content_block_source_content.rbs +20 -0
  631. data/sig/anthropic/models/document_block.rbs +17 -0
  632. data/sig/anthropic/models/document_block_param.rbs +24 -0
  633. data/sig/anthropic/models/error_object.rbs +42 -0
  634. data/sig/anthropic/models/image_block_param.rbs +14 -0
  635. data/sig/anthropic/models/messages/message_batch_result.rbs +21 -0
  636. data/sig/anthropic/models/raw_content_block_delta.rbs +27 -0
  637. data/sig/anthropic/models/raw_content_block_start_event.rbs +91 -0
  638. data/sig/anthropic/models/raw_message_stream_event.rbs +37 -0
  639. data/sig/anthropic/models/server_tool_use_block.rbs +15 -0
  640. data/sig/anthropic/models/server_tool_use_block_param.rbs +15 -0
  641. data/sig/anthropic/models/text_citation.rbs +63 -0
  642. data/sig/anthropic/models/text_citation_param.rbs +59 -0
  643. data/sig/anthropic/models/thinking_config_param.rbs +18 -0
  644. data/sig/anthropic/models/tool_choice.rbs +21 -0
  645. data/sig/anthropic/models/tool_result_block_param.rbs +49 -0
  646. data/sig/anthropic/models/tool_use_block.rbs +15 -0
  647. data/sig/anthropic/models/tool_use_block_param.rbs +15 -0
  648. data/sig/anthropic/models/web_fetch_tool_result_block.rbs +15 -0
  649. data/sig/anthropic/models/web_fetch_tool_result_block_param.rbs +15 -0
  650. data/sig/anthropic/models/web_search_tool_result_block.rbs +15 -0
  651. data/sig/anthropic/models/web_search_tool_result_block_param.rbs +15 -0
  652. data/sig/anthropic/models.rbs +0 -2
  653. data/sig/anthropic/resources/beta/dreams.rbs +1 -0
  654. data/sig/anthropic/resources/beta/memory_stores/memory_versions.rbs +1 -0
  655. data/sig/anthropic/resources/beta/user_profiles.rbs +2 -0
  656. metadata +14 -8
  657. data/lib/anthropic/models/beta/beta_mid_conversation_system_block_param.rb +0 -71
  658. data/lib/anthropic/models/mid_conversation_system_block_param.rb +0 -37
  659. data/rbi/anthropic/models/beta/beta_mid_conversation_system_block_param.rbi +0 -125
  660. data/rbi/anthropic/models/mid_conversation_system_block_param.rbi +0 -66
  661. data/sig/anthropic/models/beta/beta_mid_conversation_system_block_param.rbs +0 -45
  662. data/sig/anthropic/models/mid_conversation_system_block_param.rbs +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70039e0b3caf6cf562834b86cb64726a92d6b39b6c51bf25e076d901f1a336bf
4
- data.tar.gz: 26532ca157534b56a16276bcc6a9b2dc85c4817bbf2cb83feb05269882be7d03
3
+ metadata.gz: e9a5ec69ebe4f2fe1d743013098cb879401a601825c244fdb587b36c055ebfc5
4
+ data.tar.gz: de874bbfc686b83f328bccdc1a95f8a4e5211ad6f73895d4f117ffd9e6faf260
5
5
  SHA512:
6
- metadata.gz: 0a061ad34ba81ad33b17e46e95c26d57c68660a2323c8f890541f12d13bf657a935ad0de3ceea801d31fb200f7a9f5d92b53f99d31d56cfb7904169bdba37e29
7
- data.tar.gz: '08cccc073d696911273fc044c063e0cc9b65391e75f5893fed0593773667ec8449165f143c488c967a9c6507805561177a4354917c4f473ef8cd80f21d87d41a'
6
+ metadata.gz: 79022be4b042788f7586f77a3ab32f3036bd82733505afbe387aae2f709e3db1de135ab2de906f561915a417aa73c19576c8564c7ba1632e746b620ec358b8e4
7
+ data.tar.gz: cd8af8f0f3577f4558b8126607b2de05bd994584fe549792af7434eb7b791f25eda4ead4ea583b233b3bf73c2f07ed4f03ebf21338dd55af1a33bee77dd150e5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.63.0 (2026-08-18)
4
+
5
+ Full Changelog: [v1.62.0...v1.63.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.62.0...v1.63.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** additions to files and memory stores ([f4baf57](https://github.com/anthropics/anthropic-sdk-ruby/commit/f4baf57eaf96b098ec63c895c84c701294583240))
10
+ * **api:** updates to skill, files, and user profiles ([ba0844b](https://github.com/anthropics/anthropic-sdk-ruby/commit/ba0844b290a2036cba7c0a79e500497d48096c5f))
11
+ * **tools:** add `tool_options` to `BaseTool` (strict, cache_control, …) ([#161](https://github.com/anthropics/anthropic-sdk-ruby/issues/161)) ([df278f9](https://github.com/anthropics/anthropic-sdk-ruby/commit/df278f9170ce5ff130433602b18470248dcfa3f4))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **api:** remove unsupported mid_conv_system content block ([687a6da](https://github.com/anthropics/anthropic-sdk-ruby/commit/687a6da56fe9cb85753f6a819d7978580bed61c9))
17
+ * **aws,google_cloud:** adopt the default-credentials hook in the AWS and Google Cloud clients ([#170](https://github.com/anthropics/anthropic-sdk-ruby/issues/170)) ([169fea9](https://github.com/anthropics/anthropic-sdk-ruby/commit/169fea9f5ef8d0798bc0e795e0579eae367939e2))
18
+ * **client:** never fall back to the first-party base URL when default credentials are disabled ([#193](https://github.com/anthropics/anthropic-sdk-ruby/issues/193)) ([b6e9f56](https://github.com/anthropics/anthropic-sdk-ruby/commit/b6e9f562c2872dc5f3ca3a4d6c4025e0e75397d1))
19
+ * **tool-runner:** forward the server-assigned container on follow-up requests ([#189](https://github.com/anthropics/anthropic-sdk-ruby/issues/189)) ([891ac9b](https://github.com/anthropics/anthropic-sdk-ruby/commit/891ac9b8f12234bfe6938086937505e27175df46))
20
+ * **tool-runner:** replay unknown tool_use input verbatim ([#173](https://github.com/anthropics/anthropic-sdk-ruby/issues/173)) ([566a881](https://github.com/anthropics/anthropic-sdk-ruby/commit/566a8817fbe8aad5a25b4111021e39d20451ef03))
21
+ * **tool-runner:** stop on refusal instead of executing tools ([#174](https://github.com/anthropics/anthropic-sdk-ruby/issues/174)) ([4b8d2e4](https://github.com/anthropics/anthropic-sdk-ruby/commit/4b8d2e43265d31b55eb9a6f0d3241b62fa510b2d))
22
+
23
+
24
+ ### Chores
25
+
26
+ * **internal:** remove leftover prism references ([5a416d3](https://github.com/anthropics/anthropic-sdk-ruby/commit/5a416d3f2c784d697a8f9fbc99f5620102ea0c84))
27
+
28
+ ## 1.62.0 (2026-08-13)
29
+
30
+ Full Changelog: [v1.61.0...v1.62.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.61.0...v1.62.0)
31
+
32
+ ### Features
33
+
34
+ * **api:** add output_behavior to dream creation (create a new memory store or update the input store in place) ([836125f](https://github.com/anthropics/anthropic-sdk-ruby/commit/836125f10cee42677d814fa7bb85f693914c6af9))
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * **bedrock:** adopt the default-credentials hook in place of the direct base-client bind ([#145](https://github.com/anthropics/anthropic-sdk-ruby/issues/145)) ([e082f28](https://github.com/anthropics/anthropic-sdk-ruby/commit/e082f280846cd00bda4f89b9fb6ad50b4a4a5feb))
40
+ * **client:** accumulate streamed input for server tool use blocks ([#162](https://github.com/anthropics/anthropic-sdk-ruby/issues/162)) ([75382d8](https://github.com/anthropics/anthropic-sdk-ruby/commit/75382d81ebb6b3bedad92749f26e4625d8203097))
41
+ * **client:** add models ([055b440](https://github.com/anthropics/anthropic-sdk-ruby/commit/055b440aa315cf644b08ede51a19f448fab00cbf))
42
+ * **internal:** don't resolve lazy field types when hashing a model class ([#155](https://github.com/anthropics/anthropic-sdk-ruby/issues/155)) ([0a2c06f](https://github.com/anthropics/anthropic-sdk-ruby/commit/0a2c06fcbdb345d751ae0850cac70177cb232d53))
43
+ * **streaming:** apply all message_delta fields when accumulating streamed messages ([#160](https://github.com/anthropics/anthropic-sdk-ruby/issues/160)) ([e537ae2](https://github.com/anthropics/anthropic-sdk-ruby/commit/e537ae23ac5c5701b47812e9062db9c3bd9f29da))
44
+ * **vertex:** don't resolve the shared config store during client init ([#142](https://github.com/anthropics/anthropic-sdk-ruby/issues/142)) ([4108bd4](https://github.com/anthropics/anthropic-sdk-ruby/commit/4108bd4aa3fd3517b51971fdd25f15351bd8f5be))
45
+
46
+
47
+ ### Documentation
48
+
49
+ * **api:** clarify that user profile name is optional for resold profiles ([e68fd57](https://github.com/anthropics/anthropic-sdk-ruby/commit/e68fd57357fed4964666d84d011b38873abff02d))
50
+ * **client:** move truncated-docs note below the description in YARD doc blocks ([3db8b94](https://github.com/anthropics/anthropic-sdk-ruby/commit/3db8b9489cd2adb207edbb0165ea11fbacc19db4))
51
+ * fix Symbol typo in RDoc comments ([#163](https://github.com/anthropics/anthropic-sdk-ruby/issues/163)) ([1102732](https://github.com/anthropics/anthropic-sdk-ruby/commit/1102732847ffc02eef9d2c69e233f5e6f56787d8))
52
+
3
53
  ## 1.61.0 (2026-08-07)
4
54
 
5
55
  Full Changelog: [v1.60.0...v1.61.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.60.0...v1.61.0)
data/README.md CHANGED
@@ -15,7 +15,7 @@ Add to your application's Gemfile:
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "anthropic", "~> 1.61.0"
18
+ gem "anthropic", "~> 1.63.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -197,7 +197,7 @@ module Anthropic
197
197
 
198
198
  has_explicit_credential = api_key || auth_token || credentials || config
199
199
 
200
- unless has_explicit_credential
200
+ if !has_explicit_credential && resolve_default_credentials?
201
201
  api_key = ENV["ANTHROPIC_API_KEY"]
202
202
  auth_token = ENV["ANTHROPIC_AUTH_TOKEN"]
203
203
  end
@@ -208,7 +208,7 @@ module Anthropic
208
208
  @token_cache = nil
209
209
 
210
210
  base_url_is_explicit = base_url && !base_url.empty?
211
- base_url ||= ENV["ANTHROPIC_BASE_URL"]
211
+ base_url ||= ENV["ANTHROPIC_BASE_URL"] if resolve_default_credentials?
212
212
 
213
213
  credential_headers = {}
214
214
 
@@ -223,7 +223,7 @@ module Anthropic
223
223
  @credentials = credentials
224
224
  end
225
225
 
226
- if @credentials.nil? && @api_key.nil? && @auth_token.nil?
226
+ if @credentials.nil? && @api_key.nil? && @auth_token.nil? && resolve_default_credentials?
227
227
  default_base_url = base_url || "https://api.anthropic.com"
228
228
  result = Anthropic::Credentials.default_credentials(base_url: default_base_url)
229
229
  if result
@@ -234,13 +234,20 @@ module Anthropic
234
234
  end
235
235
 
236
236
  warn_explicit_shadow(api_key: api_key, auth_token: auth_token, credentials: credentials || config)
237
- warn_env_shadow(api_key: api_key, auth_token: auth_token)
237
+ warn_env_shadow(api_key: api_key, auth_token: auth_token) if resolve_default_credentials?
238
238
 
239
239
  if @credentials
240
240
  @token_cache = Anthropic::Credentials::TokenCache.new(@credentials)
241
241
  end
242
242
 
243
- base_url ||= "https://api.anthropic.com"
243
+ if resolve_default_credentials?
244
+ base_url ||= "https://api.anthropic.com"
245
+ elsif base_url.to_s.empty?
246
+ raise ArgumentError.new(
247
+ "No base_url was resolved for #{self.class.name}; " \
248
+ "platform clients must supply their own endpoint."
249
+ )
250
+ end
244
251
 
245
252
  if @credentials.respond_to?(:bind_base_url)
246
253
  @credentials.bind_base_url(base_url)
@@ -295,6 +302,23 @@ module Anthropic
295
302
 
296
303
  private
297
304
 
305
+ # @api private
306
+ #
307
+ # Whether to resolve credentials from the default chain (the static
308
+ # +ANTHROPIC_API_KEY+ / +ANTHROPIC_AUTH_TOKEN+ env vars and the shared
309
+ # config store / federation auto-discovery, precedence steps 2–5 above)
310
+ # when no explicit credential argument is passed. Called once from
311
+ # {#initialize}, so overrides must not depend on subclass instance state.
312
+ # Subclasses that bring their own auth scheme override this to +false+ so
313
+ # ambient first-party credentials are never resolved or folded into
314
+ # requests bound for another platform's endpoint. Returning +false+ also
315
+ # withholds the +ANTHROPIC_BASE_URL+ / +https://api.anthropic.com+
316
+ # base-URL fallback, so such a subclass must pass its own +base_url+ or
317
+ # {#initialize} raises +ArgumentError+.
318
+ #
319
+ # @return [Boolean]
320
+ def resolve_default_credentials? = true
321
+
298
322
  def warn_explicit_shadow(api_key:, auth_token:, credentials:)
299
323
  return if credentials.nil?
300
324
 
@@ -60,6 +60,12 @@ module Anthropic
60
60
  # @return [Object, nil]
61
61
  attr_accessor :body
62
62
 
63
+ # @return [String, nil]
64
+ def request_id = headers&.[]("request-id")
65
+
66
+ # @return [String, nil]
67
+ def workspace_id = headers&.[]("anthropic-workspace-id")
68
+
63
69
  # @api private
64
70
  #
65
71
  # @param url [URI::Generic]
@@ -53,7 +53,7 @@ module Anthropic
53
53
  #
54
54
  # @param max_retry_delay [Float]
55
55
  #
56
- def initialize( # rubocop:disable Lint/MissingSuper
56
+ def initialize(
57
57
  api_key: nil,
58
58
  aws_access_key: nil,
59
59
  aws_secret_access_key: nil,
@@ -84,27 +84,19 @@ module Anthropic
84
84
  derive_base_url: ->(region) { "https://aws-external-anthropic.#{region}.api.aws" }
85
85
  )
86
86
 
87
- @api_key = effective_api_key
88
- @auth_token = nil
89
- @credentials = nil
90
- @token_cache = nil
91
-
92
- # Skip Anthropic::Client#initialize and bind BaseClient#initialize directly:
93
- # the parent's initializer runs OIDC/credential-provider resolution that does
94
- # not apply here.
95
- Anthropic::Internal::Transport::BaseClient.instance_method(:initialize).bind(self).call(
87
+ # In API-key mode the gateway key rides the base client's `api_key`
88
+ # slot; {#resolve_default_credentials?} keeps first-party credential
89
+ # auto-discovery out of the picture when it is absent. The gateway
90
+ # serves the full first-party API, so every resource the parent wires
91
+ # up stays available.
92
+ super(
93
+ api_key: effective_api_key,
96
94
  base_url: resolved_base_url,
97
95
  timeout: timeout,
98
96
  max_retries: max_retries,
99
97
  initial_retry_delay: initial_retry_delay,
100
- max_retry_delay: max_retry_delay,
101
- headers: {"anthropic-version" => "2023-06-01"}
98
+ max_retry_delay: max_retry_delay
102
99
  )
103
-
104
- @completions = Anthropic::Resources::Completions.new(client: self)
105
- @messages = Anthropic::Resources::Messages.new(client: self)
106
- @models = Anthropic::Resources::Models.new(client: self)
107
- @beta = Anthropic::Resources::Beta.new(client: self)
108
100
  end
109
101
 
110
102
  # @api private
@@ -44,6 +44,7 @@ module Anthropic
44
44
  use_bearer_auth: false
45
45
  )
46
46
  @use_bearer_auth = use_bearer_auth
47
+ base_url = nil if base_url.to_s.empty?
47
48
  begin
48
49
  require("aws-sdk-core")
49
50
  rescue LoadError
@@ -119,12 +120,12 @@ module Anthropic
119
120
  end
120
121
  end
121
122
 
122
- if base_url.nil? && !aws_region.to_s.empty?
123
+ if !base_url && !aws_region.to_s.empty?
123
124
  @aws_region ||= aws_region
124
125
  base_url = derive_base_url.call(aws_region)
125
126
  end
126
127
 
127
- if base_url.nil?
128
+ unless base_url
128
129
  # rubocop:disable Layout/LineLength
129
130
  raise ArgumentError.new("No base_url was given and no aws_region is available to derive one. Set the `base_url` argument or provide an `aws_region`.")
130
131
  # rubocop:enable Layout/LineLength
@@ -147,6 +148,16 @@ module Anthropic
147
148
  super
148
149
  end
149
150
 
151
+ # @api private
152
+ #
153
+ # AWS-authenticated clients never resolve ambient first-party
154
+ # credentials, which would fold the shared config store's headers and
155
+ # bearer into requests bound for a third-party endpoint.
156
+ #
157
+ # @return [Boolean]
158
+ # @see Anthropic::Client#resolve_default_credentials?
159
+ private def resolve_default_credentials? = false
160
+
150
161
  # The AWS provider middleware entry: applies the workspace-id header and
151
162
  # SigV4 signing per attempt. Return from the including class's
152
163
  # `provider_middleware`. Pure — requests are reused across retry
@@ -60,7 +60,7 @@ module Anthropic
60
60
  # the Bedrock URL rewrite and SigV4 signing happen inside the continuation, per
61
61
  # attempt.
62
62
  #
63
- def initialize( # rubocop:disable Lint/MissingSuper
63
+ def initialize(
64
64
  aws_region: nil,
65
65
  base_url: nil,
66
66
  max_retries: self.class::DEFAULT_MAX_RETRIES,
@@ -121,36 +121,38 @@ module Anthropic
121
121
  @aws_region = aws_region
122
122
  end
123
123
 
124
- base_url ||= ENV.fetch(
125
- "ANTHROPIC_BEDROCK_BASE_URL",
126
- "https://bedrock-runtime.#{@aws_region}.amazonaws.com"
127
- )
124
+ base_url = ENV["ANTHROPIC_BEDROCK_BASE_URL"] if base_url.to_s.empty?
125
+ base_url = "https://bedrock-runtime.#{@aws_region}.amazonaws.com" if base_url.to_s.empty?
128
126
 
129
- @api_key = nil
130
- @auth_token = @signer ? nil : api_key
131
- @credentials = nil
132
- @token_cache = nil
133
127
  # For AWSAuth#auth_headers: suppress key headers in SigV4 mode; in
134
128
  # API-key mode fall through to the base bearer-token handling.
135
129
  @use_sig_v4 = !@signer.nil?
136
130
  @use_bearer_auth = false
137
131
 
138
- # Skip Anthropic::Client#initialize and bind BaseClient#initialize directly:
139
- # the parent's initializer runs OIDC/credential-provider resolution that does
140
- # not apply here.
141
- Anthropic::Internal::Transport::BaseClient.instance_method(:initialize).bind(self).call(
132
+ # The Bedrock bearer rides the base client's `auth_token` slot;
133
+ # {#resolve_default_credentials?} keeps first-party credential
134
+ # auto-discovery out of the picture when it is absent.
135
+ super(
136
+ auth_token: @signer ? nil : api_key,
142
137
  base_url: base_url,
143
138
  timeout: timeout,
144
139
  max_retries: max_retries,
145
140
  initial_retry_delay: initial_retry_delay,
146
141
  max_retry_delay: max_retry_delay,
147
- headers: {"anthropic-version" => "2023-06-01"},
148
142
  middleware: middleware
149
143
  )
144
+ end
150
145
 
151
- @messages = Anthropic::Resources::Messages.new(client: self)
152
- @completions = Anthropic::Resources::Completions.new(client: self)
153
- @beta = Anthropic::Resources::Beta.new(client: self)
146
+ # The Models API is not available on Bedrock, so the resource the
147
+ # parent wires up would target routes the Bedrock host does not serve
148
+ # keep it unavailable, matching the SDK's other Bedrock clients.
149
+ #
150
+ # @raise [NotImplementedError]
151
+ def models
152
+ # rubocop:disable Layout/LineLength
153
+ message = "Please instead use https://docs.anthropic.com/en/api/claude-on-amazon-bedrock#list-available-models to list available models on Bedrock."
154
+ # rubocop:enable Layout/LineLength
155
+ raise NotImplementedError.new(message)
154
156
  end
155
157
 
156
158
  # @api private
@@ -31,15 +31,6 @@ module Anthropic
31
31
  # @return [String, nil]
32
32
  attr_reader :workspace_id
33
33
 
34
- # @return [Anthropic::Resources::Messages]
35
- attr_reader :messages
36
-
37
- # @return [Anthropic::Resources::Models]
38
- attr_reader :models
39
-
40
- # @return [Anthropic::Resources::Beta]
41
- attr_reader :beta
42
-
43
34
  # Creates a new client for the Anthropic API on the Google Cloud gateway.
44
35
  #
45
36
  # Authentication uses Google credentials by precedence (unless
@@ -95,7 +86,7 @@ module Anthropic
95
86
  # is applied per attempt, after user middleware.
96
87
  #
97
88
  # @raise [ArgumentError]
98
- def initialize( # rubocop:disable Lint/MissingSuper
89
+ def initialize(
99
90
  project: ENV["ANTHROPIC_GOOGLE_CLOUD_PROJECT"] || ENV["GOOGLE_CLOUD_PROJECT"],
100
91
  location: ENV["ANTHROPIC_GOOGLE_CLOUD_LOCATION"] || "global",
101
92
  workspace_id: ENV["ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID"],
@@ -144,33 +135,31 @@ module Anthropic
144
135
  end
145
136
  @workspace_id = workspace_id
146
137
 
147
- base_url = derive_base_url if base_url.nil?
148
-
149
- # Never inherit first-party Anthropic credentials from the
150
- # environment: clear the ivars `Anthropic::Client#auth_headers` reads,
151
- # and bind `BaseClient#initialize` directly so the parent's
152
- # credential-provider / `ANTHROPIC_BASE_URL` resolution is skipped
153
- # entirely.
154
- @api_key = nil
155
- @auth_token = nil
156
- @credentials = nil
157
- @token_cache = nil
138
+ base_url = nil if base_url.to_s.empty?
139
+ base_url ||= derive_base_url
158
140
 
159
- Anthropic::Internal::Transport::BaseClient.instance_method(:initialize).bind(self).call(
141
+ # No first-party credential is ever passed up, and
142
+ # {#resolve_default_credentials?} keeps the parent from discovering
143
+ # one; `base_url` is always resolved by this point, so the parent's
144
+ # `ANTHROPIC_BASE_URL` fallback never applies. The parent wires up
145
+ # every resource; {#completions} withholds the one the gateway does
146
+ # not serve.
147
+ super(
160
148
  base_url: base_url,
161
149
  timeout: timeout,
162
150
  max_retries: max_retries,
163
151
  initial_retry_delay: initial_retry_delay,
164
152
  max_retry_delay: max_retry_delay,
165
- headers: {"anthropic-version" => "2023-06-01"},
166
153
  middleware: middleware
167
154
  )
168
-
169
- @messages = Anthropic::Resources::Messages.new(client: self)
170
- @models = Anthropic::Resources::Models.new(client: self)
171
- @beta = Anthropic::Resources::Beta.new(client: self)
172
155
  end
173
156
 
157
+ # @api private
158
+ #
159
+ # @return [Boolean]
160
+ # @see Anthropic::Client#resolve_default_credentials?
161
+ private def resolve_default_credentials? = false
162
+
174
163
  # The deprecated text Completions endpoint is not supported on the
175
164
  # Google Cloud gateway.
176
165
  #
@@ -9,7 +9,7 @@ module Anthropic
9
9
  # Extract tool models from the request and convert them to JSON Schema
10
10
  # Returns a hash mapping tool name to Ruby model.
11
11
  #
12
- # @param data [Hash{Sybmol=>Object}]
12
+ # @param data [Hash{Symbol=>Object}]
13
13
  #
14
14
  # @param strict [Boolean, nil]
15
15
  #
@@ -38,26 +38,27 @@ module Anthropic
38
38
  # rubocop:disable Metrics/BlockLength
39
39
  mapped = tool_array.map do |tool|
40
40
  case tool
41
- # BaseTool whose class declares an explicit `tool_name` (e.g. MCP-built tools):
42
- in Anthropic::Helpers::Tools::BaseTool if tool.class.tool_name
41
+ # Runnable tool instance (an `Anthropic::BaseTool` subclass, hand-written or helper-built):
42
+ in Anthropic::Helpers::Tools::BaseTool
43
43
  name = tool_api_name(tool)
44
+ # Helper-built tools (e.g. MCP) declare an explicit `tool_name` and only send the
45
+ # description they were given; hand-written tools fall back to their name.
44
46
  description = tool.class.doc_string
47
+ description ||= name unless tool.class.tool_name
45
48
  tools.store(name, tool)
46
49
  input_schema = Anthropic::Helpers::InputSchema::JsonSchemaConverter.to_json_schema(tool)
47
- extras = tool.class.tool_extra_props || {}
48
- result = {name:, input_schema:, **extras}
49
- result[:description] = description if description
50
- result[:strict] = strict if strict
51
- result
52
- # Direct tool class:
50
+ # On a clash the derived keys win, so nothing in `tool_options` can shadow them.
51
+ definition =
52
+ {name:, description:, input_schema:}
53
+ .merge(tool.class.tool_options) { |_key, derived, _option| derived }
54
+ .compact
55
+ definition.tap { _1.update(strict:) if strict }
56
+ # Input schema class used directly as a tool:
53
57
  in Anthropic::Helpers::InputSchema::JsonSchemaConverter
54
- name =
55
- tool.is_a?(Anthropic::Helpers::Tools::BaseTool) ? tool_api_name(tool) : model_name(tool.name)
58
+ name = model_name(tool.name)
56
59
 
57
60
  description =
58
61
  case tool
59
- in Anthropic::Helpers::Tools::BaseTool
60
- tool.class.doc_string || name
61
62
  in Class if tool <= Anthropic::Helpers::InputSchema::BaseModel
62
63
  tool.doc_string || name
63
64
  else
@@ -82,6 +83,11 @@ module Anthropic
82
83
  end
83
84
  # rubocop:enable Metrics/BlockLength
84
85
  tool_array.replace(mapped)
86
+ else
87
+ end
88
+
89
+ # Matched separately from `tools:` so a request can carry both tools and a structured output format.
90
+ case data
85
91
  # GA: output_config with BaseModel class as format
86
92
  in {output_config: {format: Anthropic::Helpers::InputSchema::JsonSchemaConverter => model} => output_config}
87
93
  name = model_name(model.name)
@@ -128,13 +134,13 @@ module Anthropic
128
134
 
129
135
  # @api private
130
136
  #
131
- # @param raw [Hash{Sybmol=>Object}]
137
+ # @param raw [Hash{Symbol=>Object}]
132
138
  #
133
139
  # @param tools [Hash{String=>Class}]
134
140
  #
135
141
  # @param models [Hash{String=>Class}]
136
142
  #
137
- # @return [Hash{Sybmol=>Object}]
143
+ # @return [Hash{Symbol=>Object}]
138
144
  def parse_input_schemas!(raw, tools:, models:)
139
145
  raw[:content]&.each do |content|
140
146
  case content
@@ -123,12 +123,14 @@ module Anthropic
123
123
  case (delta = event.delta)
124
124
  in Anthropic::Models::TextDelta | Anthropic::Models::BetaTextDelta if content.type == :text
125
125
  content.text += delta.text
126
- in Anthropic::Models::InputJSONDelta | Anthropic::Models::BetaInputJSONDelta if content.type == :tool_use
127
- json_buf = content._json_buf.to_s
126
+ in Anthropic::Models::InputJSONDelta | Anthropic::Models::BetaInputJSONDelta if tracks_tool_input?(content)
127
+ # `input` itself is the partial-JSON buffer mid-stream: it starts as the
128
+ # `{}` placeholder from content_block_start and holds the raw String once
129
+ # the first delta lands (server/MCP tool blocks have no `_json_buf`).
130
+ json_buf = content.input.is_a?(String) ? content.input : ""
128
131
  json_buf += delta.partial_json
129
132
 
130
133
  content.input = json_buf
131
- content._json_buf = json_buf
132
134
  in Anthropic::Models::CitationsDelta | Anthropic::Models::BetaCitationsDelta if content.type == :text
133
135
  content.citations ||= []
134
136
  content.citations << delta.citation
@@ -147,7 +149,7 @@ module Anthropic
147
149
  # finished block must carry the decoded object, as in the non-streaming
148
150
  # message and the other SDKs' accumulators.
149
151
  case current_snapshot.content[event.index]
150
- in {type: :tool_use, input: String => raw} => content
152
+ in {input: String => raw} => content if tracks_tool_input?(content)
151
153
  begin
152
154
  content.input = decode_tool_use_input(raw)
153
155
  rescue JSON::ParserError
@@ -156,9 +158,15 @@ module Anthropic
156
158
  else
157
159
  end
158
160
  in Anthropic::Models::RawMessageDeltaEvent | Anthropic::Models::BetaRawMessageDeltaEvent
159
- current_snapshot.stop_reason = event.delta.stop_reason
160
- current_snapshot.stop_sequence = event.delta.stop_sequence
161
+ # message_start already seeds the null placeholders for these, and the
162
+ # generated setters cannot take a nil, so skip the ones the event omits.
163
+ current_snapshot.stop_reason = event.delta.stop_reason unless event.delta.stop_reason.nil?
164
+ current_snapshot.stop_sequence = event.delta.stop_sequence unless event.delta.stop_sequence.nil?
161
165
  current_snapshot.stop_details = event.delta.stop_details unless event.delta.stop_details.nil?
166
+
167
+ # Only reported once a container actually ran, and never on message_start.
168
+ current_snapshot.container = event.delta.container unless event.delta.container.nil?
169
+
162
170
  current_snapshot.usage.output_tokens = event.usage.output_tokens
163
171
 
164
172
  # The message_delta usage is authoritative for the final counts; carry every
@@ -176,6 +184,9 @@ module Anthropic
176
184
  unless event.usage.server_tool_use.nil?
177
185
  current_snapshot.usage.server_tool_use = event.usage.server_tool_use
178
186
  end
187
+ unless event.usage.output_tokens_details.nil?
188
+ current_snapshot.usage.output_tokens_details = event.usage.output_tokens_details
189
+ end
179
190
 
180
191
  if event.is_a?(Anthropic::Models::BetaRawMessageDeltaEvent)
181
192
  unless event.usage.iterations.nil?
@@ -184,6 +195,10 @@ module Anthropic
184
195
  unless event.usage.fallback_credit.nil?
185
196
  current_snapshot.usage.fallback_credit = event.usage.fallback_credit
186
197
  end
198
+ # Applied context-management edits ride on the event, not on `delta`.
199
+ unless event.context_management.nil?
200
+ current_snapshot.context_management = event.context_management
201
+ end
187
202
  end
188
203
  else
189
204
  end
@@ -222,7 +237,7 @@ module Anthropic
222
237
  text: delta.text,
223
238
  snapshot: content_block.text
224
239
  )
225
- in Anthropic::Models::InputJSONDelta | Anthropic::Models::BetaInputJSONDelta if content_block.type == :tool_use
240
+ in Anthropic::Models::InputJSONDelta | Anthropic::Models::BetaInputJSONDelta if tracks_tool_input?(content_block)
226
241
  events_to_yield << Anthropic::Streaming::InputJsonEvent.new(
227
242
  type: :input_json,
228
243
  partial_json: delta.partial_json,
@@ -269,7 +284,21 @@ module Anthropic
269
284
 
270
285
  # @api private
271
286
  #
272
- # Decodes a tool_use block's buffered partial-JSON input. An empty buffer
287
+ # Content block types whose `input` streams in as input_json_delta events.
288
+ TOOL_INPUT_BLOCK_TYPES = [:tool_use, :server_tool_use, :mcp_tool_use].freeze
289
+
290
+ # @api private
291
+ #
292
+ # @param content_block [Object]
293
+ #
294
+ # @return [Boolean]
295
+ private def tracks_tool_input?(content_block)
296
+ TOOL_INPUT_BLOCK_TYPES.include?(content_block.type)
297
+ end
298
+
299
+ # @api private
300
+ #
301
+ # Decodes a tool-use block's buffered partial-JSON input. An empty buffer
273
302
  # means a no-argument tool call, which the wire encodes as an empty object.
274
303
  #
275
304
  # @param raw [String]
@@ -25,15 +25,6 @@ module Anthropic
25
25
  # @return [String, nil]
26
26
  attr_accessor :tool_name
27
27
 
28
- # @api private
29
- #
30
- # Extra tool-definition properties merged into the API payload (e.g.
31
- # `cache_control`, `defer_loading`, `allowed_callers`, `eager_input_streaming`,
32
- # `input_examples`, `strict`).
33
- #
34
- # @return [Hash{Symbol=>Object}, nil]
35
- attr_accessor :tool_extra_props
36
-
37
28
  # @api public
38
29
  #
39
30
  # @param description [String]
@@ -46,10 +37,78 @@ module Anthropic
46
37
  # @model [Class<Anthropic::Helpers::InputSchema::BaseModel>]
47
38
  def input_schema(model) = (@model = model)
48
39
 
40
+ # @api public
41
+ #
42
+ # Declares additional properties for this tool's API definition, sent alongside the
43
+ # `name`, `description` and `input_schema` — e.g. `strict`, `cache_control`,
44
+ # `defer_loading`, `allowed_callers`, `eager_input_streaming` or `input_examples`.
45
+ #
46
+ # Options accumulate: each call merges into what was already declared, and a subclass
47
+ # starts from its superclass's options. Called without an argument, returns the declared
48
+ # options as a frozen hash.
49
+ #
50
+ # @example
51
+ # class GetWeather < Anthropic::BaseTool
52
+ # doc "Get the current weather in a given location"
53
+ # input_schema GetWeatherInput
54
+ # tool_options strict: true, cache_control: {type: :ephemeral}
55
+ # end
56
+ #
57
+ # @param options [Hash{Symbol=>Object}, nil]
58
+ #
59
+ # @return [Hash{Symbol=>Object}]
60
+ def tool_options(options = nil)
61
+ if options.nil?
62
+ return @tool_options if @tool_options
63
+
64
+ # Nothing declared on this class: read through to the superclass (`BaseTool` has none).
65
+ return superclass.respond_to?(:tool_options) ? superclass.tool_options : {}.freeze
66
+ end
67
+
68
+ options = Anthropic::Internal::Util.coerce_hash!(options).to_h.transform_keys(&:to_sym)
69
+ # These either have their own declaration or are derived from the class; letting them
70
+ # through would desync the definition sent to the API from how responses are parsed.
71
+ reserved = options.keys & [:name, :description, :input_schema]
72
+ unless reserved.empty?
73
+ message =
74
+ "#{reserved.map { "`#{_1}`" }.join(', ')} cannot be set through `tool_options`; " \
75
+ "use `doc` and `input_schema` instead (the tool name is derived from the class name)."
76
+ raise ArgumentError.new(message)
77
+ end
78
+
79
+ # Frozen so the stored declaration can't drift from what was validated above.
80
+ @tool_options = Anthropic::Internal::Util.deep_frozen_copy(tool_options.merge(options))
81
+ end
82
+
83
+ # @api private
84
+ #
85
+ # @deprecated Use {.tool_options}.
86
+ #
87
+ # @return [Hash{Symbol=>Object}]
88
+ def tool_extra_props = tool_options
89
+
90
+ # @api private
91
+ #
92
+ # @deprecated Use {.tool_options}.
93
+ #
94
+ # @param props [Hash{Symbol=>Object}, nil]
95
+ def tool_extra_props=(props)
96
+ warn(
97
+ "[DEPRECATION] `tool_extra_props=` is deprecated. Use `tool_options` instead.",
98
+ category: :deprecated
99
+ )
100
+ tool_options(props.to_h)
101
+ end
102
+
49
103
  # @api private
50
104
  #
51
105
  # @param depth [Integer]
52
- def inspect(depth: 0) = "#{name}[#{model.inspect(depth:)}]"
106
+ def inspect(depth: 0)
107
+ # Only hand-written tools carry an input schema class here; helper-built tools (e.g. MCP)
108
+ # hold a plain class and an undeclared schema is nil, neither of which takes `depth:`.
109
+ schema = model.is_a?(Anthropic::Internal::Type::Converter) ? model.inspect(depth:) : model.inspect
110
+ "#{name || tool_name}[#{schema}]"
111
+ end
53
112
  end
54
113
 
55
114
  # @api private