anthropic 2.8.0 → 2.9.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 (170) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -0
  3. data/README.md +1 -1
  4. data/lib/anthropic/error_classes.rb +4 -0
  5. data/lib/anthropic/helpers/threads/beta_message_thread.rb +30 -6
  6. data/lib/anthropic/helpers/tools/runner.rb +21 -4
  7. data/lib/anthropic/helpers/tracing/streamed_message.rb +8 -1
  8. data/lib/anthropic/internal/tracing.rb +1 -0
  9. data/lib/anthropic/internal/type/file_input.rb +11 -0
  10. data/lib/anthropic/internal/util.rb +43 -11
  11. data/lib/anthropic/models/anthropic_beta.rb +44 -30
  12. data/lib/anthropic/models/beta/beta_managed_agents_agent_toolset_default_config.rb +1 -1
  13. data/lib/anthropic/models/beta/beta_managed_agents_agent_toolset_default_config_params.rb +1 -1
  14. data/lib/anthropic/models/beta/beta_managed_agents_auto_policy.rb +3 -1
  15. data/lib/anthropic/models/beta/beta_managed_agents_bash_tool_config.rb +1 -1
  16. data/lib/anthropic/models/beta/beta_managed_agents_bash_tool_config_params.rb +1 -1
  17. data/lib/anthropic/models/beta/beta_managed_agents_edit_tool_config.rb +1 -1
  18. data/lib/anthropic/models/beta/beta_managed_agents_edit_tool_config_params.rb +1 -1
  19. data/lib/anthropic/models/beta/beta_managed_agents_glob_tool_config.rb +1 -1
  20. data/lib/anthropic/models/beta/beta_managed_agents_glob_tool_config_params.rb +1 -1
  21. data/lib/anthropic/models/beta/beta_managed_agents_grep_tool_config.rb +1 -1
  22. data/lib/anthropic/models/beta/beta_managed_agents_grep_tool_config_params.rb +1 -1
  23. data/lib/anthropic/models/beta/beta_managed_agents_mcp_tool_config.rb +1 -1
  24. data/lib/anthropic/models/beta/beta_managed_agents_mcp_tool_config_params.rb +1 -1
  25. data/lib/anthropic/models/beta/beta_managed_agents_mcp_toolset_default_config.rb +1 -1
  26. data/lib/anthropic/models/beta/beta_managed_agents_mcp_toolset_default_config_params.rb +1 -1
  27. data/lib/anthropic/models/beta/beta_managed_agents_multiagent_coordinator_params.rb +3 -2
  28. data/lib/anthropic/models/beta/beta_managed_agents_multiagent_params.rb +1 -1
  29. data/lib/anthropic/models/beta/beta_managed_agents_read_tool_config.rb +1 -1
  30. data/lib/anthropic/models/beta/beta_managed_agents_read_tool_config_params.rb +1 -1
  31. data/lib/anthropic/models/beta/beta_managed_agents_web_fetch_tool_config.rb +1 -1
  32. data/lib/anthropic/models/beta/beta_managed_agents_web_fetch_tool_config_params.rb +1 -1
  33. data/lib/anthropic/models/beta/beta_managed_agents_web_search_tool_config.rb +1 -1
  34. data/lib/anthropic/models/beta/beta_managed_agents_web_search_tool_config_params.rb +1 -1
  35. data/lib/anthropic/models/beta/beta_managed_agents_write_tool_config.rb +1 -1
  36. data/lib/anthropic/models/beta/beta_managed_agents_write_tool_config_params.rb +1 -1
  37. data/lib/anthropic/models/beta/organization/beta_bundle_attachment_not_supported_error.rb +24 -0
  38. data/lib/anthropic/models/beta/organization/beta_bundle_attachment_not_supported_error_details.rb +22 -0
  39. data/lib/anthropic/models/beta/organization/beta_bundle_on_call_error.rb +24 -0
  40. data/lib/anthropic/models/beta/organization/beta_bundle_on_call_error_details.rb +22 -0
  41. data/lib/anthropic/models/beta/organization/beta_external_key.rb +2 -2
  42. data/lib/anthropic/models/beta/organization/beta_rbac_role.rb +14 -5
  43. data/lib/anthropic/models/beta/organization/beta_rbac_role_source.rb +52 -0
  44. data/lib/anthropic/models/beta/organization/beta_rbac_role_source_built_in.rb +25 -0
  45. data/lib/anthropic/models/beta/organization/beta_rbac_role_source_custom.rb +20 -0
  46. data/lib/anthropic/models/beta/organization/claude_tag/beta_claude_tag_bundle.rb +15 -2
  47. data/lib/anthropic/models/beta/organization/claude_tag/bundle_update_params.rb +50 -0
  48. data/lib/anthropic/models/beta/organization/external_key_create_params.rb +3 -2
  49. data/lib/anthropic/models/beta/organization/plugin_list_params.rb +2 -1
  50. data/lib/anthropic/models/beta/organization/plugin_marketplace_list_params.rb +2 -1
  51. data/lib/anthropic/models/beta/organization/plugin_marketplace_retrieve_params.rb +2 -1
  52. data/lib/anthropic/models/beta/organization/plugin_retrieve_params.rb +2 -1
  53. data/lib/anthropic/models/beta/organization/plugins/installation_setting_list_params.rb +2 -1
  54. data/lib/anthropic/models/beta/organization/plugins/share_list_params.rb +2 -1
  55. data/lib/anthropic/models/beta/organization/plugins/version_download_params.rb +2 -1
  56. data/lib/anthropic/models/beta/organization/plugins/version_list_params.rb +2 -1
  57. data/lib/anthropic/models/beta/organization/plugins/version_retrieve_params.rb +2 -1
  58. data/lib/anthropic/models/beta/organization/workspace_update_params.rb +2 -1
  59. data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_auto_evaluated_permission.rb +1 -1
  60. data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_auto_evaluated_permission_deny.rb +7 -4
  61. data/lib/anthropic/models/error_details.rb +28 -3
  62. data/lib/anthropic/models/organization/external_key.rb +2 -2
  63. data/lib/anthropic/models/organization/external_key_create_params.rb +3 -2
  64. data/lib/anthropic/models/organization/key_profile_mismatch_error.rb +3 -3
  65. data/lib/anthropic/models/organization/key_profile_mismatch_error_details.rb +3 -3
  66. data/lib/anthropic/models/organization/rbac_role.rb +14 -5
  67. data/lib/anthropic/models/organization/rbac_role_source.rb +50 -0
  68. data/lib/anthropic/models/organization/rbac_role_source_built_in.rb +22 -0
  69. data/lib/anthropic/models/organization/rbac_role_source_custom.rb +18 -0
  70. data/lib/anthropic/models/organization/workspace_update_params.rb +2 -1
  71. data/lib/anthropic/models/parent_organization_required_error.rb +20 -0
  72. data/lib/anthropic/models/parent_organization_required_error_details.rb +18 -0
  73. data/lib/anthropic/models/rbac_role_not_found_error.rb +19 -0
  74. data/lib/anthropic/models/rbac_role_not_found_error_details.rb +17 -0
  75. data/lib/anthropic/models.rb +8 -0
  76. data/lib/anthropic/resources/beta/messages/batches.rb +6 -6
  77. data/lib/anthropic/resources/beta/messages.rb +5 -1
  78. data/lib/anthropic/resources/beta/organization/claude_tag/bundles.rb +51 -0
  79. data/lib/anthropic/resources/beta/organization/rbac_roles/permissions.rb +4 -0
  80. data/lib/anthropic/resources/beta/organization/rbac_roles.rb +7 -0
  81. data/lib/anthropic/resources/organization/rbac_roles/permissions.rb +4 -0
  82. data/lib/anthropic/resources/organization/rbac_roles.rb +7 -0
  83. data/lib/anthropic/version.rb +1 -1
  84. data/lib/anthropic.rb +15 -0
  85. data/rbi/anthropic/helpers/bedrock/client.rbi +6 -2
  86. data/rbi/anthropic/helpers/bedrock/event_stream.rbi +12 -3
  87. data/rbi/anthropic/helpers/bedrock/mantle_client.rbi +3 -1
  88. data/rbi/anthropic/helpers/google_cloud/client.rbi +3 -1
  89. data/rbi/anthropic/helpers/refusal_fallback.rbi +12 -4
  90. data/rbi/anthropic/helpers/vertex/client.rbi +6 -2
  91. data/rbi/anthropic/internal/tracing.rbi +2 -0
  92. data/rbi/anthropic/internal/util.rbi +2 -2
  93. data/rbi/anthropic/models/anthropic_beta.rbi +41 -41
  94. data/rbi/anthropic/models/beta/beta_managed_agents_auto_policy.rbi +3 -1
  95. data/rbi/anthropic/models/beta/beta_managed_agents_multiagent_coordinator_params.rbi +3 -2
  96. data/rbi/anthropic/models/beta/organization/beta_bundle_attachment_not_supported_error.rbi +25 -0
  97. data/rbi/anthropic/models/beta/organization/beta_bundle_attachment_not_supported_error_details.rbi +32 -0
  98. data/rbi/anthropic/models/beta/organization/beta_bundle_on_call_error.rbi +23 -0
  99. data/rbi/anthropic/models/beta/organization/beta_bundle_on_call_error_details.rbi +32 -0
  100. data/rbi/anthropic/models/beta/organization/beta_external_key.rbi +4 -4
  101. data/rbi/anthropic/models/beta/organization/beta_rbac_role.rbi +23 -6
  102. data/rbi/anthropic/models/beta/organization/beta_rbac_role_source.rbi +78 -0
  103. data/rbi/anthropic/models/beta/organization/beta_rbac_role_source_built_in.rbi +36 -0
  104. data/rbi/anthropic/models/beta/organization/beta_rbac_role_source_custom.rbi +34 -0
  105. data/rbi/anthropic/models/beta/organization/claude_tag/beta_claude_tag_bundle.rbi +11 -1
  106. data/rbi/anthropic/models/beta/organization/claude_tag/bundle_update_params.rbi +88 -0
  107. data/rbi/anthropic/models/beta/organization/external_key_create_params.rbi +6 -4
  108. data/rbi/anthropic/models/beta/organization/plugin_list_params.rbi +4 -2
  109. data/rbi/anthropic/models/beta/organization/plugin_marketplace_list_params.rbi +4 -2
  110. data/rbi/anthropic/models/beta/organization/plugin_marketplace_retrieve_params.rbi +4 -2
  111. data/rbi/anthropic/models/beta/organization/plugin_retrieve_params.rbi +4 -2
  112. data/rbi/anthropic/models/beta/organization/plugins/installation_setting_list_params.rbi +4 -2
  113. data/rbi/anthropic/models/beta/organization/plugins/share_list_params.rbi +4 -2
  114. data/rbi/anthropic/models/beta/organization/plugins/version_download_params.rbi +4 -2
  115. data/rbi/anthropic/models/beta/organization/plugins/version_list_params.rbi +4 -2
  116. data/rbi/anthropic/models/beta/organization/plugins/version_retrieve_params.rbi +4 -2
  117. data/rbi/anthropic/models/beta/organization/workspace_update_params.rbi +4 -2
  118. data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_auto_evaluated_permission_deny.rbi +10 -6
  119. data/rbi/anthropic/models/error_details.rbi +25 -1
  120. data/rbi/anthropic/models/organization/external_key.rbi +4 -4
  121. data/rbi/anthropic/models/organization/external_key_create_params.rbi +6 -4
  122. data/rbi/anthropic/models/organization/key_profile_mismatch_error.rbi +3 -3
  123. data/rbi/anthropic/models/organization/key_profile_mismatch_error_details.rbi +3 -3
  124. data/rbi/anthropic/models/organization/rbac_role.rbi +20 -6
  125. data/rbi/anthropic/models/organization/rbac_role_source.rbi +68 -0
  126. data/rbi/anthropic/models/organization/rbac_role_source_built_in.rbi +34 -0
  127. data/rbi/anthropic/models/organization/rbac_role_source_custom.rbi +32 -0
  128. data/rbi/anthropic/models/organization/workspace_update_params.rbi +4 -2
  129. data/rbi/anthropic/models/parent_organization_required_error.rbi +17 -0
  130. data/rbi/anthropic/models/parent_organization_required_error_details.rbi +28 -0
  131. data/rbi/anthropic/models/rbac_role_not_found_error.rbi +16 -0
  132. data/rbi/anthropic/models/rbac_role_not_found_error_details.rbi +27 -0
  133. data/rbi/anthropic/models.rbi +10 -0
  134. data/rbi/anthropic/resources/beta/organization/claude_tag/bundles.rbi +30 -0
  135. data/rbi/anthropic/resources/beta/organization/external_keys.rbi +3 -2
  136. data/rbi/anthropic/resources/beta/organization/plugin_marketplaces.rbi +4 -2
  137. data/rbi/anthropic/resources/beta/organization/plugins/installation_settings.rbi +2 -1
  138. data/rbi/anthropic/resources/beta/organization/plugins/shares.rbi +2 -1
  139. data/rbi/anthropic/resources/beta/organization/plugins/versions.rbi +6 -3
  140. data/rbi/anthropic/resources/beta/organization/plugins.rbi +4 -2
  141. data/rbi/anthropic/resources/beta/organization/workspaces.rbi +2 -1
  142. data/rbi/anthropic/resources/organization/external_keys.rbi +3 -2
  143. data/rbi/anthropic/resources/organization/workspaces.rbi +2 -1
  144. data/rbi/lib/anthropic/helpers/stainless_helper_header.rbi +6 -1
  145. data/sig/anthropic/helpers/sessions/event_accumulator.rbs +6 -2
  146. data/sig/anthropic/internal/tracing.rbs +1 -0
  147. data/sig/anthropic/internal/util.rbs +1 -1
  148. data/sig/anthropic/models/anthropic_beta.rbs +21 -21
  149. data/sig/anthropic/models/beta/organization/beta_bundle_attachment_not_supported_error.rbs +13 -0
  150. data/sig/anthropic/models/beta/organization/beta_bundle_attachment_not_supported_error_details.rbs +20 -0
  151. data/sig/anthropic/models/beta/organization/beta_bundle_on_call_error.rbs +13 -0
  152. data/sig/anthropic/models/beta/organization/beta_bundle_on_call_error_details.rbs +17 -0
  153. data/sig/anthropic/models/beta/organization/beta_rbac_role.rbs +5 -0
  154. data/sig/anthropic/models/beta/organization/beta_rbac_role_source.rbs +40 -0
  155. data/sig/anthropic/models/beta/organization/beta_rbac_role_source_built_in.rbs +17 -0
  156. data/sig/anthropic/models/beta/organization/beta_rbac_role_source_custom.rbs +17 -0
  157. data/sig/anthropic/models/beta/organization/claude_tag/beta_claude_tag_bundle.rbs +5 -0
  158. data/sig/anthropic/models/beta/organization/claude_tag/bundle_update_params.rbs +46 -0
  159. data/sig/anthropic/models/error_details.rbs +26 -0
  160. data/sig/anthropic/models/organization/rbac_role.rbs +5 -0
  161. data/sig/anthropic/models/organization/rbac_role_source.rbs +38 -0
  162. data/sig/anthropic/models/organization/rbac_role_source_built_in.rbs +15 -0
  163. data/sig/anthropic/models/organization/rbac_role_source_custom.rbs +15 -0
  164. data/sig/anthropic/models/parent_organization_required_error.rbs +9 -0
  165. data/sig/anthropic/models/parent_organization_required_error_details.rbs +14 -0
  166. data/sig/anthropic/models/rbac_role_not_found_error.rbs +9 -0
  167. data/sig/anthropic/models/rbac_role_not_found_error_details.rbs +14 -0
  168. data/sig/anthropic/models.rbs +8 -0
  169. data/sig/anthropic/resources/beta/organization/claude_tag/bundles.rbs +7 -0
  170. metadata +47 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83c9d252df7e02ee1d255e4b2f699fc7b9504bd3c067dd489aafc2f1130516be
4
- data.tar.gz: 46b7ab28a6ec3b7452db9de88777224f507337f44d530d2f5bc8055e98c646de
3
+ metadata.gz: b3bbd83e128f33453e53c83fe2b1ea780ff8bea17e4e9ece8db76d237455be74
4
+ data.tar.gz: 2f057fc46beea13bf5aef689375b1ea2ac5df8715f2801a08b2af5be5755ff6d
5
5
  SHA512:
6
- metadata.gz: 84446ba2ccbec41779facc177524d757c32f61d2b61476bcdd21fe1c38d70d72e6aeeee49bb9785f7a1ec3cc1995bcd201da5b5a57e4d12824d873776ef833c5
7
- data.tar.gz: fc6d612572bfe04080e9cff135265857ae92ffafe6fa2432d16ef9c8772c95618d0e78db364bc7f464cdae12b8c43ab80b76713a81e8e9cd8bc6e0af42433e79
6
+ metadata.gz: a75d011512d8ad9469e5f4353b1d117527f688379aa9b8290eea955398ce6aec8c9d721d2e14912c4a96ab92886552d592d36a712e919c9c5a5866ccccb48a1c
7
+ data.tar.gz: 52fe69d1d15a30d70b28aa097f01009c9aa8bd717568324c4c5a42133e17cf6c0eefc8bbf27ed1ce56119bf164258115f36879f7537a5cbd17f46adad9618875
data/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.9.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v2.8.0...v2.9.0) (2026-11-16)
4
+
5
+ ### Features
6
+
7
+ * **api:** add source and error codes to the RBAC Role read endpoints
8
+ * **api:** add Update Bundle, which sets a Claude Tag Bundle's instructions, and return instructions on Bundle
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **client:** keep a streamed request body from breaking the next request
14
+ * **client:** read a response as JSON Lines only for JSON Lines types
15
+ * **client:** send an Enumerator request body in full on every attempt
16
+ * **client:** send multipart uploads with non-ASCII text, and stop corrupting AWS uploads on older Rubies
17
+ * **client:** upload a Tempfile's contents, not "#<File:0x...>"
18
+
19
+
20
+ ### Chores
21
+
22
+ * **api:** deprecate old beta header values
23
+
24
+ The API still accepts these values, but a later release removes them from the SDKs. Delete `prompt-caching-2024-07-31`, `pdfs-2024-09-25`, `token-counting-2024-11-01`, `token-efficient-tools-2025-02-19`, `extended-cache-ttl-2025-04-11`, `cache-diagnosis-2026-04-07` and `ce-user-management-2026-07-13` from your requests. `files-api-2025-04-14` and `skills-2025-10-02` select the beta response shapes, so follow the Files API and Skills migration guides before you delete them.
25
+
26
+ In C#, the `AnthropicBeta` enum's members have new numbers, so code compiled against an earlier SDK version sends a different beta value, with no error, until you rebuild it.
27
+
28
+ * **api:** stop sending an old beta header on batch requests
29
+
30
+ `beta.messages.batches` no longer sends `message-batches-2024-09-24`, which the API doesn't need. If your client sets a default `anthropic-beta` header, these requests now send it, where in some SDKs the old value replaced it. The API still accepts the old value. If you set it yourself, delete it: a later release removes it from the SDKs.
31
+
32
+ * **docs:** add an example value for the workspace name
33
+ * **docs:** clarify when the auto permission policy denies a tool call
34
+ * **docs:** clarify which workspaces an external key can be attached to
35
+ * **docs:** recommend multiagent_20261001 over the coordinator type
36
+ * **docs:** say when organization_id is required on plugin reads
37
+ * **internal:** format hand-written code with scripts/format
38
+
3
39
  ## [2.8.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v2.7.0...v2.8.0) (2026-11-10)
4
40
 
5
41
  ### Features
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", "~> 2.8.0"
18
+ gem "anthropic", "~> 2.9.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -25,6 +25,8 @@ module Anthropic
25
25
  [529, nil] => Anthropic::Errors::OverloadedError,
26
26
  [400, "already_member"] => Anthropic::Models::Organization::AlreadyMemberError,
27
27
  [400, "available_tools_limit_exceeded"] => Anthropic::Models::AvailableToolsLimitExceededError,
28
+ [400, "bundle_attachment_not_supported"] => Anthropic::Models::Beta::Organization::BetaBundleAttachmentNotSupportedError,
29
+ [400, "bundle_on_call"] => Anthropic::Models::Beta::Organization::BetaBundleOnCallError,
28
30
  [400, "cannot_invite_emails_with_unverified_domains"] => Anthropic::Models::Organization::CannotInviteEmailsWithUnverifiedDomainsError,
29
31
  [400, "cannot_remove_last_member"] => Anthropic::Models::Organization::CannotRemoveLastMemberError,
30
32
  [400, "cannot_sign_out_primary_owner"] => Anthropic::Models::Beta::Organization::BetaCannotSignOutPrimaryOwnerError,
@@ -56,6 +58,7 @@ module Anthropic
56
58
  [400, "organization_not_enrolled_in_beta"] => Anthropic::Models::BetaOrganizationNotEnrolledInBetaError,
57
59
  [400, "organization_on_hold"] => Anthropic::Models::OrganizationOnHoldError,
58
60
  [400, "organization_type_not_supported"] => Anthropic::Models::OrganizationTypeNotSupportedError,
61
+ [400, "parent_organization_required"] => Anthropic::Models::ParentOrganizationRequiredError,
59
62
  [400, "rbac_group_grants_owner_access"] => Anthropic::Models::Organization::RBACGroupGrantsOwnerAccessError,
60
63
  [400, "rbac_group_owner_access_unconfirmed"] => Anthropic::Models::Organization::RBACGroupOwnerAccessUnconfirmedError,
61
64
  [400, "request_body_encoding_invalid"] => Anthropic::Models::RequestBodyEncodingInvalidError,
@@ -88,6 +91,7 @@ module Anthropic
88
91
  [403, "spend_limits_admin_api_writes_not_enabled"] => Anthropic::Models::Beta::Organization::BetaSpendLimitsAdminAPIWritesNotEnabledError,
89
92
  [404, "environment_not_found"] => Anthropic::Models::Beta::BetaEnvironmentNotFoundError,
90
93
  [404, "file_expired"] => Anthropic::Models::FileExpiredError,
94
+ [404, "rbac_role_not_found"] => Anthropic::Models::RBACRoleNotFoundError,
91
95
  [404, "slack_channel_set_up_environment_not_found"] => Anthropic::Models::Beta::Organization::BetaSlackChannelSetUpEnvironmentNotFoundError,
92
96
  [404, "thread_not_found"] => Anthropic::Models::ThreadNotFoundError,
93
97
  [409, "concurrent_membership_change"] => Anthropic::Models::ConcurrentMembershipChangeError,
@@ -11,7 +11,9 @@ module Anthropic
11
11
  THREADS_BETA = Anthropic::Models::AnthropicBeta::MESSAGE_THREADS_2026_08_12.to_s
12
12
  NOT_FOUND_ERROR_CODE = "thread_not_found"
13
13
  # A `continue` rejected with one of these is sent again as a `create`.
14
- REPLAY_ERROR_CODES = Set[NOT_FOUND_ERROR_CODE, "thread_already_continued", "thread_continue_in_flight"].freeze
14
+ REPLAY_ERROR_CODES = Set[NOT_FOUND_ERROR_CODE,
15
+ "thread_already_continued",
16
+ "thread_continue_in_flight"].freeze
15
17
  UNSUPPORTED_REQUEST_ERROR_CODE = "thread_unsupported_request"
16
18
  UNSUPPORTED_REQUEST_BEHAVIORS = Set[:error, :continue_unthreaded].freeze
17
19
 
@@ -455,7 +457,16 @@ module Anthropic
455
457
  value.except(:cache_control, "cache_control").to_h do |key, nested|
456
458
  next [key, nested] unless %w[content source tool definition tool_references].include?(key.to_s)
457
459
 
458
- [key, nested.is_a?(Array) ? nested.map { without_cache_control(_1) } : without_cache_control(nested)]
460
+ [
461
+ key,
462
+ if nested.is_a?(Array)
463
+ nested.map do
464
+ without_cache_control(_1)
465
+ end
466
+ else
467
+ without_cache_control(nested)
468
+ end
469
+ ]
459
470
  end
460
471
  end
461
472
 
@@ -463,11 +474,20 @@ module Anthropic
463
474
  # as the API would receive it, and the classes that its tool inputs and output parse into
464
475
  def wire_request(fields)
465
476
  wire, = Anthropic::Models::Beta::MessageCreateParams.dump_request(fields)
466
- tools, models = Anthropic::Helpers::Messages.distill_input_schema_models!(wire, strict: nil, is_beta: true)
477
+ tools, models = Anthropic::Helpers::Messages.distill_input_schema_models!(
478
+ wire,
479
+ strict: nil,
480
+ is_beta: true
481
+ )
467
482
  [wire, tools, models]
468
483
  end
469
484
 
470
- def create_only_fields(wire) = {system_: wire[:system], tools: wire[:tools]}.transform_values(&:to_json)
485
+ def create_only_fields(wire)
486
+ {
487
+ system_: wire[:system],
488
+ tools: wire[:tools]
489
+ }.transform_values(&:to_json)
490
+ end
471
491
 
472
492
  def refuse_change!(created_with)
473
493
  return if !@anchor.is_a?(Continue) || created_with == @anchor.created_with
@@ -495,14 +515,18 @@ module Anthropic
495
515
  in Anthropic::Models::Beta::BetaToolUseBlock[type: :tool_use] if (tool = request.tools[block.name])
496
516
  Anthropic::Internal::Type::Converter.coerce(tool, block.input)
497
517
  in Anthropic::Models::Beta::BetaTextBlock if (model = request.models.first&.last)
498
- Anthropic::Internal::Type::Converter.coerce(model, JSON.parse(block.text, symbolize_names: true))
518
+ Anthropic::Internal::Type::Converter.coerce(
519
+ model,
520
+ JSON.parse(block.text, symbolize_names: true)
521
+ )
499
522
  else
500
523
  next
501
524
  end
502
525
  rescue StandardError => e
503
526
  {error: e.message}
504
527
  end
505
- reply.content[index] = Anthropic::Internal::Type::Converter.coerce(block.class, {**block.to_h, parsed:})
528
+ reply.content[index] =
529
+ Anthropic::Internal::Type::Converter.coerce(block.class, {**block.to_h, parsed:})
506
530
  end
507
531
  end
508
532
 
@@ -272,7 +272,11 @@ module Anthropic
272
272
  raise
273
273
  ensure
274
274
  if tool_runner_span
275
- Anthropic::Helpers::Tracing.end_tool_runner_span(tool_runner_span, returned: returned, error: error)
275
+ Anthropic::Helpers::Tracing.end_tool_runner_span(
276
+ tool_runner_span,
277
+ returned: returned,
278
+ error: error
279
+ )
276
280
  end
277
281
  @tool_runner_otel_context, @app_otel_context, @stopped_by_app = outer
278
282
  end
@@ -349,7 +353,12 @@ module Anthropic
349
353
  begin
350
354
  # `parsed` was read against `params[:tools]`, which an added tool is not in.
351
355
  input = tool_use.parsed
352
- input = Anthropic::Internal::Type::Converter.coerce(tool, tool_use.input) if @tool_overrides.key?(tool_use.name)
356
+ if @tool_overrides.key?(tool_use.name)
357
+ input = Anthropic::Internal::Type::Converter.coerce(
358
+ tool,
359
+ tool_use.input
360
+ )
361
+ end
353
362
  run = proc { tool.call(input) }
354
363
  raw = tool_use_span ? OpenTelemetry::Trace.with_span(tool_use_span, &run) : run.call
355
364
  is_error = false
@@ -360,7 +369,12 @@ module Anthropic
360
369
  if tool_use_span
361
370
  # `is_error` is unset when the run was interrupted, and then so is the span's status.
362
371
  result = {content: tool_result_content(raw), is_error:} unless is_error.nil?
363
- Anthropic::Helpers::Tracing.end_tool_use_span(@client, tool_use_span, tool_use.input, result)
372
+ Anthropic::Helpers::Tracing.end_tool_use_span(
373
+ @client,
374
+ tool_use_span,
375
+ tool_use.input,
376
+ result
377
+ )
364
378
  end
365
379
  end
366
380
  else
@@ -597,7 +611,10 @@ module Anthropic
597
611
  # A compaction response replaces the history, `tool_removal` blocks included, so what the
598
612
  # history took away is taken out of the overrides first.
599
613
  private def keep_removals_from_history
600
- runnable = [*params[:tools].to_a.grep(Anthropic::Helpers::Tools::BaseTool), *@tool_overrides.values.compact]
614
+ runnable = [
615
+ *params[:tools].to_a.grep(Anthropic::Helpers::Tools::BaseTool),
616
+ *@tool_overrides.values.compact
617
+ ]
601
618
  names = runnable.map { Anthropic::Helpers::Messages.tool_api_name(_1) }
602
619
  (names - available_tool_names(runnable).to_a).each { @tool_overrides.store(_1, nil) }
603
620
  end
@@ -26,7 +26,14 @@ module Anthropic
26
26
  # @param content_limit [Integer] the most bytes the `content` attributes hold
27
27
  #
28
28
  # @return [Array(Enumerator, Anthropic::Helpers::Tracing::StreamedMessage)]
29
- def follow_streamed_message(span, events, params:, start_time:, content:, content_limit: CONTENT_LIMIT)
29
+ def follow_streamed_message(
30
+ span,
31
+ events,
32
+ params:,
33
+ start_time:,
34
+ content:,
35
+ content_limit: CONTENT_LIMIT
36
+ )
30
37
  tracker = StreamedMessage.new(
31
38
  span,
32
39
  params: params,
@@ -366,6 +366,7 @@ module Anthropic
366
366
  "anthropic.organization.claude_tag.slack_workspaces.update"
367
367
  ORGANIZATION_CLAUDE_TAG_SLACK_WORKSPACES_LIST = "anthropic.organization.claude_tag.slack_workspaces.list"
368
368
  ORGANIZATION_CLAUDE_TAG_BUNDLES_RETRIEVE = "anthropic.organization.claude_tag.bundles.retrieve"
369
+ ORGANIZATION_CLAUDE_TAG_BUNDLES_UPDATE = "anthropic.organization.claude_tag.bundles.update"
369
370
  ORGANIZATION_CLAUDE_TAG_BUNDLES_LIST = "anthropic.organization.claude_tag.bundles.list"
370
371
  ORGANIZATION_CLAUDE_TAG_BUNDLES_TARGETS_CREATE =
371
372
  "anthropic.organization.claude_tag.bundles.targets.create"
@@ -92,6 +92,17 @@ module Anthropic
92
92
  in Anthropic::FilePart if value.content.is_a?(IO)
93
93
  state[:can_retry] = false
94
94
  value
95
+ in Anthropic::FilePart if IO.try_convert(value.content)
96
+ dump(
97
+ Anthropic::FilePart.new(
98
+ value.content.to_io,
99
+ filename: value.filename,
100
+ content_type: value.content_type
101
+ ),
102
+ state: state
103
+ )
104
+ in -> { IO.try_convert(_1) }
105
+ dump(value.to_io, state: state)
95
106
  else
96
107
  value
97
108
  end
@@ -473,18 +473,23 @@ module Anthropic
473
473
  #
474
474
  # @param max_len [Integer, nil]
475
475
  #
476
- # @return [String]
476
+ # @return [String, nil]
477
477
  private def read_enum(max_len)
478
478
  case max_len
479
479
  in nil
480
- @stream.to_a.join
480
+ loop { @buf << @stream.next }
481
+ @stream = nil
482
+ @buf.slice!(0..)
481
483
  in Integer
482
484
  @buf << @stream.next while @buf.length < max_len
483
- @buf.slice!(..max_len)
485
+ @buf.slice!(0, max_len)
484
486
  end
485
487
  rescue StopIteration
486
488
  @stream = nil
487
- @buf.slice!(0..)
489
+ # Return nil, not "", once the body is used up, as `IO#read(length)` does: Net::HTTP sends each read as a
490
+ # chunk, and an empty chunk ends the body, so "" would end it twice and break the next request on the
491
+ # connection.
492
+ @buf.slice!(0..) unless @buf.empty?
488
493
  end
489
494
 
490
495
  # @api private
@@ -496,15 +501,19 @@ module Anthropic
496
501
  def read(max_len = nil, out_string = nil)
497
502
  case @stream
498
503
  in nil
504
+ out_string&.clear
499
505
  nil
500
506
  in IO | StringIO
501
507
  @stream.read(max_len, out_string)
502
508
  in Enumerator
503
509
  read = read_enum(max_len)
504
- case out_string
505
- in String
510
+ case [out_string, read]
511
+ in [String, String]
506
512
  out_string.replace(read)
507
- in nil
513
+ in [String, nil]
514
+ out_string.clear
515
+ nil
516
+ in [nil, _]
508
517
  read
509
518
  end
510
519
  end
@@ -525,6 +534,10 @@ module Anthropic
525
534
  in Pathname
526
535
  @closing = true
527
536
  src.open(binmode: true)
537
+ in Enumerator
538
+ # Each retry or redirect reads the same body through a new adapter. Calling `next` on `src` itself would
539
+ # resume where the previous adapter stopped; `to_enum` starts from the beginning.
540
+ src.to_enum
528
541
  else
529
542
  src
530
543
  end
@@ -540,8 +553,10 @@ module Anthropic
540
553
  # @return [Enumerable<String>]
541
554
  def writable_enum(&blk)
542
555
  Enumerator.new do |y|
556
+ y.define_singleton_method(:<<) { super(_1.b) }
543
557
  y.define_singleton_method(:write) do
544
- self << _1.dup
558
+ # `IO.copy_stream` reuses its buffer. With Ruby bug #21131, a `dup` or `b` of it changes on the next read.
559
+ self << (String.new(capacity: _1.bytesize) << _1)
545
560
  _1.bytesize
546
561
  end
547
562
 
@@ -553,7 +568,7 @@ module Anthropic
553
568
  # @type [Regexp]
554
569
  JSON_CONTENT = %r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}
555
570
  # @type [Regexp]
556
- JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}
571
+ JSONL_CONTENT = %r{^application/(?:x-(?:n|l)djson|(?:x-)?jsonl)}
557
572
 
558
573
  class << self
559
574
  # @api private
@@ -685,6 +700,9 @@ module Anthropic
685
700
  # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
686
701
  boundary = SecureRandom.urlsafe_base64(30)
687
702
 
703
+ # Each read of `strio` runs this block from the start, so a retry or redirect sends the whole body. A read
704
+ # stopped partway skips the `ensure` below; `ReadIOAdapter#close` then starts a new read and stops it at the
705
+ # first chunk, and that read's `ensure` closes every file left in `closing`.
688
706
  closing = []
689
707
  strio = writable_enum do |y|
690
708
  case body
@@ -703,10 +721,24 @@ module Anthropic
703
721
  write_multipart_chunk(y, boundary: boundary, key: nil, val: body, closing: closing)
704
722
  end
705
723
  y << "--#{boundary}--\r\n"
724
+ ensure
725
+ closing.each(&:call)
726
+ closing.clear
727
+ end
728
+
729
+ # An IO can be read only once, so a second read of `strio` would send the other parts with an empty file part.
730
+ # `fused_enum` yields nothing instead. Resource methods turn retries off for a body holding an IO; a retry
731
+ # through `client.request`, or a 307 or 308 redirect, can still send it without the file's contents.
732
+ parts = if body.is_a?(Hash)
733
+ body.values.flat_map { _1.is_a?(Array) ? _1 : [_1] }
734
+ else
735
+ [body]
736
+ end
737
+ if parts.any? { _1.is_a?(IO) || (_1.is_a?(Anthropic::FilePart) && _1.content.is_a?(IO)) }
738
+ return [boundary, fused_enum(strio) { closing.each(&:call) }]
706
739
  end
707
740
 
708
- fused_io = fused_enum(strio) { closing.each(&:call) }
709
- [boundary, fused_io]
741
+ [boundary, strio]
710
742
  # rubocop:enable Style/CaseEquality
711
743
  end
712
744
 
@@ -9,24 +9,12 @@ module Anthropic
9
9
  module AnthropicBeta
10
10
  extend Anthropic::Internal::Type::Union
11
11
 
12
- variant const: -> { Anthropic::Models::AnthropicBeta::MESSAGE_BATCHES_2024_09_24 }
13
-
14
- variant const: -> { Anthropic::Models::AnthropicBeta::PROMPT_CACHING_2024_07_31 }
15
-
16
12
  variant const: -> { Anthropic::Models::AnthropicBeta::COMPUTER_USE_2024_10_22 }
17
13
 
18
14
  variant const: -> { Anthropic::Models::AnthropicBeta::COMPUTER_USE_2025_01_24 }
19
15
 
20
- variant const: -> { Anthropic::Models::AnthropicBeta::PDFS_2024_09_25 }
21
-
22
- variant const: -> { Anthropic::Models::AnthropicBeta::TOKEN_COUNTING_2024_11_01 }
23
-
24
- variant const: -> { Anthropic::Models::AnthropicBeta::TOKEN_EFFICIENT_TOOLS_2025_02_19 }
25
-
26
16
  variant const: -> { Anthropic::Models::AnthropicBeta::OUTPUT_128K_2025_02_19 }
27
17
 
28
- variant const: -> { Anthropic::Models::AnthropicBeta::FILES_API_2025_04_14 }
29
-
30
18
  variant const: -> { Anthropic::Models::AnthropicBeta::MCP_CLIENT_2025_04_04 }
31
19
 
32
20
  variant const: -> { Anthropic::Models::AnthropicBeta::MCP_CLIENT_2025_11_20 }
@@ -37,16 +25,12 @@ module Anthropic
37
25
 
38
26
  variant const: -> { Anthropic::Models::AnthropicBeta::CODE_EXECUTION_2025_05_22 }
39
27
 
40
- variant const: -> { Anthropic::Models::AnthropicBeta::EXTENDED_CACHE_TTL_2025_04_11 }
41
-
42
28
  variant const: -> { Anthropic::Models::AnthropicBeta::CONTEXT_1M_2025_08_07 }
43
29
 
44
30
  variant const: -> { Anthropic::Models::AnthropicBeta::CONTEXT_MANAGEMENT_2025_06_27 }
45
31
 
46
32
  variant const: -> { Anthropic::Models::AnthropicBeta::MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26 }
47
33
 
48
- variant const: -> { Anthropic::Models::AnthropicBeta::SKILLS_2025_10_02 }
49
-
50
34
  variant const: -> { Anthropic::Models::AnthropicBeta::FAST_MODE_2026_02_01 }
51
35
 
52
36
  variant const: -> { Anthropic::Models::AnthropicBeta::OUTPUT_300K_2026_03_24 }
@@ -61,8 +45,6 @@ module Anthropic
61
45
 
62
46
  variant const: -> { Anthropic::Models::AnthropicBeta::MANAGED_AGENTS_2026_04_01 }
63
47
 
64
- variant const: -> { Anthropic::Models::AnthropicBeta::CACHE_DIAGNOSIS_2026_04_07 }
65
-
66
48
  variant const: -> { Anthropic::Models::AnthropicBeta::DREAMING_2026_04_21 }
67
49
 
68
50
  variant const: -> { Anthropic::Models::AnthropicBeta::THINKING_TOKEN_COUNT_2026_05_13 }
@@ -91,8 +73,6 @@ module Anthropic
91
73
 
92
74
  variant const: -> { Anthropic::Models::AnthropicBeta::THINKING_DISPLAY_UPDATES_2026_08_18 }
93
75
 
94
- variant const: -> { Anthropic::Models::AnthropicBeta::CE_USER_MANAGEMENT_2026_07_13 }
95
-
96
76
  variant const: -> { Anthropic::Models::AnthropicBeta::MID_CONVERSATION_OUTPUT_CONFIG_2026_07_01 }
97
77
 
98
78
  variant const: -> { Anthropic::Models::AnthropicBeta::THINKING_BINDING_CONTROLS_2026_08_01 }
@@ -121,6 +101,26 @@ module Anthropic
121
101
 
122
102
  variant const: -> { Anthropic::Models::AnthropicBeta::EXPERIMENTAL_CLAUDE_TAG_2026_10_21 }
123
103
 
104
+ variant const: -> { Anthropic::Models::AnthropicBeta::MESSAGE_BATCHES_2024_09_24 }
105
+
106
+ variant const: -> { Anthropic::Models::AnthropicBeta::PROMPT_CACHING_2024_07_31 }
107
+
108
+ variant const: -> { Anthropic::Models::AnthropicBeta::PDFS_2024_09_25 }
109
+
110
+ variant const: -> { Anthropic::Models::AnthropicBeta::TOKEN_COUNTING_2024_11_01 }
111
+
112
+ variant const: -> { Anthropic::Models::AnthropicBeta::TOKEN_EFFICIENT_TOOLS_2025_02_19 }
113
+
114
+ variant const: -> { Anthropic::Models::AnthropicBeta::FILES_API_2025_04_14 }
115
+
116
+ variant const: -> { Anthropic::Models::AnthropicBeta::EXTENDED_CACHE_TTL_2025_04_11 }
117
+
118
+ variant const: -> { Anthropic::Models::AnthropicBeta::SKILLS_2025_10_02 }
119
+
120
+ variant const: -> { Anthropic::Models::AnthropicBeta::CACHE_DIAGNOSIS_2026_04_07 }
121
+
122
+ variant const: -> { Anthropic::Models::AnthropicBeta::CE_USER_MANAGEMENT_2026_07_13 }
123
+
124
124
  variant String
125
125
 
126
126
  # @!method self.variants
@@ -132,25 +132,17 @@ module Anthropic
132
132
 
133
133
  # @!group
134
134
 
135
- MESSAGE_BATCHES_2024_09_24 = :"message-batches-2024-09-24"
136
- PROMPT_CACHING_2024_07_31 = :"prompt-caching-2024-07-31"
137
135
  COMPUTER_USE_2024_10_22 = :"computer-use-2024-10-22"
138
136
  COMPUTER_USE_2025_01_24 = :"computer-use-2025-01-24"
139
- PDFS_2024_09_25 = :"pdfs-2024-09-25"
140
- TOKEN_COUNTING_2024_11_01 = :"token-counting-2024-11-01"
141
- TOKEN_EFFICIENT_TOOLS_2025_02_19 = :"token-efficient-tools-2025-02-19"
142
137
  OUTPUT_128K_2025_02_19 = :"output-128k-2025-02-19"
143
- FILES_API_2025_04_14 = :"files-api-2025-04-14"
144
138
  MCP_CLIENT_2025_04_04 = :"mcp-client-2025-04-04"
145
139
  MCP_CLIENT_2025_11_20 = :"mcp-client-2025-11-20"
146
140
  DEV_FULL_THINKING_2025_05_14 = :"dev-full-thinking-2025-05-14"
147
141
  INTERLEAVED_THINKING_2025_05_14 = :"interleaved-thinking-2025-05-14"
148
142
  CODE_EXECUTION_2025_05_22 = :"code-execution-2025-05-22"
149
- EXTENDED_CACHE_TTL_2025_04_11 = :"extended-cache-ttl-2025-04-11"
150
143
  CONTEXT_1M_2025_08_07 = :"context-1m-2025-08-07"
151
144
  CONTEXT_MANAGEMENT_2025_06_27 = :"context-management-2025-06-27"
152
145
  MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26 = :"model-context-window-exceeded-2025-08-26"
153
- SKILLS_2025_10_02 = :"skills-2025-10-02"
154
146
  FAST_MODE_2026_02_01 = :"fast-mode-2026-02-01"
155
147
  OUTPUT_300K_2026_03_24 = :"output-300k-2026-03-24"
156
148
  USER_PROFILES_2026_03_24 = :"user-profiles-2026-03-24"
@@ -158,7 +150,6 @@ module Anthropic
158
150
  USER_PROFILES_2026_09_04 = :"user-profiles-2026-09-04"
159
151
  ADVISOR_TOOL_2026_03_01 = :"advisor-tool-2026-03-01"
160
152
  MANAGED_AGENTS_2026_04_01 = :"managed-agents-2026-04-01"
161
- CACHE_DIAGNOSIS_2026_04_07 = :"cache-diagnosis-2026-04-07"
162
153
  DREAMING_2026_04_21 = :"dreaming-2026-04-21"
163
154
  THINKING_TOKEN_COUNT_2026_05_13 = :"thinking-token-count-2026-05-13"
164
155
  SERVER_SIDE_FALLBACK_2026_06_01 = :"server-side-fallback-2026-06-01"
@@ -173,7 +164,6 @@ module Anthropic
173
164
  STRUCTURED_OUTPUTS_2025_11_13 = :"structured-outputs-2025-11-13"
174
165
  TASK_BUDGETS_2026_03_13 = :"task-budgets-2026-03-13"
175
166
  THINKING_DISPLAY_UPDATES_2026_08_18 = :"thinking-display-updates-2026-08-18"
176
- CE_USER_MANAGEMENT_2026_07_13 = :"ce-user-management-2026-07-13"
177
167
  MID_CONVERSATION_OUTPUT_CONFIG_2026_07_01 = :"mid-conversation-output-config-2026-07-01"
178
168
  THINKING_BINDING_CONTROLS_2026_08_01 = :"thinking-binding-controls-2026-08-01"
179
169
  MID_CONVERSATION_SYSTEM_CLEAR_AT_2026_08_21 = :"mid-conversation-system-clear-at-2026-08-21"
@@ -188,6 +178,30 @@ module Anthropic
188
178
  MESSAGE_THREADS_2026_08_12 = :"message-threads-2026-08-12"
189
179
  ANALYTICS_USAGE_COST_2026_08_24 = :"analytics-usage-cost-2026-08-24"
190
180
  EXPERIMENTAL_CLAUDE_TAG_2026_10_21 = :"experimental-claude-tag-2026-10-21"
181
+ # @deprecated This value is no longer needed. Remove it from your requests.
182
+ MESSAGE_BATCHES_2024_09_24 = :"message-batches-2024-09-24"
183
+ # @deprecated This value is no longer needed. Remove it from your requests.
184
+ PROMPT_CACHING_2024_07_31 = :"prompt-caching-2024-07-31"
185
+ # @deprecated This value is no longer needed. Remove it from your requests.
186
+ PDFS_2024_09_25 = :"pdfs-2024-09-25"
187
+ # @deprecated This value is no longer needed. Remove it from your requests.
188
+ TOKEN_COUNTING_2024_11_01 = :"token-counting-2024-11-01"
189
+ # @deprecated This value is no longer needed. Remove it from your requests.
190
+ TOKEN_EFFICIENT_TOOLS_2025_02_19 = :"token-efficient-tools-2025-02-19"
191
+ # @deprecated Sending this value selects the beta response shapes. Removing it moves you to
192
+ # the current shapes, so follow the migration steps:
193
+ # https://platform.claude.com/docs/en/build-with-claude/files#migrate-from-files-api-2025-04-14
194
+ FILES_API_2025_04_14 = :"files-api-2025-04-14"
195
+ # @deprecated This value is no longer needed. Remove it from your requests.
196
+ EXTENDED_CACHE_TTL_2025_04_11 = :"extended-cache-ttl-2025-04-11"
197
+ # @deprecated Sending this value selects the beta response shapes. Removing it moves you to
198
+ # the current shapes, so follow the migration steps:
199
+ # https://platform.claude.com/docs/en/build-with-claude/skills-guide#migrate-from-skills-2025-10-02
200
+ SKILLS_2025_10_02 = :"skills-2025-10-02"
201
+ # @deprecated This value is no longer needed. Remove it from your requests.
202
+ CACHE_DIAGNOSIS_2026_04_07 = :"cache-diagnosis-2026-04-07"
203
+ # @deprecated This value is no longer needed. Remove it from your requests.
204
+ CE_USER_MANAGEMENT_2026_07_13 = :"ce-user-management-2026-07-13"
191
205
 
192
206
  # @!endgroup
193
207
  end
@@ -37,7 +37,7 @@ module Anthropic
37
37
  # Tool calls require user confirmation before execution.
38
38
  variant :always_ask, -> { Anthropic::Beta::BetaManagedAgentsAlwaysAskPolicy }
39
39
 
40
- # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.
40
+ # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask, or for some causes to deny, for example when the organization is out of credits or has reached a spend limit.
41
41
  variant :auto, -> { Anthropic::Beta::BetaManagedAgentsAutoPolicy }
42
42
 
43
43
  module Type
@@ -48,7 +48,7 @@ module Anthropic
48
48
  # Tool calls require user confirmation before execution.
49
49
  variant :always_ask, -> { Anthropic::Beta::BetaManagedAgentsAlwaysAskPolicy }
50
50
 
51
- # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.
51
+ # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask, or for some causes to deny, for example when the organization is out of credits or has reached a spend limit.
52
52
  variant :auto, -> { Anthropic::Beta::BetaManagedAgentsAutoPolicy }
53
53
 
54
54
  module Type
@@ -13,7 +13,9 @@ module Anthropic
13
13
  # The server decides each tool call individually: it judges, from the tool, its
14
14
  # input, and the session content so far, whether the call is safe to execute or
15
15
  # high-risk, and evaluates it to allow when judged safe and to deny when judged
16
- # high-risk. A call the server cannot reach a judgement on evaluates to ask.
16
+ # high-risk. A call the server cannot reach a judgement on evaluates to ask, or
17
+ # for some causes to deny, for example when the organization is out of credits or
18
+ # has reached a spend limit.
17
19
  #
18
20
  # @param type [Symbol, :auto]
19
21
  end
@@ -51,7 +51,7 @@ module Anthropic
51
51
  # Tool calls require user confirmation before execution.
52
52
  variant :always_ask, -> { Anthropic::Beta::BetaManagedAgentsAlwaysAskPolicy }
53
53
 
54
- # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.
54
+ # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask, or for some causes to deny, for example when the organization is out of credits or has reached a spend limit.
55
55
  variant :auto, -> { Anthropic::Beta::BetaManagedAgentsAutoPolicy }
56
56
 
57
57
  module Type
@@ -61,7 +61,7 @@ module Anthropic
61
61
  # Tool calls require user confirmation before execution.
62
62
  variant :always_ask, -> { Anthropic::Beta::BetaManagedAgentsAlwaysAskPolicy }
63
63
 
64
- # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.
64
+ # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask, or for some causes to deny, for example when the organization is out of credits or has reached a spend limit.
65
65
  variant :auto, -> { Anthropic::Beta::BetaManagedAgentsAutoPolicy }
66
66
 
67
67
  module Type
@@ -51,7 +51,7 @@ module Anthropic
51
51
  # Tool calls require user confirmation before execution.
52
52
  variant :always_ask, -> { Anthropic::Beta::BetaManagedAgentsAlwaysAskPolicy }
53
53
 
54
- # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.
54
+ # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask, or for some causes to deny, for example when the organization is out of credits or has reached a spend limit.
55
55
  variant :auto, -> { Anthropic::Beta::BetaManagedAgentsAutoPolicy }
56
56
 
57
57
  module Type
@@ -61,7 +61,7 @@ module Anthropic
61
61
  # Tool calls require user confirmation before execution.
62
62
  variant :always_ask, -> { Anthropic::Beta::BetaManagedAgentsAlwaysAskPolicy }
63
63
 
64
- # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.
64
+ # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask, or for some causes to deny, for example when the organization is out of credits or has reached a spend limit.
65
65
  variant :auto, -> { Anthropic::Beta::BetaManagedAgentsAutoPolicy }
66
66
 
67
67
  module Type
@@ -51,7 +51,7 @@ module Anthropic
51
51
  # Tool calls require user confirmation before execution.
52
52
  variant :always_ask, -> { Anthropic::Beta::BetaManagedAgentsAlwaysAskPolicy }
53
53
 
54
- # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.
54
+ # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask, or for some causes to deny, for example when the organization is out of credits or has reached a spend limit.
55
55
  variant :auto, -> { Anthropic::Beta::BetaManagedAgentsAutoPolicy }
56
56
 
57
57
  module Type
@@ -61,7 +61,7 @@ module Anthropic
61
61
  # Tool calls require user confirmation before execution.
62
62
  variant :always_ask, -> { Anthropic::Beta::BetaManagedAgentsAlwaysAskPolicy }
63
63
 
64
- # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.
64
+ # The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask, or for some causes to deny, for example when the organization is out of credits or has reached a spend limit.
65
65
  variant :auto, -> { Anthropic::Beta::BetaManagedAgentsAutoPolicy }
66
66
 
67
67
  module Type