anthropic 1.72.0 → 1.74.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +68 -0
- data/README.md +2 -2
- data/lib/anthropic/helpers/messages.rb +76 -43
- data/lib/anthropic/helpers/refusal_fallback.rb +19 -5
- data/lib/anthropic/helpers/tools/runner.rb +319 -143
- data/lib/anthropic/internal/transport/base_client.rb +3 -0
- data/lib/anthropic/internal/type/file_input.rb +2 -3
- data/lib/anthropic/models/anthropic_beta.rb +6 -0
- data/lib/anthropic/models/beta/agent_archive_params.rb +12 -2
- data/lib/anthropic/models/beta/agent_create_params.rb +12 -6
- data/lib/anthropic/models/beta/agent_list_params.rb +10 -1
- data/lib/anthropic/models/beta/agent_retrieve_params.rb +9 -2
- data/lib/anthropic/models/beta/agent_update_params.rb +14 -7
- data/lib/anthropic/models/beta/agents/version_list_params.rb +12 -2
- data/lib/anthropic/models/beta/beta_browser_toolset_20260801.rb +3 -6
- data/lib/anthropic/models/beta/beta_cache_miss_reason.rb +77 -0
- data/lib/anthropic/models/beta/beta_cloud_config_params.rb +4 -9
- data/lib/anthropic/models/beta/beta_compaction_block.rb +74 -1
- data/lib/anthropic/models/beta/beta_compaction_block_param.rb +80 -1
- data/lib/anthropic/models/beta/beta_computer_toolset_20260801.rb +3 -6
- data/lib/anthropic/models/beta/beta_content_block.rb +17 -2
- data/lib/anthropic/models/beta/beta_content_block_param.rb +30 -11
- data/lib/anthropic/models/beta/beta_context_management_capability.rb +6 -6
- data/lib/anthropic/models/beta/beta_diagnostics.rb +3 -81
- data/lib/anthropic/models/beta/beta_dream.rb +72 -26
- data/lib/anthropic/models/beta/beta_dream_error.rb +12 -2
- data/lib/anthropic/models/beta/beta_dream_input.rb +10 -4
- data/lib/anthropic/models/beta/beta_dream_memory_store_input.rb +13 -4
- data/lib/anthropic/models/beta/beta_dream_memory_store_output.rb +10 -2
- data/lib/anthropic/models/beta/beta_dream_model_config.rb +10 -11
- data/lib/anthropic/models/beta/beta_dream_model_config_param.rb +16 -10
- data/lib/anthropic/models/beta/beta_dream_output.rb +11 -2
- data/lib/anthropic/models/beta/beta_dream_sessions_input.rb +14 -2
- data/lib/anthropic/models/beta/beta_dream_status.rb +11 -2
- data/lib/anthropic/models/beta/beta_dream_usage.rb +22 -9
- data/lib/anthropic/models/beta/beta_dreaming_error.rb +4 -2
- data/lib/anthropic/models/beta/beta_effort_capability.rb +2 -2
- data/lib/anthropic/models/beta/beta_fallback_param.rb +10 -5
- data/lib/anthropic/models/beta/beta_fallback_refusal_trigger.rb +10 -3
- data/lib/anthropic/models/beta/beta_managed_agents_agent.rb +4 -4
- data/lib/anthropic/models/beta/beta_managed_agents_agent_tool_config_params.rb +1 -1
- data/lib/anthropic/models/beta/beta_managed_agents_agent_toolset20260401_params.rb +2 -2
- data/lib/anthropic/models/beta/beta_managed_agents_agent_toolset_default_config_params.rb +5 -3
- data/lib/anthropic/models/beta/beta_managed_agents_agent_with_overrides_params.rb +2 -2
- data/lib/anthropic/models/beta/beta_managed_agents_bash_tool_config_params.rb +5 -3
- data/lib/anthropic/models/beta/beta_managed_agents_budget_limit.rb +6 -2
- data/lib/anthropic/models/beta/beta_managed_agents_cron_schedule.rb +3 -2
- data/lib/anthropic/models/beta/beta_managed_agents_custom_tool_params.rb +2 -2
- data/lib/anthropic/models/beta/beta_managed_agents_delta_content.rb +3 -2
- data/lib/anthropic/models/beta/beta_managed_agents_deployment.rb +21 -17
- data/lib/anthropic/models/beta/beta_managed_agents_deployment_initial_event.rb +1 -1
- data/lib/anthropic/models/beta/beta_managed_agents_deployment_initial_event_params.rb +1 -1
- data/lib/anthropic/models/beta/beta_managed_agents_deployment_paused_reason.rb +1 -1
- data/lib/anthropic/models/beta/beta_managed_agents_deployment_run.rb +12 -11
- data/lib/anthropic/models/beta/beta_managed_agents_deployment_user_define_outcome_event.rb +3 -3
- data/lib/anthropic/models/beta/beta_managed_agents_deployment_user_message_event.rb +1 -1
- data/lib/anthropic/models/beta/beta_managed_agents_edit_tool_config_params.rb +5 -3
- data/lib/anthropic/models/beta/beta_managed_agents_error_deployment_paused_reason.rb +2 -2
- data/lib/anthropic/models/beta/beta_managed_agents_glob_tool_config_params.rb +5 -3
- data/lib/anthropic/models/beta/beta_managed_agents_grep_tool_config_params.rb +5 -3
- data/lib/anthropic/models/beta/beta_managed_agents_mcp_tool_config_params.rb +3 -3
- data/lib/anthropic/models/beta/beta_managed_agents_mcp_toolset_default_config_params.rb +3 -3
- data/lib/anthropic/models/beta/beta_managed_agents_mcp_toolset_params.rb +2 -2
- data/lib/anthropic/models/beta/beta_managed_agents_memory_store.rb +9 -6
- data/lib/anthropic/models/beta/beta_managed_agents_memory_store_resource_config.rb +5 -3
- data/lib/anthropic/models/beta/beta_managed_agents_memory_store_resource_param.rb +5 -3
- data/lib/anthropic/models/beta/beta_managed_agents_model.rb +11 -1
- data/lib/anthropic/models/beta/beta_managed_agents_model_config.rb +11 -9
- data/lib/anthropic/models/beta/beta_managed_agents_model_config_params.rb +3 -7
- data/lib/anthropic/models/beta/beta_managed_agents_multiagent.rb +1 -1
- data/lib/anthropic/models/beta/beta_managed_agents_multiagent_params.rb +2 -2
- data/lib/anthropic/models/beta/beta_managed_agents_outcome_evaluation_resource.rb +3 -2
- data/lib/anthropic/models/beta/beta_managed_agents_read_tool_config_params.rb +5 -3
- data/lib/anthropic/models/beta/beta_managed_agents_schedule.rb +5 -3
- data/lib/anthropic/models/beta/beta_managed_agents_schedule_params.rb +1 -2
- data/lib/anthropic/models/beta/beta_managed_agents_schedule_trigger_context.rb +8 -2
- data/lib/anthropic/models/beta/beta_managed_agents_session.rb +8 -9
- data/lib/anthropic/models/beta/beta_managed_agents_session_agent.rb +3 -3
- data/lib/anthropic/models/beta/beta_managed_agents_session_agent_update.rb +2 -2
- data/lib/anthropic/models/beta/beta_managed_agents_session_resource_config.rb +1 -1
- data/lib/anthropic/models/beta/beta_managed_agents_session_updated_event.rb +10 -8
- data/lib/anthropic/models/beta/beta_managed_agents_session_usage.rb +8 -6
- data/lib/anthropic/models/beta/beta_managed_agents_session_usage_event.rb +7 -7
- data/lib/anthropic/models/beta/beta_managed_agents_system_content_block.rb +1 -1
- data/lib/anthropic/models/beta/beta_managed_agents_system_message_event.rb +2 -2
- data/lib/anthropic/models/beta/beta_managed_agents_trigger_context.rb +4 -1
- data/lib/anthropic/models/beta/beta_managed_agents_user_tool_result_event.rb +4 -4
- data/lib/anthropic/models/beta/beta_managed_agents_vault.rb +2 -2
- data/lib/anthropic/models/beta/beta_managed_agents_web_fetch_tool_config_params.rb +5 -3
- data/lib/anthropic/models/beta/beta_managed_agents_web_search_tool_config_params.rb +5 -3
- data/lib/anthropic/models/beta/beta_managed_agents_write_tool_config_params.rb +5 -3
- data/lib/anthropic/models/beta/beta_mcp_tool.rb +34 -0
- data/lib/anthropic/models/beta/beta_mcp_tool_listing_block.rb +35 -0
- data/lib/anthropic/models/beta/beta_mcp_tool_listing_block_param.rb +43 -0
- data/lib/anthropic/models/beta/beta_mcp_tool_param.rb +39 -0
- data/lib/anthropic/models/beta/beta_mcp_toolset.rb +19 -1
- data/lib/anthropic/models/beta/beta_message.rb +13 -10
- data/lib/anthropic/models/beta/beta_message_delta_usage.rb +4 -0
- data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
- data/lib/anthropic/models/beta/beta_model_capabilities.rb +3 -4
- data/lib/anthropic/models/beta/beta_model_info.rb +3 -2
- data/lib/anthropic/models/beta/beta_output_behavior.rb +12 -3
- data/lib/anthropic/models/beta/beta_output_behavior_create_new.rb +5 -3
- data/lib/anthropic/models/beta/beta_output_behavior_update_existing.rb +13 -4
- data/lib/anthropic/models/beta/beta_output_config.rb +11 -5
- data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +19 -4
- data/lib/anthropic/models/beta/beta_raw_message_delta_event.rb +8 -5
- data/lib/anthropic/models/beta/beta_raw_message_stream_event.rb +1 -1
- data/lib/anthropic/models/beta/beta_refusal_stop_details.rb +7 -3
- data/lib/anthropic/models/beta/beta_request_tool_addition_block.rb +26 -10
- data/lib/anthropic/models/beta/beta_request_tool_removal_block.rb +7 -5
- data/lib/anthropic/models/beta/beta_response_tool.rb +132 -0
- data/lib/anthropic/models/beta/beta_response_tool_addition_block.rb +112 -0
- data/lib/anthropic/models/beta/beta_response_tool_change_mcp_tool_reference.rb +35 -0
- data/lib/anthropic/models/beta/beta_response_tool_change_mcp_toolset_reference.rb +28 -0
- data/lib/anthropic/models/beta/beta_response_tool_change_tool_reference.rb +30 -0
- data/lib/anthropic/models/beta/beta_response_tool_input_schema.rb +38 -0
- data/lib/anthropic/models/beta/beta_response_tool_removal_block.rb +96 -0
- data/lib/anthropic/models/beta/beta_response_tool_union.rb +92 -0
- data/lib/anthropic/models/beta/beta_system_message_output_config.rb +12 -3
- data/lib/anthropic/models/beta/beta_target_store_held_error.rb +13 -10
- data/lib/anthropic/models/beta/beta_thinking_block_binding.rb +6 -6
- data/lib/anthropic/models/beta/beta_thinking_config_adaptive.rb +3 -3
- data/lib/anthropic/models/beta/beta_thinking_config_between_tools.rb +19 -0
- data/lib/anthropic/models/beta/beta_thinking_config_enabled.rb +3 -3
- data/lib/anthropic/models/beta/beta_thinking_config_param.rb +8 -3
- data/lib/anthropic/models/beta/beta_tool_change_tool_definition.rb +29 -0
- data/lib/anthropic/models/beta/beta_tool_change_tool_definition_param.rb +29 -0
- data/lib/anthropic/models/beta/beta_tool_change_tool_reference.rb +3 -2
- data/lib/anthropic/models/beta/beta_tunnel.rb +5 -4
- data/lib/anthropic/models/beta/beta_usage.rb +7 -7
- data/lib/anthropic/models/beta/beta_user_profile.rb +35 -21
- data/lib/anthropic/models/beta/beta_user_profile_enrollment_url.rb +5 -2
- data/lib/anthropic/models/beta/beta_user_profile_external_user_details.rb +18 -18
- data/lib/anthropic/models/beta/beta_user_profile_external_user_details_params.rb +20 -18
- data/lib/anthropic/models/beta/beta_user_profile_trust_grant.rb +3 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +3 -7
- data/lib/anthropic/models/beta/beta_web_fetch_tool_20260209.rb +3 -7
- data/lib/anthropic/models/beta/beta_web_fetch_tool_20260309.rb +3 -7
- data/lib/anthropic/models/beta/beta_web_fetch_tool_20260318.rb +3 -7
- data/lib/anthropic/models/beta/deployment_archive_params.rb +12 -2
- data/lib/anthropic/models/beta/deployment_create_params.rb +17 -8
- data/lib/anthropic/models/beta/deployment_list_params.rb +7 -1
- data/lib/anthropic/models/beta/deployment_pause_params.rb +12 -2
- data/lib/anthropic/models/beta/deployment_retrieve_params.rb +12 -2
- data/lib/anthropic/models/beta/deployment_run_list_params.rb +7 -1
- data/lib/anthropic/models/beta/deployment_run_params.rb +12 -2
- data/lib/anthropic/models/beta/deployment_run_retrieve_params.rb +12 -2
- data/lib/anthropic/models/beta/deployment_unpause_params.rb +12 -2
- data/lib/anthropic/models/beta/deployment_update_params.rb +19 -9
- data/lib/anthropic/models/beta/dream_archive_params.rb +12 -2
- data/lib/anthropic/models/beta/dream_cancel_params.rb +12 -2
- data/lib/anthropic/models/beta/dream_create_params.rb +41 -6
- data/lib/anthropic/models/beta/dream_list_params.rb +25 -16
- data/lib/anthropic/models/beta/dream_retrieve_params.rb +12 -2
- data/lib/anthropic/models/beta/environment_archive_params.rb +10 -1
- data/lib/anthropic/models/beta/environment_create_params.rb +8 -2
- data/lib/anthropic/models/beta/environment_delete_params.rb +10 -1
- data/lib/anthropic/models/beta/environment_list_params.rb +7 -1
- data/lib/anthropic/models/beta/environment_retrieve_params.rb +10 -1
- data/lib/anthropic/models/beta/environment_update_params.rb +8 -2
- data/lib/anthropic/models/beta/environments/work_retrieve_params.rb +10 -1
- data/lib/anthropic/models/beta/environments/work_stats_params.rb +10 -1
- data/lib/anthropic/models/beta/environments/work_stop_params.rb +10 -1
- data/lib/anthropic/models/beta/environments/work_update_params.rb +10 -1
- data/lib/anthropic/models/beta/file_delete_params.rb +10 -1
- data/lib/anthropic/models/beta/file_download_params.rb +10 -1
- data/lib/anthropic/models/beta/file_list_params.rb +7 -1
- data/lib/anthropic/models/beta/file_retrieve_metadata_params.rb +10 -1
- data/lib/anthropic/models/beta/file_upload_params.rb +7 -1
- data/lib/anthropic/models/beta/memory_store_archive_params.rb +14 -2
- data/lib/anthropic/models/beta/memory_store_create_params.rb +7 -1
- data/lib/anthropic/models/beta/memory_store_delete_params.rb +14 -2
- data/lib/anthropic/models/beta/memory_store_list_params.rb +7 -1
- data/lib/anthropic/models/beta/memory_store_retrieve_params.rb +13 -2
- data/lib/anthropic/models/beta/memory_store_update_params.rb +11 -2
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_actor.rb +11 -13
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_api_actor.rb +4 -4
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_error.rb +15 -3
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory.rb +7 -4
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_list_item.rb +2 -2
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_path_conflict_error.rb +26 -3
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_precondition_failed_error.rb +14 -1
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version.rb +21 -19
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_precondition.rb +5 -6
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_service_account_actor.rb +4 -4
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_session_actor.rb +6 -6
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_user_actor.rb +3 -3
- data/lib/anthropic/models/beta/memory_stores/memory_create_params.rb +15 -4
- data/lib/anthropic/models/beta/memory_stores/memory_delete_params.rb +20 -5
- data/lib/anthropic/models/beta/memory_stores/memory_list_params.rb +9 -2
- data/lib/anthropic/models/beta/memory_stores/memory_retrieve_params.rb +20 -5
- data/lib/anthropic/models/beta/memory_stores/memory_update_params.rb +22 -12
- data/lib/anthropic/models/beta/memory_stores/memory_version_list_params.rb +37 -18
- data/lib/anthropic/models/beta/memory_stores/memory_version_redact_params.rb +15 -3
- data/lib/anthropic/models/beta/memory_stores/memory_version_retrieve_params.rb +21 -5
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +23 -18
- data/lib/anthropic/models/beta/message_create_params.rb +27 -21
- data/lib/anthropic/models/beta/messages/batch_cancel_params.rb +10 -1
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +35 -25
- data/lib/anthropic/models/beta/messages/batch_delete_params.rb +10 -1
- data/lib/anthropic/models/beta/messages/batch_list_params.rb +7 -1
- data/lib/anthropic/models/beta/messages/batch_results_params.rb +10 -1
- data/lib/anthropic/models/beta/messages/batch_retrieve_params.rb +10 -1
- data/lib/anthropic/models/beta/model_list_params.rb +7 -1
- data/lib/anthropic/models/beta/model_retrieve_params.rb +10 -1
- data/lib/anthropic/models/beta/organization/federation/beta_federation_issuer.rb +5 -6
- data/lib/anthropic/models/beta/organization/federation/rule_update_params.rb +4 -8
- data/lib/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit.rb +9 -7
- data/lib/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_organization_source.rb +27 -0
- data/lib/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_value.rb +63 -3
- data/lib/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_workspace_source.rb +22 -0
- data/lib/anthropic/models/beta/organization/workspaces/rate_limit_list_params.rb +10 -1
- data/lib/anthropic/models/beta/session_archive_params.rb +10 -1
- data/lib/anthropic/models/beta/session_create_params.rb +14 -6
- data/lib/anthropic/models/beta/session_delete_params.rb +10 -1
- data/lib/anthropic/models/beta/session_list_params.rb +7 -1
- data/lib/anthropic/models/beta/session_retrieve_params.rb +10 -1
- data/lib/anthropic/models/beta/session_update_params.rb +20 -8
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_custom_tool_use_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_evaluated_permission.rb +21 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_mcp_tool_result_event.rb +4 -4
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_mcp_tool_use_event.rb +14 -24
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_message_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_thinking_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_context_compacted_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_received_event.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_sent_event.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_evaluation.rb +1 -5
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_evaluation_auto.rb +2 -8
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_result_event.rb +4 -4
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_use_event.rb +14 -24
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_billing_error.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_credential_host_unreachable_error.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_document_block.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_event_params.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_image_block.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_mcp_authentication_failed_error.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_mcp_connection_failed_error.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_memory_store_resource.rb +5 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_model_overloaded_error.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_model_rate_limited_error.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_model_request_failed_error.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_search_result_block.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_send_session_events.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_deleted_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_error_event.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_event.rb +9 -9
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_event_type.rb +52 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_resource.rb +1 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_status_idle_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_status_rescheduled_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_status_running_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_status_terminated_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread.rb +19 -17
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_created_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_idle_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_rescheduled_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_running_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_terminated_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_usage.rb +12 -6
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_usage_snapshot.rb +7 -6
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_model_request_end_event.rb +4 -4
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_model_request_start_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_model_usage.rb +5 -7
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_end_event.rb +5 -4
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_ongoing_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_start_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_stream_session_events.rb +9 -9
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_stream_session_thread_events.rb +9 -9
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_unknown_error.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event.rb +4 -4
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event_params.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event.rb +7 -5
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event_params.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_interrupt_event.rb +2 -2
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_message_event.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_message_event_params.rb +1 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_tool_confirmation_event.rb +5 -5
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_tool_confirmation_event_params.rb +3 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_tool_result_event_params.rb +2 -2
- data/lib/anthropic/models/beta/sessions/event_list_params.rb +12 -6
- data/lib/anthropic/models/beta/sessions/event_send_params.rb +10 -1
- data/lib/anthropic/models/beta/sessions/event_stream_params.rb +7 -1
- data/lib/anthropic/models/beta/sessions/resource_add_params.rb +10 -1
- data/lib/anthropic/models/beta/sessions/resource_delete_params.rb +10 -1
- data/lib/anthropic/models/beta/sessions/resource_list_params.rb +7 -1
- data/lib/anthropic/models/beta/sessions/resource_retrieve_params.rb +10 -1
- data/lib/anthropic/models/beta/sessions/resource_retrieve_response.rb +1 -1
- data/lib/anthropic/models/beta/sessions/resource_update_params.rb +7 -1
- data/lib/anthropic/models/beta/sessions/resource_update_response.rb +1 -1
- data/lib/anthropic/models/beta/sessions/thread_archive_params.rb +10 -1
- data/lib/anthropic/models/beta/sessions/thread_list_params.rb +10 -1
- data/lib/anthropic/models/beta/sessions/thread_retrieve_params.rb +10 -1
- data/lib/anthropic/models/beta/sessions/threads/event_list_params.rb +12 -5
- data/lib/anthropic/models/beta/sessions/threads/event_stream_params.rb +7 -1
- data/lib/anthropic/models/beta/skill_create_params.rb +7 -1
- data/lib/anthropic/models/beta/skill_delete_params.rb +7 -1
- data/lib/anthropic/models/beta/skill_list_params.rb +7 -1
- data/lib/anthropic/models/beta/skill_retrieve_params.rb +7 -1
- data/lib/anthropic/models/beta/skills/version_create_params.rb +7 -1
- data/lib/anthropic/models/beta/skills/version_delete_params.rb +7 -1
- data/lib/anthropic/models/beta/skills/version_download_params.rb +7 -1
- data/lib/anthropic/models/beta/skills/version_list_params.rb +7 -1
- data/lib/anthropic/models/beta/skills/version_retrieve_params.rb +7 -1
- data/lib/anthropic/models/beta/tunnel_archive_params.rb +12 -2
- data/lib/anthropic/models/beta/tunnel_create_params.rb +10 -1
- data/lib/anthropic/models/beta/tunnel_list_params.rb +10 -1
- data/lib/anthropic/models/beta/tunnel_retrieve_params.rb +12 -2
- data/lib/anthropic/models/beta/tunnel_reveal_token_params.rb +12 -2
- data/lib/anthropic/models/beta/tunnel_rotate_token_params.rb +12 -2
- data/lib/anthropic/models/beta/tunnels/beta_tunnel_certificate.rb +11 -6
- data/lib/anthropic/models/beta/tunnels/certificate_archive_params.rb +14 -3
- data/lib/anthropic/models/beta/tunnels/certificate_create_params.rb +9 -2
- data/lib/anthropic/models/beta/tunnels/certificate_list_params.rb +9 -2
- data/lib/anthropic/models/beta/tunnels/certificate_retrieve_params.rb +14 -3
- data/lib/anthropic/models/beta/user_profile_create_enrollment_url_params.rb +13 -2
- data/lib/anthropic/models/beta/user_profile_create_params.rb +26 -14
- data/lib/anthropic/models/beta/user_profile_list_params.rb +33 -11
- data/lib/anthropic/models/beta/user_profile_retrieve_params.rb +12 -2
- data/lib/anthropic/models/beta/user_profile_update_params.rb +21 -15
- data/lib/anthropic/models/beta/vault_archive_params.rb +12 -2
- data/lib/anthropic/models/beta/vault_create_params.rb +7 -1
- data/lib/anthropic/models/beta/vault_delete_params.rb +12 -2
- data/lib/anthropic/models/beta/vault_list_params.rb +10 -1
- data/lib/anthropic/models/beta/vault_retrieve_params.rb +12 -2
- data/lib/anthropic/models/beta/vault_update_params.rb +9 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential.rb +6 -6
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential_validation.rb +13 -8
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_auth_response.rb +2 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_create_params.rb +2 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_update_params.rb +2 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_probe.rb +6 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_refresh_object.rb +10 -5
- data/lib/anthropic/models/beta/vaults/credential_archive_params.rb +14 -3
- data/lib/anthropic/models/beta/vaults/credential_create_params.rb +13 -6
- data/lib/anthropic/models/beta/vaults/credential_delete_params.rb +14 -3
- data/lib/anthropic/models/beta/vaults/credential_list_params.rb +12 -2
- data/lib/anthropic/models/beta/vaults/credential_mcp_oauth_validate_params.rb +15 -3
- data/lib/anthropic/models/beta/vaults/credential_retrieve_params.rb +14 -3
- data/lib/anthropic/models/beta/vaults/credential_update_params.rb +17 -7
- data/lib/anthropic/models/browser_toolset_20260801.rb +3 -6
- data/lib/anthropic/models/cache_miss_messages_changed.rb +27 -0
- data/lib/anthropic/models/cache_miss_model_changed.rb +27 -0
- data/lib/anthropic/models/cache_miss_previous_message_not_found.rb +15 -0
- data/lib/anthropic/models/cache_miss_reason.rb +73 -0
- data/lib/anthropic/models/cache_miss_system_changed.rb +27 -0
- data/lib/anthropic/models/cache_miss_tools_changed.rb +27 -0
- data/lib/anthropic/models/cache_miss_unavailable.rb +15 -0
- data/lib/anthropic/models/completion_create_params.rb +10 -1
- data/lib/anthropic/models/computer_toolset_20260801.rb +3 -6
- data/lib/anthropic/models/context_management_capability.rb +6 -6
- data/lib/anthropic/models/diagnostics.rb +25 -0
- data/lib/anthropic/models/diagnostics_param.rb +26 -0
- data/lib/anthropic/models/effort_capability.rb +2 -2
- data/lib/anthropic/models/file_delete_params.rb +10 -1
- data/lib/anthropic/models/file_download_params.rb +10 -1
- data/lib/anthropic/models/file_list_params.rb +7 -1
- data/lib/anthropic/models/file_retrieve_metadata_params.rb +10 -1
- data/lib/anthropic/models/file_upload_params.rb +7 -1
- data/lib/anthropic/models/message.rb +18 -6
- data/lib/anthropic/models/message_count_tokens_params.rb +9 -3
- data/lib/anthropic/models/message_create_params.rb +20 -4
- data/lib/anthropic/models/messages/batch_cancel_params.rb +10 -1
- data/lib/anthropic/models/messages/batch_create_params.rb +28 -8
- data/lib/anthropic/models/messages/batch_delete_params.rb +10 -1
- data/lib/anthropic/models/messages/batch_list_params.rb +7 -1
- data/lib/anthropic/models/messages/batch_results_params.rb +10 -1
- data/lib/anthropic/models/messages/batch_retrieve_params.rb +10 -1
- data/lib/anthropic/models/model.rb +11 -1
- data/lib/anthropic/models/model_info.rb +3 -2
- data/lib/anthropic/models/model_list_params.rb +11 -1
- data/lib/anthropic/models/model_retrieve_params.rb +14 -1
- data/lib/anthropic/models/output_config.rb +9 -3
- data/lib/anthropic/models/raw_message_delta_event.rb +8 -5
- data/lib/anthropic/models/refusal_stop_details.rb +7 -3
- data/lib/anthropic/models/skill_create_params.rb +7 -1
- data/lib/anthropic/models/skill_delete_params.rb +7 -1
- data/lib/anthropic/models/skill_list_params.rb +7 -1
- data/lib/anthropic/models/skill_retrieve_params.rb +7 -1
- data/lib/anthropic/models/skills/version_create_params.rb +7 -1
- data/lib/anthropic/models/skills/version_delete_params.rb +7 -1
- data/lib/anthropic/models/skills/version_list_params.rb +7 -1
- data/lib/anthropic/models/skills/version_retrieve_params.rb +7 -1
- data/lib/anthropic/models/thinking_config_between_tools.rb +15 -0
- data/lib/anthropic/models/thinking_config_param.rb +7 -2
- data/lib/anthropic/models/web_fetch_tool_20250910.rb +3 -7
- data/lib/anthropic/models/web_fetch_tool_20260209.rb +3 -7
- data/lib/anthropic/models/web_fetch_tool_20260309.rb +3 -7
- data/lib/anthropic/models/web_fetch_tool_20260318.rb +3 -7
- data/lib/anthropic/models.rb +20 -0
- data/lib/anthropic/resources/beta/agents.rb +2 -2
- data/lib/anthropic/resources/beta/deployments.rb +4 -4
- data/lib/anthropic/resources/beta/dreams.rb +58 -18
- data/lib/anthropic/resources/beta/memory_stores/memories.rb +13 -13
- data/lib/anthropic/resources/beta/memory_stores/memory_versions.rb +15 -14
- data/lib/anthropic/resources/beta/messages.rb +16 -19
- data/lib/anthropic/resources/beta/organization/federation/rules.rb +2 -2
- data/lib/anthropic/resources/beta/organization/workspaces/rate_limits.rb +9 -5
- data/lib/anthropic/resources/beta/sessions/events.rb +5 -5
- data/lib/anthropic/resources/beta/sessions/resources.rb +8 -8
- data/lib/anthropic/resources/beta/sessions/threads/events.rb +6 -6
- data/lib/anthropic/resources/beta/sessions/threads.rb +5 -5
- data/lib/anthropic/resources/beta/sessions.rb +7 -7
- data/lib/anthropic/resources/beta/user_profiles.rb +11 -11
- data/lib/anthropic/resources/beta/vaults/credentials.rb +2 -2
- data/lib/anthropic/resources/messages.rb +12 -6
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +30 -1
- data/rbi/anthropic/helpers/tools/runner.rbi +29 -0
- data/rbi/anthropic/models/anthropic_beta.rbi +7 -0
- data/rbi/anthropic/models/beta/agent_archive_params.rbi +14 -0
- data/rbi/anthropic/models/beta/agent_create_params.rbi +18 -6
- data/rbi/anthropic/models/beta/agent_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/agent_retrieve_params.rbi +14 -0
- data/rbi/anthropic/models/beta/agent_update_params.rbi +20 -6
- data/rbi/anthropic/models/beta/agents/version_list_params.rbi +14 -0
- data/rbi/anthropic/models/beta/beta_browser_toolset_20260801.rbi +4 -10
- data/rbi/anthropic/models/beta/beta_cache_miss_reason.rbi +98 -0
- data/rbi/anthropic/models/beta/beta_cloud_config_params.rbi +6 -16
- data/rbi/anthropic/models/beta/beta_compaction_block.rbi +124 -1
- data/rbi/anthropic/models/beta/beta_compaction_block_param.rbi +132 -1
- data/rbi/anthropic/models/beta/beta_computer_toolset_20260801.rbi +4 -10
- data/rbi/anthropic/models/beta/beta_content_block.rbi +27 -3
- data/rbi/anthropic/models/beta/beta_content_block_param.rbi +37 -3
- data/rbi/anthropic/models/beta/beta_context_management_capability.rbi +6 -6
- data/rbi/anthropic/models/beta/beta_diagnostics.rbi +4 -113
- data/rbi/anthropic/models/beta/beta_dream.rbi +105 -21
- data/rbi/anthropic/models/beta/beta_dream_error.rbi +16 -1
- data/rbi/anthropic/models/beta/beta_dream_input.rbi +18 -1
- data/rbi/anthropic/models/beta/beta_dream_memory_store_input.rbi +16 -4
- data/rbi/anthropic/models/beta/beta_dream_memory_store_output.rbi +13 -2
- data/rbi/anthropic/models/beta/beta_dream_model_config.rbi +11 -13
- data/rbi/anthropic/models/beta/beta_dream_model_config_param.rbi +24 -12
- data/rbi/anthropic/models/beta/beta_dream_output.rbi +14 -2
- data/rbi/anthropic/models/beta/beta_dream_sessions_input.rbi +21 -2
- data/rbi/anthropic/models/beta/beta_dream_status.rbi +11 -2
- data/rbi/anthropic/models/beta/beta_dream_usage.rbi +20 -9
- data/rbi/anthropic/models/beta/beta_dreaming_error.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_effort_capability.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_fallback_param.rbi +11 -2
- data/rbi/anthropic/models/beta/beta_fallback_refusal_trigger.rbi +9 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_agent.rbi +4 -4
- data/rbi/anthropic/models/beta/beta_managed_agents_agent_tool_config_params.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_agent_toolset20260401_params.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_agent_toolset_default_config_params.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_agent_with_overrides_params.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_bash_tool_config_params.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_budget_limit.rbi +4 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_cron_schedule.rbi +4 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_custom_tool_params.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_delta_content.rbi +4 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_deployment.rbi +26 -18
- data/rbi/anthropic/models/beta/beta_managed_agents_deployment_initial_event.rbi +1 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_deployment_initial_event_params.rbi +1 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_deployment_paused_reason.rbi +1 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_deployment_run.rbi +14 -12
- data/rbi/anthropic/models/beta/beta_managed_agents_deployment_user_define_outcome_event.rbi +3 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_deployment_user_message_event.rbi +1 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_edit_tool_config_params.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_error_deployment_paused_reason.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_glob_tool_config_params.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_grep_tool_config_params.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_mcp_tool_config_params.rbi +3 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_mcp_toolset_default_config_params.rbi +3 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_mcp_toolset_params.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_memory_store.rbi +12 -6
- data/rbi/anthropic/models/beta/beta_managed_agents_memory_store_resource_config.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_memory_store_resource_param.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_model.rbi +15 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_model_config.rbi +15 -12
- data/rbi/anthropic/models/beta/beta_managed_agents_model_config_params.rbi +3 -9
- data/rbi/anthropic/models/beta/beta_managed_agents_multiagent.rbi +1 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_multiagent_params.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_outcome_evaluation_resource.rbi +4 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_read_tool_config_params.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_schedule.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_schedule_params.rbi +1 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_schedule_trigger_context.rbi +6 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_session.rbi +8 -10
- data/rbi/anthropic/models/beta/beta_managed_agents_session_agent.rbi +4 -4
- data/rbi/anthropic/models/beta/beta_managed_agents_session_agent_update.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_session_resource_config.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_session_updated_event.rbi +14 -10
- data/rbi/anthropic/models/beta/beta_managed_agents_session_usage.rbi +10 -6
- data/rbi/anthropic/models/beta/beta_managed_agents_session_usage_event.rbi +8 -8
- data/rbi/anthropic/models/beta/beta_managed_agents_system_content_block.rbi +1 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_system_message_event.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_trigger_context.rbi +3 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_user_tool_result_event.rbi +4 -4
- data/rbi/anthropic/models/beta/beta_managed_agents_vault.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_web_fetch_tool_config_params.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_web_search_tool_config_params.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_managed_agents_write_tool_config_params.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_mcp_tool.rbi +52 -0
- data/rbi/anthropic/models/beta/beta_mcp_tool_listing_block.rbi +53 -0
- data/rbi/anthropic/models/beta/beta_mcp_tool_listing_block_param.rbi +62 -0
- data/rbi/anthropic/models/beta/beta_mcp_tool_param.rbi +62 -0
- data/rbi/anthropic/models/beta/beta_mcp_toolset.rbi +16 -1
- data/rbi/anthropic/models/beta/beta_message.rbi +18 -11
- data/rbi/anthropic/models/beta/beta_message_delta_usage.rbi +8 -0
- data/rbi/anthropic/models/beta/beta_model_capabilities.rbi +4 -6
- data/rbi/anthropic/models/beta/beta_model_info.rbi +4 -2
- data/rbi/anthropic/models/beta/beta_output_behavior.rbi +9 -1
- data/rbi/anthropic/models/beta/beta_output_behavior_create_new.rbi +5 -3
- data/rbi/anthropic/models/beta/beta_output_behavior_update_existing.rbi +15 -4
- data/rbi/anthropic/models/beta/beta_output_config.rbi +14 -5
- data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +29 -4
- data/rbi/anthropic/models/beta/beta_raw_message_delta_event.rbi +12 -6
- data/rbi/anthropic/models/beta/beta_raw_message_stream_event.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_refusal_stop_details.rbi +9 -3
- data/rbi/anthropic/models/beta/beta_request_tool_addition_block.rbi +54 -9
- data/rbi/anthropic/models/beta/beta_request_tool_removal_block.rbi +3 -2
- data/rbi/anthropic/models/beta/beta_response_tool.rbi +255 -0
- data/rbi/anthropic/models/beta/beta_response_tool_addition_block.rbi +182 -0
- data/rbi/anthropic/models/beta/beta_response_tool_change_mcp_tool_reference.rbi +46 -0
- data/rbi/anthropic/models/beta/beta_response_tool_change_mcp_toolset_reference.rbi +38 -0
- data/rbi/anthropic/models/beta/beta_response_tool_change_tool_reference.rbi +38 -0
- data/rbi/anthropic/models/beta/beta_response_tool_input_schema.rbi +54 -0
- data/rbi/anthropic/models/beta/beta_response_tool_removal_block.rbi +139 -0
- data/rbi/anthropic/models/beta/beta_response_tool_union.rbi +55 -0
- data/rbi/anthropic/models/beta/beta_system_message_output_config.rbi +12 -3
- data/rbi/anthropic/models/beta/beta_target_store_held_error.rbi +14 -11
- data/rbi/anthropic/models/beta/beta_thinking_block_binding.rbi +10 -10
- data/rbi/anthropic/models/beta/beta_thinking_config_adaptive.rbi +4 -4
- data/rbi/anthropic/models/beta/beta_thinking_config_between_tools.rbi +30 -0
- data/rbi/anthropic/models/beta/beta_thinking_config_enabled.rbi +4 -4
- data/rbi/anthropic/models/beta/beta_thinking_config_param.rbi +8 -2
- data/rbi/anthropic/models/beta/beta_tool_change_tool_definition.rbi +78 -0
- data/rbi/anthropic/models/beta/beta_tool_change_tool_definition_param.rbi +141 -0
- data/rbi/anthropic/models/beta/beta_tool_change_tool_reference.rbi +3 -2
- data/rbi/anthropic/models/beta/beta_tunnel.rbi +6 -4
- data/rbi/anthropic/models/beta/beta_usage.rbi +11 -9
- data/rbi/anthropic/models/beta/beta_user_profile.rbi +45 -27
- data/rbi/anthropic/models/beta/beta_user_profile_enrollment_url.rbi +4 -2
- data/rbi/anthropic/models/beta/beta_user_profile_external_user_details.rbi +21 -23
- data/rbi/anthropic/models/beta/beta_user_profile_external_user_details_params.rbi +25 -23
- data/rbi/anthropic/models/beta/beta_user_profile_trust_grant.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +4 -12
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_20260209.rbi +4 -12
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_20260309.rbi +4 -12
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_20260318.rbi +4 -12
- data/rbi/anthropic/models/beta/deployment_archive_params.rbi +14 -0
- data/rbi/anthropic/models/beta/deployment_create_params.rbi +28 -9
- data/rbi/anthropic/models/beta/deployment_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/deployment_pause_params.rbi +14 -0
- data/rbi/anthropic/models/beta/deployment_retrieve_params.rbi +14 -0
- data/rbi/anthropic/models/beta/deployment_run_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/deployment_run_params.rbi +14 -0
- data/rbi/anthropic/models/beta/deployment_run_retrieve_params.rbi +14 -0
- data/rbi/anthropic/models/beta/deployment_unpause_params.rbi +14 -0
- data/rbi/anthropic/models/beta/deployment_update_params.rbi +30 -9
- data/rbi/anthropic/models/beta/dream_archive_params.rbi +14 -0
- data/rbi/anthropic/models/beta/dream_cancel_params.rbi +14 -0
- data/rbi/anthropic/models/beta/dream_create_params.rbi +56 -0
- data/rbi/anthropic/models/beta/dream_list_params.rbi +36 -18
- data/rbi/anthropic/models/beta/dream_retrieve_params.rbi +14 -0
- data/rbi/anthropic/models/beta/environment_archive_params.rbi +12 -0
- data/rbi/anthropic/models/beta/environment_create_params.rbi +15 -8
- data/rbi/anthropic/models/beta/environment_delete_params.rbi +12 -0
- data/rbi/anthropic/models/beta/environment_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/environment_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/beta/environment_update_params.rbi +15 -8
- data/rbi/anthropic/models/beta/environments/work_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/beta/environments/work_stats_params.rbi +12 -0
- data/rbi/anthropic/models/beta/environments/work_stop_params.rbi +12 -0
- data/rbi/anthropic/models/beta/environments/work_update_params.rbi +12 -0
- data/rbi/anthropic/models/beta/file_delete_params.rbi +12 -0
- data/rbi/anthropic/models/beta/file_download_params.rbi +12 -0
- data/rbi/anthropic/models/beta/file_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/file_retrieve_metadata_params.rbi +12 -0
- data/rbi/anthropic/models/beta/file_upload_params.rbi +12 -0
- data/rbi/anthropic/models/beta/memory_store_archive_params.rbi +18 -0
- data/rbi/anthropic/models/beta/memory_store_create_params.rbi +12 -0
- data/rbi/anthropic/models/beta/memory_store_delete_params.rbi +18 -0
- data/rbi/anthropic/models/beta/memory_store_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/memory_store_retrieve_params.rbi +16 -0
- data/rbi/anthropic/models/beta/memory_store_update_params.rbi +18 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_actor.rbi +8 -11
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_api_actor.rbi +4 -4
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_error.rbi +7 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory.rbi +10 -4
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_list_item.rbi +5 -2
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_path_conflict_error.rbi +23 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_precondition_failed_error.rbi +16 -1
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version.rbi +32 -28
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_precondition.rbi +5 -6
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_service_account_actor.rbi +4 -4
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_session_actor.rbi +7 -8
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_user_actor.rbi +3 -3
- data/rbi/anthropic/models/beta/memory_stores/memory_create_params.rbi +24 -2
- data/rbi/anthropic/models/beta/memory_stores/memory_delete_params.rbi +26 -2
- data/rbi/anthropic/models/beta/memory_stores/memory_list_params.rbi +14 -0
- data/rbi/anthropic/models/beta/memory_stores/memory_retrieve_params.rbi +26 -2
- data/rbi/anthropic/models/beta/memory_stores/memory_update_params.rbi +34 -14
- data/rbi/anthropic/models/beta/memory_stores/memory_version_list_params.rbi +46 -16
- data/rbi/anthropic/models/beta/memory_stores/memory_version_redact_params.rbi +16 -0
- data/rbi/anthropic/models/beta/memory_stores/memory_version_retrieve_params.rbi +26 -2
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +40 -25
- data/rbi/anthropic/models/beta/message_create_params.rbi +44 -27
- data/rbi/anthropic/models/beta/messages/batch_cancel_params.rbi +12 -0
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +58 -33
- data/rbi/anthropic/models/beta/messages/batch_delete_params.rbi +12 -0
- data/rbi/anthropic/models/beta/messages/batch_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/messages/batch_results_params.rbi +12 -0
- data/rbi/anthropic/models/beta/messages/batch_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/beta/model_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/model_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/beta/organization/federation/beta_federation_issuer.rbi +8 -10
- data/rbi/anthropic/models/beta/organization/federation/rule_update_params.rbi +4 -12
- data/rbi/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit.rbi +12 -8
- data/rbi/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_organization_source.rbi +38 -0
- data/rbi/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_value.rbi +99 -3
- data/rbi/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_workspace_source.rbi +36 -0
- data/rbi/anthropic/models/beta/organization/workspaces/rate_limit_list_params.rbi +13 -0
- data/rbi/anthropic/models/beta/session_archive_params.rbi +12 -0
- data/rbi/anthropic/models/beta/session_create_params.rbi +23 -6
- data/rbi/anthropic/models/beta/session_delete_params.rbi +12 -0
- data/rbi/anthropic/models/beta/session_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/session_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/beta/session_update_params.rbi +34 -10
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_custom_tool_use_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_evaluated_permission.rbi +49 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_mcp_tool_result_event.rbi +4 -4
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_mcp_tool_use_event.rbi +22 -54
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_message_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_thinking_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_context_compacted_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_received_event.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_sent_event.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_evaluation.rbi +1 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_evaluation_auto.rbi +2 -6
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_result_event.rbi +4 -4
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_use_event.rbi +22 -54
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_billing_error.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_credential_host_unreachable_error.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_document_block.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_event_params.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_image_block.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_mcp_authentication_failed_error.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_mcp_connection_failed_error.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_memory_store_resource.rbi +6 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_model_overloaded_error.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_model_rate_limited_error.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_model_request_failed_error.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_search_result_block.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_send_session_events.rbi +4 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_deleted_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_error_event.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_event.rbi +22 -17
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_event_type.rbi +204 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_resource.rbi +2 -1
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_status_idle_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_status_rescheduled_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_status_running_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_status_terminated_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread.rbi +22 -18
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_created_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_idle_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_rescheduled_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_running_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_terminated_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_usage.rbi +18 -6
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_usage_snapshot.rbi +8 -6
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_span_model_request_end_event.rbi +4 -4
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_span_model_request_start_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_span_model_usage.rbi +6 -9
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_end_event.rbi +6 -4
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_ongoing_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_start_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_stream_session_events.rbi +22 -17
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_stream_session_thread_events.rbi +22 -17
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_unknown_error.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event.rbi +4 -4
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event_params.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event.rbi +8 -5
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event_params.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_interrupt_event.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_message_event.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_message_event_params.rbi +1 -1
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_tool_confirmation_event.rbi +5 -5
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_tool_confirmation_event_params.rbi +3 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_tool_result_event_params.rbi +2 -2
- data/rbi/anthropic/models/beta/sessions/event_list_params.rbi +37 -6
- data/rbi/anthropic/models/beta/sessions/event_send_params.rbi +12 -0
- data/rbi/anthropic/models/beta/sessions/event_stream_params.rbi +12 -0
- data/rbi/anthropic/models/beta/sessions/resource_add_params.rbi +12 -0
- data/rbi/anthropic/models/beta/sessions/resource_delete_params.rbi +12 -0
- data/rbi/anthropic/models/beta/sessions/resource_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/sessions/resource_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/beta/sessions/resource_retrieve_response.rbi +2 -1
- data/rbi/anthropic/models/beta/sessions/resource_update_params.rbi +12 -0
- data/rbi/anthropic/models/beta/sessions/resource_update_response.rbi +2 -1
- data/rbi/anthropic/models/beta/sessions/thread_archive_params.rbi +12 -0
- data/rbi/anthropic/models/beta/sessions/thread_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/sessions/thread_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/beta/sessions/threads/event_list_params.rbi +12 -4
- data/rbi/anthropic/models/beta/sessions/threads/event_stream_params.rbi +12 -0
- data/rbi/anthropic/models/beta/skill_create_params.rbi +12 -0
- data/rbi/anthropic/models/beta/skill_delete_params.rbi +12 -0
- data/rbi/anthropic/models/beta/skill_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/skill_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/beta/skills/version_create_params.rbi +12 -0
- data/rbi/anthropic/models/beta/skills/version_delete_params.rbi +12 -0
- data/rbi/anthropic/models/beta/skills/version_download_params.rbi +12 -0
- data/rbi/anthropic/models/beta/skills/version_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/skills/version_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/beta/tunnel_archive_params.rbi +14 -0
- data/rbi/anthropic/models/beta/tunnel_create_params.rbi +12 -0
- data/rbi/anthropic/models/beta/tunnel_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/tunnel_retrieve_params.rbi +14 -0
- data/rbi/anthropic/models/beta/tunnel_reveal_token_params.rbi +14 -0
- data/rbi/anthropic/models/beta/tunnel_rotate_token_params.rbi +14 -0
- data/rbi/anthropic/models/beta/tunnels/beta_tunnel_certificate.rbi +10 -6
- data/rbi/anthropic/models/beta/tunnels/certificate_archive_params.rbi +16 -0
- data/rbi/anthropic/models/beta/tunnels/certificate_create_params.rbi +14 -0
- data/rbi/anthropic/models/beta/tunnels/certificate_list_params.rbi +14 -0
- data/rbi/anthropic/models/beta/tunnels/certificate_retrieve_params.rbi +16 -0
- data/rbi/anthropic/models/beta/user_profile_create_enrollment_url_params.rbi +14 -0
- data/rbi/anthropic/models/beta/user_profile_create_params.rbi +39 -17
- data/rbi/anthropic/models/beta/user_profile_list_params.rbi +40 -10
- data/rbi/anthropic/models/beta/user_profile_retrieve_params.rbi +14 -0
- data/rbi/anthropic/models/beta/user_profile_update_params.rbi +30 -17
- data/rbi/anthropic/models/beta/vault_archive_params.rbi +14 -0
- data/rbi/anthropic/models/beta/vault_create_params.rbi +12 -0
- data/rbi/anthropic/models/beta/vault_delete_params.rbi +14 -0
- data/rbi/anthropic/models/beta/vault_list_params.rbi +12 -0
- data/rbi/anthropic/models/beta/vault_retrieve_params.rbi +14 -0
- data/rbi/anthropic/models/beta/vault_update_params.rbi +14 -0
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential.rbi +6 -6
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential_validation.rbi +10 -8
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_auth_response.rbi +2 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_create_params.rbi +2 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_update_params.rbi +2 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_probe.rbi +4 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_refresh_object.rbi +7 -5
- data/rbi/anthropic/models/beta/vaults/credential_archive_params.rbi +16 -0
- data/rbi/anthropic/models/beta/vaults/credential_create_params.rbi +18 -4
- data/rbi/anthropic/models/beta/vaults/credential_delete_params.rbi +16 -0
- data/rbi/anthropic/models/beta/vaults/credential_list_params.rbi +14 -0
- data/rbi/anthropic/models/beta/vaults/credential_mcp_oauth_validate_params.rbi +16 -0
- data/rbi/anthropic/models/beta/vaults/credential_retrieve_params.rbi +16 -0
- data/rbi/anthropic/models/beta/vaults/credential_update_params.rbi +23 -4
- data/rbi/anthropic/models/browser_toolset_20260801.rbi +4 -10
- data/rbi/anthropic/models/cache_miss_messages_changed.rbi +42 -0
- data/rbi/anthropic/models/cache_miss_model_changed.rbi +39 -0
- data/rbi/anthropic/models/cache_miss_previous_message_not_found.rbi +26 -0
- data/rbi/anthropic/models/cache_miss_reason.rbi +76 -0
- data/rbi/anthropic/models/cache_miss_system_changed.rbi +39 -0
- data/rbi/anthropic/models/cache_miss_tools_changed.rbi +39 -0
- data/rbi/anthropic/models/cache_miss_unavailable.rbi +23 -0
- data/rbi/anthropic/models/completion_create_params.rbi +12 -0
- data/rbi/anthropic/models/computer_toolset_20260801.rbi +4 -10
- data/rbi/anthropic/models/context_management_capability.rbi +6 -6
- data/rbi/anthropic/models/diagnostics.rbi +53 -0
- data/rbi/anthropic/models/diagnostics_param.rbi +39 -0
- data/rbi/anthropic/models/effort_capability.rbi +2 -2
- data/rbi/anthropic/models/file_delete_params.rbi +12 -0
- data/rbi/anthropic/models/file_download_params.rbi +12 -0
- data/rbi/anthropic/models/file_list_params.rbi +12 -0
- data/rbi/anthropic/models/file_retrieve_metadata_params.rbi +12 -0
- data/rbi/anthropic/models/file_upload_params.rbi +12 -0
- data/rbi/anthropic/models/message.rbi +27 -6
- data/rbi/anthropic/models/message_count_tokens_params.rbi +16 -0
- data/rbi/anthropic/models/message_create_params.rbi +33 -0
- data/rbi/anthropic/models/messages/batch_cancel_params.rbi +12 -0
- data/rbi/anthropic/models/messages/batch_create_params.rbi +49 -6
- data/rbi/anthropic/models/messages/batch_delete_params.rbi +12 -0
- data/rbi/anthropic/models/messages/batch_list_params.rbi +12 -0
- data/rbi/anthropic/models/messages/batch_results_params.rbi +12 -0
- data/rbi/anthropic/models/messages/batch_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/model.rbi +9 -1
- data/rbi/anthropic/models/model_info.rbi +4 -2
- data/rbi/anthropic/models/model_list_params.rbi +12 -0
- data/rbi/anthropic/models/model_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/output_config.rbi +12 -3
- data/rbi/anthropic/models/raw_message_delta_event.rbi +12 -6
- data/rbi/anthropic/models/refusal_stop_details.rbi +9 -3
- data/rbi/anthropic/models/skill_create_params.rbi +12 -0
- data/rbi/anthropic/models/skill_delete_params.rbi +12 -0
- data/rbi/anthropic/models/skill_list_params.rbi +12 -0
- data/rbi/anthropic/models/skill_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/skills/version_create_params.rbi +12 -0
- data/rbi/anthropic/models/skills/version_delete_params.rbi +12 -0
- data/rbi/anthropic/models/skills/version_list_params.rbi +12 -0
- data/rbi/anthropic/models/skills/version_retrieve_params.rbi +12 -0
- data/rbi/anthropic/models/thinking_config_between_tools.rbi +26 -0
- data/rbi/anthropic/models/thinking_config_param.rbi +6 -0
- data/rbi/anthropic/models/web_fetch_tool_20250910.rbi +4 -12
- data/rbi/anthropic/models/web_fetch_tool_20260209.rbi +4 -12
- data/rbi/anthropic/models/web_fetch_tool_20260309.rbi +4 -12
- data/rbi/anthropic/models/web_fetch_tool_20260318.rbi +4 -12
- data/rbi/anthropic/models.rbi +21 -0
- data/rbi/anthropic/resources/beta/agents.rbi +4 -6
- data/rbi/anthropic/resources/beta/deployments.rbi +14 -8
- data/rbi/anthropic/resources/beta/dreams.rbi +81 -21
- data/rbi/anthropic/resources/beta/memory_stores/memories.rbi +33 -18
- data/rbi/anthropic/resources/beta/memory_stores/memory_versions.rbi +28 -14
- data/rbi/anthropic/resources/beta/messages.rbi +42 -39
- data/rbi/anthropic/resources/beta/organization/federation/rules.rbi +4 -6
- data/rbi/anthropic/resources/beta/organization/workspaces/rate_limits.rbi +10 -4
- data/rbi/anthropic/resources/beta/sessions/events.rbi +8 -5
- data/rbi/anthropic/resources/beta/sessions/resources.rbi +8 -8
- data/rbi/anthropic/resources/beta/sessions/threads/events.rbi +6 -6
- data/rbi/anthropic/resources/beta/sessions/threads.rbi +5 -5
- data/rbi/anthropic/resources/beta/sessions.rbi +16 -12
- data/rbi/anthropic/resources/beta/user_profiles.rbi +30 -19
- data/rbi/anthropic/resources/beta/vaults/credentials.rbi +3 -2
- data/rbi/anthropic/resources/messages.rbi +18 -0
- data/sig/anthropic/models/anthropic_beta.rbs +4 -0
- data/sig/anthropic/models/beta/beta_cache_miss_reason.rbs +70 -0
- data/sig/anthropic/models/beta/beta_compaction_block.rbs +44 -2
- data/sig/anthropic/models/beta/beta_compaction_block_param.rbs +47 -2
- data/sig/anthropic/models/beta/beta_content_block.rbs +14 -2
- data/sig/anthropic/models/beta/beta_content_block_param.rbs +13 -1
- data/sig/anthropic/models/beta/beta_diagnostics.rbs +4 -70
- data/sig/anthropic/models/beta/beta_dream_status.rbs +3 -1
- data/sig/anthropic/models/beta/beta_fallback_param.rbs +6 -1
- data/sig/anthropic/models/beta/beta_managed_agents_model.rbs +10 -2
- data/sig/anthropic/models/beta/beta_mcp_tool.rbs +32 -0
- data/sig/anthropic/models/beta/beta_mcp_tool_listing_block.rbs +34 -0
- data/sig/anthropic/models/beta/beta_mcp_tool_listing_block_param.rbs +34 -0
- data/sig/anthropic/models/beta/beta_mcp_tool_param.rbs +34 -0
- data/sig/anthropic/models/beta/beta_mcp_toolset.rbs +7 -2
- data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +14 -2
- data/sig/anthropic/models/beta/beta_request_tool_addition_block.rbs +12 -2
- data/sig/anthropic/models/beta/beta_response_tool.rbs +105 -0
- data/sig/anthropic/models/beta/beta_response_tool_addition_block.rbs +84 -0
- data/sig/anthropic/models/beta/beta_response_tool_change_mcp_tool_reference.rbs +30 -0
- data/sig/anthropic/models/beta/beta_response_tool_change_mcp_toolset_reference.rbs +23 -0
- data/sig/anthropic/models/beta/beta_response_tool_change_tool_reference.rbs +20 -0
- data/sig/anthropic/models/beta/beta_response_tool_input_schema.rbs +34 -0
- data/sig/anthropic/models/beta/beta_response_tool_removal_block.rbs +74 -0
- data/sig/anthropic/models/beta/beta_response_tool_union.rbs +43 -0
- data/sig/anthropic/models/beta/beta_thinking_config_between_tools.rbs +17 -0
- data/sig/anthropic/models/beta/beta_thinking_config_param.rbs +6 -1
- data/sig/anthropic/models/beta/beta_tool_change_tool_definition.rbs +29 -0
- data/sig/anthropic/models/beta/beta_tool_change_tool_definition_param.rbs +29 -0
- data/sig/anthropic/models/beta/beta_user_profile.rbs +3 -0
- data/sig/anthropic/models/beta/beta_user_profile_external_user_details.rbs +5 -0
- data/sig/anthropic/models/beta/beta_user_profile_external_user_details_params.rbs +5 -0
- data/sig/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_organization_source.rbs +20 -0
- data/sig/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_value.rbs +43 -1
- data/sig/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_workspace_source.rbs +19 -0
- data/sig/anthropic/models/beta/organization/workspaces/rate_limit_list_params.rbs +7 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_evaluated_permission.rbs +20 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_mcp_tool_use_event.rbs +6 -18
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_use_event.rbs +6 -18
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_event.rbs +3 -4
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_event_type.rbs +84 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_stream_session_events.rbs +3 -4
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_stream_session_thread_events.rbs +3 -4
- data/sig/anthropic/models/beta/sessions/event_list_params.rbs +7 -5
- data/sig/anthropic/models/beta/user_profile_create_params.rbs +3 -0
- data/sig/anthropic/models/beta/user_profile_list_params.rbs +6 -0
- data/sig/anthropic/models/beta/user_profile_update_params.rbs +3 -0
- data/sig/anthropic/models/cache_miss_messages_changed.rbs +22 -0
- data/sig/anthropic/models/cache_miss_model_changed.rbs +22 -0
- data/sig/anthropic/models/cache_miss_previous_message_not_found.rbs +14 -0
- data/sig/anthropic/models/cache_miss_reason.rbs +66 -0
- data/sig/anthropic/models/cache_miss_system_changed.rbs +22 -0
- data/sig/anthropic/models/cache_miss_tools_changed.rbs +22 -0
- data/sig/anthropic/models/cache_miss_unavailable.rbs +13 -0
- data/sig/anthropic/models/diagnostics.rbs +18 -0
- data/sig/anthropic/models/diagnostics_param.rbs +13 -0
- data/sig/anthropic/models/message.rbs +5 -0
- data/sig/anthropic/models/message_create_params.rbs +5 -0
- data/sig/anthropic/models/messages/batch_create_params.rbs +5 -0
- data/sig/anthropic/models/model.rbs +10 -2
- data/sig/anthropic/models/thinking_config_between_tools.rbs +13 -0
- data/sig/anthropic/models/thinking_config_param.rbs +6 -1
- data/sig/anthropic/models.rbs +20 -0
- data/sig/anthropic/resources/beta/organization/workspaces/rate_limits.rbs +1 -0
- data/sig/anthropic/resources/beta/sessions/events.rbs +1 -1
- data/sig/anthropic/resources/messages.rbs +3 -0
- metadata +92 -3
- data/lib/anthropic/helpers/tools/compaction_control.rb +0 -109
|
@@ -29,7 +29,24 @@ module Anthropic
|
|
|
29
29
|
private_constant :RUN_TOOLS_STOP_REASONS, :RESUME_STOP_REASONS, :STOP_STOP_REASONS
|
|
30
30
|
|
|
31
31
|
# @return [Anthropic::Models::Beta::MessageCreateParams]
|
|
32
|
-
|
|
32
|
+
attr_reader :params
|
|
33
|
+
|
|
34
|
+
# @param params [Anthropic::Models::Beta::MessageCreateParams]
|
|
35
|
+
#
|
|
36
|
+
# @raise [ArgumentError] if `compaction` is set, if the messages are replaced while the
|
|
37
|
+
# conversation is being compacted, or if a compaction edit is added while a compaction is due
|
|
38
|
+
def params=(params)
|
|
39
|
+
reject_compaction_param!(params)
|
|
40
|
+
if @compaction_phase == :in_flight && !params[:messages].equal?(current_messages)
|
|
41
|
+
raise ArgumentError.new(
|
|
42
|
+
"Message params can't be changed while the conversation is being compacted, because the " \
|
|
43
|
+
"compaction response replaces them. Make the change on the next iteration."
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
check_can_compact!(params) if @pending_compaction || @compaction_phase == :in_flight
|
|
47
|
+
|
|
48
|
+
@params = params
|
|
49
|
+
end
|
|
33
50
|
|
|
34
51
|
# @return [Boolean]
|
|
35
52
|
def finished? = @finished
|
|
@@ -39,17 +56,75 @@ module Anthropic
|
|
|
39
56
|
self.params = {**params.to_h, messages: params[:messages].to_a + messages}
|
|
40
57
|
end
|
|
41
58
|
|
|
59
|
+
# @api public
|
|
60
|
+
#
|
|
61
|
+
# Sends the tools' definitions in `tool_addition` blocks with the next request, leaving
|
|
62
|
+
# `params[:tools]` and the prompt cache alone. A `BaseTool` is run under its name straight away,
|
|
63
|
+
# replacing a same-name tool even for a call already in the message being handled; a raw
|
|
64
|
+
# definition is never run here and stops a same-name tool from running. Needs the
|
|
65
|
+
# `inline-tools-2026-09-15` beta.
|
|
66
|
+
#
|
|
67
|
+
# @param tools [Array<Anthropic::Helpers::Tools::BaseTool, Anthropic::Models::Beta::BetaToolUnion, Hash{Symbol=>Object}>]
|
|
68
|
+
def add_tools(*tools)
|
|
69
|
+
# Converted in place, so the originals are kept apart to pair each with its definition.
|
|
70
|
+
request = {tools: tools.dup}
|
|
71
|
+
Anthropic::Helpers::Messages.distill_input_schema_models!(request, strict: nil)
|
|
72
|
+
tools.zip(request.fetch(:tools)) do |tool, definition|
|
|
73
|
+
block = {type: :tool_addition, tool: {type: :tool_definition, definition:}}
|
|
74
|
+
runnable = tool if tool.is_a?(Anthropic::Helpers::Tools::BaseTool)
|
|
75
|
+
name = changed_tool_name(block.fetch(:tool))
|
|
76
|
+
@tool_overrides.store(name, runnable) unless name.nil?
|
|
77
|
+
@pending_tool_changes << block
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# @api public
|
|
82
|
+
#
|
|
83
|
+
# Sends `tool_removal` blocks with the next request. The tools stop being run straight away,
|
|
84
|
+
# so a call to one gets the "not found" error result. Needs the `inline-tools-2026-09-15` beta.
|
|
85
|
+
#
|
|
86
|
+
# @param tools [Array<Anthropic::Helpers::Tools::BaseTool, String, Symbol>] the tools, or their names
|
|
87
|
+
def remove_tools(*tools)
|
|
88
|
+
tools.each do |tool|
|
|
89
|
+
name =
|
|
90
|
+
case tool
|
|
91
|
+
in Anthropic::Helpers::Tools::BaseTool
|
|
92
|
+
Anthropic::Helpers::Messages.tool_api_name(tool)
|
|
93
|
+
in String | Symbol
|
|
94
|
+
tool.to_s
|
|
95
|
+
end
|
|
96
|
+
@tool_overrides.store(name, nil)
|
|
97
|
+
@pending_tool_changes << {type: :tool_removal, tool: {type: :tool_reference, name:}}
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Compact the conversation before the model's next turn. Once the current turn has finished,
|
|
102
|
+
# including any tool calls, the runner asks the API for a summary and replaces its messages with
|
|
103
|
+
# the compaction response, which you get like any other message. Requires the
|
|
104
|
+
# `compact-2026-09-04` beta.
|
|
105
|
+
#
|
|
106
|
+
# @param compaction [Anthropic::Models::Beta::BetaCompactionConfig, Hash{Symbol=>Object}, nil]
|
|
107
|
+
# the same config `messages.create(compaction:)` takes, `{type: :summarize}` when omitted
|
|
108
|
+
#
|
|
109
|
+
# @raise [ArgumentError] if `context_management` has a compaction edit
|
|
110
|
+
#
|
|
111
|
+
# @return [void]
|
|
112
|
+
def compact_before_next_turn(compaction = nil)
|
|
113
|
+
return unless @compaction_phase.nil?
|
|
114
|
+
|
|
115
|
+
check_can_compact!(params)
|
|
116
|
+
@pending_compaction = compaction || {type: :summarize}
|
|
117
|
+
end
|
|
118
|
+
|
|
42
119
|
# @return [Array<Anthropic::Beta::BetaMessageParam>]
|
|
43
120
|
private def current_messages = params&.[](:messages).to_a
|
|
44
121
|
|
|
45
122
|
# @return [Anthropic::Models::BetaMessage, nil]
|
|
46
123
|
def next_message
|
|
47
124
|
message = nil
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
[true, message]
|
|
52
|
-
end
|
|
125
|
+
fold do
|
|
126
|
+
message = @client.beta.messages.create(with_helper_header(_1, StainlessHelperHeader::BETA_TOOL_RUNNER))
|
|
127
|
+
[true, message]
|
|
53
128
|
end
|
|
54
129
|
message
|
|
55
130
|
end
|
|
@@ -93,26 +168,33 @@ module Anthropic
|
|
|
93
168
|
#
|
|
94
169
|
# @yieldparam [Array(Boolean, Anthropic::Models::Beta::MessageCreateParams)]
|
|
95
170
|
private def fold(&blk)
|
|
96
|
-
|
|
171
|
+
@compaction_phase = nil if @compaction_phase == :handling
|
|
172
|
+
return nil if finished? && @pending_compaction.nil?
|
|
97
173
|
|
|
174
|
+
brk = false
|
|
98
175
|
# rubocop:disable Metrics/BlockLength
|
|
99
176
|
# rubocop:disable Style/CaseEquality
|
|
100
177
|
loop do
|
|
178
|
+
break if finished?
|
|
101
179
|
return if @max_iterations && @iteration_count >= @max_iterations
|
|
102
180
|
|
|
181
|
+
send_pending_tool_changes
|
|
182
|
+
|
|
183
|
+
if @pending_compaction && !turn_paused?
|
|
184
|
+
brk = compact(@pending_compaction, &blk)
|
|
185
|
+
break if brk
|
|
186
|
+
next
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
reject_compaction_param!(params)
|
|
103
190
|
tools = params[:tools].to_a.grep(Anthropic::Helpers::Tools::BaseTool)
|
|
104
191
|
messages = current_messages
|
|
105
192
|
brk, response = blk.call(params)
|
|
106
193
|
|
|
107
|
-
# Store the response for compaction check
|
|
108
194
|
@last_response = response
|
|
109
195
|
|
|
110
|
-
#
|
|
111
|
-
compacted = check_and_compact?
|
|
112
|
-
|
|
113
|
-
# Skip tool processing if we just compacted or if messages were modified
|
|
196
|
+
# Skip tool processing if messages were modified
|
|
114
197
|
next unless current_messages.equal?(messages)
|
|
115
|
-
break if compacted
|
|
116
198
|
|
|
117
199
|
next_step = determine_next_step_from_stop_reason(response.stop_reason)
|
|
118
200
|
|
|
@@ -121,21 +203,27 @@ module Anthropic
|
|
|
121
203
|
break
|
|
122
204
|
end
|
|
123
205
|
|
|
124
|
-
tool_uses =
|
|
125
|
-
next_step == :run_tools ? response.content.grep(Anthropic::Beta::BetaToolUseBlock) : []
|
|
206
|
+
tool_uses = next_step == :run_tools ? client_tool_uses(response) : []
|
|
126
207
|
|
|
127
208
|
# A `tool_removal` block only hints the model, so a call to a withdrawn tool can still
|
|
128
209
|
# arrive; a name missing from this set routes down the same "not found" path as an
|
|
129
210
|
# undeclared tool.
|
|
130
|
-
available = available_tool_names(tools,
|
|
211
|
+
available = available_tool_names([*tools, *@tool_overrides.values.compact])
|
|
131
212
|
|
|
132
213
|
mapped =
|
|
133
214
|
tool_uses.map do |tool_use|
|
|
134
215
|
resp = {type: :tool_result, tool_use_id: tool_use.id}
|
|
135
216
|
if available.include?(tool_use.name) &&
|
|
136
|
-
(tool =
|
|
217
|
+
(tool = @tool_overrides.fetch(tool_use.name) do
|
|
218
|
+
tools.find do
|
|
219
|
+
_1.class.model === tool_use.parsed && Anthropic::Helpers::Messages.tool_api_name(_1) == tool_use.name
|
|
220
|
+
end
|
|
221
|
+
end)
|
|
137
222
|
begin
|
|
138
|
-
|
|
223
|
+
# `parsed` was read against `params[:tools]`, which an added tool is not in.
|
|
224
|
+
input = tool_use.parsed
|
|
225
|
+
input = Anthropic::Internal::Type::Converter.coerce(tool, tool_use.input) if @tool_overrides.key?(tool_use.name)
|
|
226
|
+
raw = tool.call(input)
|
|
139
227
|
is_error = false
|
|
140
228
|
rescue StandardError => e
|
|
141
229
|
is_error = true
|
|
@@ -154,20 +242,7 @@ module Anthropic
|
|
|
154
242
|
break
|
|
155
243
|
end
|
|
156
244
|
|
|
157
|
-
|
|
158
|
-
case _1
|
|
159
|
-
in Anthropic::Beta::BetaToolUseBlock
|
|
160
|
-
# `parsed` is only set for calls to a declared tool; any other call (e.g. to an
|
|
161
|
-
# unregistered tool) must replay the `input` the API sent, never a null.
|
|
162
|
-
input = _1.parsed.nil? ? _1.input : _1.parsed
|
|
163
|
-
raw = {**_1, input:}.except(:parsed)
|
|
164
|
-
Anthropic::Internal::Type::Converter.dump(Anthropic::Beta::BetaToolUseBlock, raw)
|
|
165
|
-
else
|
|
166
|
-
_1
|
|
167
|
-
end
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
messages << {role: :assistant, content:}
|
|
245
|
+
messages << assistant_turn(response)
|
|
171
246
|
messages << {role: :user, content: mapped} unless mapped.empty?
|
|
172
247
|
adopt_container(response)
|
|
173
248
|
|
|
@@ -177,6 +252,199 @@ module Anthropic
|
|
|
177
252
|
end
|
|
178
253
|
# rubocop:enable Style/CaseEquality
|
|
179
254
|
# rubocop:enable Metrics/BlockLength
|
|
255
|
+
|
|
256
|
+
compact_after_final_turn(&blk) if finished? && !brk
|
|
257
|
+
nil
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# @api private
|
|
261
|
+
#
|
|
262
|
+
# @param response [Anthropic::Models::BetaMessage]
|
|
263
|
+
#
|
|
264
|
+
# @return [Hash{Symbol=>Object}]
|
|
265
|
+
private def assistant_turn(response)
|
|
266
|
+
content = response.content.map do
|
|
267
|
+
case _1
|
|
268
|
+
# The class alone doesn't make a block a tool call, see `#client_tool_uses`.
|
|
269
|
+
in Anthropic::Beta::BetaToolUseBlock if block_type(_1) == :tool_use
|
|
270
|
+
# `parsed` is only set for calls to a declared tool; any other call (e.g. to an
|
|
271
|
+
# unregistered tool) must replay the `input` the API sent, never a null. So must a
|
|
272
|
+
# tool `add_tools` / `remove_tools` changed: `parsed` came from `params[:tools]`.
|
|
273
|
+
input = _1.parsed.nil? || @tool_overrides.key?(_1.name) ? _1.input : _1.parsed
|
|
274
|
+
raw = {**_1, input:}.except(:parsed)
|
|
275
|
+
Anthropic::Internal::Type::Converter.dump(Anthropic::Beta::BetaToolUseBlock, raw)
|
|
276
|
+
else
|
|
277
|
+
_1
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
{role: :assistant, content:}
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# @api private
|
|
285
|
+
#
|
|
286
|
+
# A block of a type this SDK version doesn't know is coerced to the closest model, which can
|
|
287
|
+
# be `BetaToolUseBlock`, so the class alone doesn't make a block a tool call.
|
|
288
|
+
#
|
|
289
|
+
# @param response [Anthropic::Models::BetaMessage]
|
|
290
|
+
#
|
|
291
|
+
# @return [Array<Anthropic::Beta::BetaToolUseBlock>]
|
|
292
|
+
private def client_tool_uses(response)
|
|
293
|
+
response.content.grep(Anthropic::Beta::BetaToolUseBlock).select { block_type(_1) == :tool_use }
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# @api private
|
|
297
|
+
#
|
|
298
|
+
# @param block [Anthropic::Models::Beta::BetaContentBlock, Hash{Symbol=>Object}]
|
|
299
|
+
#
|
|
300
|
+
# @return [Symbol, nil]
|
|
301
|
+
private def block_type(block) = read_field(block, :type)&.to_sym
|
|
302
|
+
|
|
303
|
+
# @api private
|
|
304
|
+
#
|
|
305
|
+
# @param params [Anthropic::Models::Beta::MessageCreateParams]
|
|
306
|
+
private def reject_compaction_param!(params)
|
|
307
|
+
return if params[:compaction].nil?
|
|
308
|
+
|
|
309
|
+
raise ArgumentError.new(
|
|
310
|
+
"`compaction` cannot be set on a tool runner: every request in the loop would compact again. " \
|
|
311
|
+
"Call `#compact_before_next_turn` when the conversation should be compacted instead."
|
|
312
|
+
)
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
# @api private
|
|
316
|
+
#
|
|
317
|
+
# @param params [Anthropic::Models::Beta::MessageCreateParams]
|
|
318
|
+
private def check_can_compact!(params)
|
|
319
|
+
# The compaction request is sent without `context_management`, so the API can't reject this
|
|
320
|
+
# combination there: it would run and bill the compaction, then reject the next request,
|
|
321
|
+
# where the compaction response and the compaction edit meet.
|
|
322
|
+
edits = read_field(params[:context_management], :edits)
|
|
323
|
+
return unless Array(edits).any? { read_field(_1, :type).to_s.start_with?("compact_") }
|
|
324
|
+
|
|
325
|
+
raise ArgumentError.new(
|
|
326
|
+
"`#compact_before_next_turn` can't be used while `context_management` has a compaction edit, " \
|
|
327
|
+
"because the API doesn't accept a compaction block together with one. Remove the edit first."
|
|
328
|
+
)
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
# @api private
|
|
332
|
+
#
|
|
333
|
+
# The API can't compact a conversation that ends mid-turn, so a paused turn is resumed first.
|
|
334
|
+
#
|
|
335
|
+
# @return [Boolean]
|
|
336
|
+
private def turn_paused?
|
|
337
|
+
!@last_response.nil? && determine_next_step_from_stop_reason(@last_response.stop_reason) == :resume
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# @api private
|
|
341
|
+
#
|
|
342
|
+
# @param compaction [Anthropic::Models::Beta::BetaCompactionConfig, Hash{Symbol=>Object}]
|
|
343
|
+
#
|
|
344
|
+
# @return [Boolean] whether the caller asked for a single message
|
|
345
|
+
private def compact(compaction, &blk)
|
|
346
|
+
check_can_compact!(params)
|
|
347
|
+
request = {**without_compaction_incompatible_params(params), compaction:}
|
|
348
|
+
@pending_compaction = nil
|
|
349
|
+
@compaction_phase = :in_flight
|
|
350
|
+
|
|
351
|
+
brk, response = blk.call(request)
|
|
352
|
+
|
|
353
|
+
if response.content.any? { block_type(_1) == :compaction && !read_field(_1, :content).to_s.empty? }
|
|
354
|
+
keep_removals_from_history
|
|
355
|
+
# The response has to be sent back as it came, first, replacing the messages it summarizes.
|
|
356
|
+
@params = {**params.to_h, messages: [assistant_turn(response)]}
|
|
357
|
+
else
|
|
358
|
+
warn("[anthropic-ruby] Compaction produced no summary; keeping the conversation as it is.")
|
|
359
|
+
end
|
|
360
|
+
# `#next_message` hands the response over only now; its caller is looking at it until the
|
|
361
|
+
# runner is next advanced, which is when `#fold` clears this.
|
|
362
|
+
@compaction_phase = :handling if brk
|
|
363
|
+
brk
|
|
364
|
+
ensure
|
|
365
|
+
@compaction_phase = nil if @compaction_phase == :in_flight
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# @api private
|
|
369
|
+
#
|
|
370
|
+
# A compaction request returns only the compaction block, never a reply, so the API rejects
|
|
371
|
+
# the params that only shape a reply. The runner's later requests keep them.
|
|
372
|
+
#
|
|
373
|
+
# @param params [Anthropic::Models::Beta::MessageCreateParams, Hash{Symbol=>Object}]
|
|
374
|
+
#
|
|
375
|
+
# @return [Hash{Symbol=>Object}]
|
|
376
|
+
private def without_compaction_incompatible_params(params)
|
|
377
|
+
kept = params.to_h.except(:context_management, :stop_sequences, :output_format)
|
|
378
|
+
forced_tool = [:any, :tool].include?(read_field(kept[:tool_choice], :type)&.to_sym)
|
|
379
|
+
kept = without_output_format(forced_tool ? kept.except(:tool_choice) : kept)
|
|
380
|
+
return kept unless kept[:fallbacks].is_a?(Array)
|
|
381
|
+
|
|
382
|
+
fallbacks = kept[:fallbacks].map do
|
|
383
|
+
fallback = Anthropic::Internal::Type::Converter.dump(Anthropic::Beta::BetaFallbackParam, _1)
|
|
384
|
+
without_output_format(fallback)
|
|
385
|
+
end
|
|
386
|
+
{**kept, fallbacks:}
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
# @api private
|
|
390
|
+
#
|
|
391
|
+
# @param params [Hash{Symbol=>Object}] a request's params, or one of its fallbacks'
|
|
392
|
+
#
|
|
393
|
+
# @return [Hash{Symbol=>Object}]
|
|
394
|
+
private def without_output_format(params)
|
|
395
|
+
# Read in its wire form: a typed `BetaOutputConfig` holds `format` under its Ruby name, `format_`.
|
|
396
|
+
dumped = Anthropic::Internal::Type::Converter.dump(
|
|
397
|
+
Anthropic::Beta::BetaOutputConfig,
|
|
398
|
+
params[:output_config]
|
|
399
|
+
)
|
|
400
|
+
output_config = dumped.to_h.except(:format)
|
|
401
|
+
output_config.empty? ? params.except(:output_config) : {**params, output_config:}
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
# @api private
|
|
405
|
+
private def compact_after_final_turn(&blk)
|
|
406
|
+
return if @pending_compaction.nil?
|
|
407
|
+
|
|
408
|
+
# The loop never adds the final turn to the history, so it is added here for the compaction
|
|
409
|
+
# to cover it, and forgotten so that a later compaction doesn't add it again.
|
|
410
|
+
unless @last_response.nil?
|
|
411
|
+
if client_tool_uses(@last_response).any?
|
|
412
|
+
# A turn that was cut short can end with tool calls that are never run, and the API
|
|
413
|
+
# can't compact a conversation whose last turn has an unanswered tool call.
|
|
414
|
+
warn(
|
|
415
|
+
"[anthropic-ruby] The pending compaction was skipped because the last turn " \
|
|
416
|
+
"(stop_reason: #{@last_response.stop_reason.inspect}) ended with tool calls that " \
|
|
417
|
+
"were not run. Call `#compact_before_next_turn` again if you continue the conversation."
|
|
418
|
+
)
|
|
419
|
+
@pending_compaction = nil
|
|
420
|
+
return
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
current_messages << assistant_turn(@last_response)
|
|
424
|
+
@last_response = nil
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
compact(@pending_compaction, &blk)
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
# @api private
|
|
431
|
+
#
|
|
432
|
+
# A paused turn is sent back as it came, so nothing may follow it.
|
|
433
|
+
private def send_pending_tool_changes
|
|
434
|
+
return if @pending_tool_changes.empty? || @last_response&.stop_reason == :pause_turn
|
|
435
|
+
|
|
436
|
+
current_messages << {role: :system, content: @pending_tool_changes}
|
|
437
|
+
@pending_tool_changes = []
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
# @api private
|
|
441
|
+
#
|
|
442
|
+
# A compaction response replaces the history, `tool_removal` blocks included, so what the
|
|
443
|
+
# history took away is taken out of the overrides first.
|
|
444
|
+
private def keep_removals_from_history
|
|
445
|
+
runnable = [*params[:tools].to_a.grep(Anthropic::Helpers::Tools::BaseTool), *@tool_overrides.values.compact]
|
|
446
|
+
names = runnable.map { Anthropic::Helpers::Messages.tool_api_name(_1) }
|
|
447
|
+
(names - available_tool_names(runnable).to_a).each { @tool_overrides.store(_1, nil) }
|
|
180
448
|
end
|
|
181
449
|
|
|
182
450
|
# @api private
|
|
@@ -219,16 +487,15 @@ module Anthropic
|
|
|
219
487
|
#
|
|
220
488
|
# Replays `tool_removal` / `tool_addition` blocks from `role: :system` messages to
|
|
221
489
|
# find which tool names are still offered to the model. MCP references are
|
|
222
|
-
# server-executed and never dispatched here, so they are ignored.
|
|
490
|
+
# server-executed and never dispatched here, so they are ignored. The overrides already
|
|
491
|
+
# hold the changes waiting to be sent, so those count as the history's last message.
|
|
223
492
|
#
|
|
224
493
|
# @param tools [Array<Anthropic::Helpers::Tools::BaseTool>]
|
|
225
494
|
#
|
|
226
|
-
# @param messages [Array<Anthropic::Beta::BetaMessageParam, Hash{Symbol=>Object}>]
|
|
227
|
-
#
|
|
228
495
|
# @return [Set<String>]
|
|
229
|
-
private def available_tool_names(tools
|
|
496
|
+
private def available_tool_names(tools)
|
|
230
497
|
available = Set.new(tools.map { Anthropic::Helpers::Messages.tool_api_name(_1) })
|
|
231
|
-
|
|
498
|
+
[*current_messages, {role: :system, content: @pending_tool_changes}].each do |message|
|
|
232
499
|
next unless read_field(message, :role)&.to_sym == :system
|
|
233
500
|
|
|
234
501
|
Array(read_field(message, :content)).each { apply_tool_change(_1, available) }
|
|
@@ -244,10 +511,10 @@ module Anthropic
|
|
|
244
511
|
private def apply_tool_change(block, available)
|
|
245
512
|
case read_field(block, :type)&.to_sym
|
|
246
513
|
in :tool_removal
|
|
247
|
-
name =
|
|
514
|
+
name = changed_tool_name(read_field(block, :tool))
|
|
248
515
|
available.delete(name) unless name.nil?
|
|
249
516
|
in :tool_addition
|
|
250
|
-
name =
|
|
517
|
+
name = changed_tool_name(read_field(block, :tool))
|
|
251
518
|
available.add(name) unless name.nil?
|
|
252
519
|
else
|
|
253
520
|
nil # non tool_removal / tool_addition blocks leave the set untouched
|
|
@@ -256,13 +523,16 @@ module Anthropic
|
|
|
256
523
|
|
|
257
524
|
# @api private
|
|
258
525
|
#
|
|
259
|
-
# @param
|
|
526
|
+
# @param tool [Anthropic::Beta::BetaToolChangeToolReference, Anthropic::Beta::BetaToolChangeToolDefinitionParam, Hash{Symbol=>Object}, nil]
|
|
260
527
|
#
|
|
261
528
|
# @return [String, nil]
|
|
262
|
-
private def
|
|
263
|
-
case read_field(
|
|
529
|
+
private def changed_tool_name(tool)
|
|
530
|
+
case read_field(tool, :type)&.to_sym
|
|
264
531
|
in :tool_reference
|
|
265
|
-
read_field(
|
|
532
|
+
read_field(tool, :name).to_s
|
|
533
|
+
in :tool_definition
|
|
534
|
+
# Not every `tools[]` entry has a name (e.g. `mcp_toolset`); those never run here.
|
|
535
|
+
read_field(read_field(tool, :definition), :name)&.to_s
|
|
266
536
|
else
|
|
267
537
|
nil # `mcp_*` references run server-side; unknown types ignored (forward compatibility)
|
|
268
538
|
end
|
|
@@ -296,101 +566,6 @@ module Anthropic
|
|
|
296
566
|
end
|
|
297
567
|
end
|
|
298
568
|
|
|
299
|
-
# Check token usage and compact messages if threshold exceeded
|
|
300
|
-
#
|
|
301
|
-
# @return [Boolean] true if compaction occurred, false otherwise
|
|
302
|
-
# @api private
|
|
303
|
-
private def check_and_compact?
|
|
304
|
-
return false unless @compaction_control&.[](:enabled)
|
|
305
|
-
return false unless @last_response
|
|
306
|
-
|
|
307
|
-
# Calculate total tokens used
|
|
308
|
-
usage = @last_response.usage
|
|
309
|
-
total_input_tokens = (
|
|
310
|
-
usage.input_tokens.to_i +
|
|
311
|
-
usage.cache_creation_input_tokens.to_i +
|
|
312
|
-
usage.cache_read_input_tokens.to_i
|
|
313
|
-
)
|
|
314
|
-
tokens_used = total_input_tokens + usage.output_tokens.to_i
|
|
315
|
-
|
|
316
|
-
# Check if we've exceeded the threshold
|
|
317
|
-
threshold = @compaction_control[:context_token_threshold] || DEFAULT_THRESHOLD
|
|
318
|
-
return false if tokens_used < threshold
|
|
319
|
-
|
|
320
|
-
# Warn once about compaction (only if no callback provided)
|
|
321
|
-
if @compaction_control[:on_compact].nil? && !@compaction_warned
|
|
322
|
-
warn(
|
|
323
|
-
"[anthropic-ruby] Context compaction triggered (#{tokens_used} tokens). " \
|
|
324
|
-
"Use compaction_control: { on_compact: ->(before, after) { ... } } for details."
|
|
325
|
-
)
|
|
326
|
-
@compaction_warned = true
|
|
327
|
-
end
|
|
328
|
-
|
|
329
|
-
# Prepare compaction request
|
|
330
|
-
model = @compaction_control[:model] || params[:model]
|
|
331
|
-
summary_prompt = @compaction_control[:summary_prompt] || DEFAULT_SUMMARY_PROMPT
|
|
332
|
-
|
|
333
|
-
# Prepare messages for compaction - handle tool_use blocks to avoid 400 errors
|
|
334
|
-
messages_for_compaction = current_messages.dup
|
|
335
|
-
|
|
336
|
-
# If last message is from assistant with tool_use blocks, we need to filter them out
|
|
337
|
-
# because tool_use blocks require corresponding tool_result blocks
|
|
338
|
-
if messages_for_compaction.last&.[](:role) == :assistant
|
|
339
|
-
last_msg = messages_for_compaction.last
|
|
340
|
-
content = last_msg[:content]
|
|
341
|
-
|
|
342
|
-
if content.is_a?(Array)
|
|
343
|
-
# Filter out tool_use blocks, keep text/thinking blocks
|
|
344
|
-
non_tool_blocks = content.reject do |block|
|
|
345
|
-
(block.is_a?(Hash) && block[:type] == :tool_use) ||
|
|
346
|
-
block.is_a?(Anthropic::Beta::BetaToolUseBlock)
|
|
347
|
-
end
|
|
348
|
-
|
|
349
|
-
if non_tool_blocks.empty?
|
|
350
|
-
# If no content remains after filtering, remove the entire message
|
|
351
|
-
messages_for_compaction.pop
|
|
352
|
-
else
|
|
353
|
-
# Keep the message but with filtered content
|
|
354
|
-
last_msg[:content] = non_tool_blocks
|
|
355
|
-
end
|
|
356
|
-
end
|
|
357
|
-
end
|
|
358
|
-
|
|
359
|
-
messages = [
|
|
360
|
-
*messages_for_compaction,
|
|
361
|
-
{role: :user, content: summary_prompt}
|
|
362
|
-
]
|
|
363
|
-
|
|
364
|
-
# Get summary from Claude
|
|
365
|
-
response = @client.beta.messages.create(
|
|
366
|
-
with_helper_header(
|
|
367
|
-
{model: model, messages: messages, max_tokens: params[:max_tokens]},
|
|
368
|
-
"compaction"
|
|
369
|
-
)
|
|
370
|
-
)
|
|
371
|
-
|
|
372
|
-
# Validate that compaction response is text
|
|
373
|
-
first_content = response.content.first
|
|
374
|
-
unless first_content.is_a?(Anthropic::Beta::BetaTextBlock)
|
|
375
|
-
raise "Compaction response content is not of type 'text', got: #{first_content.class}"
|
|
376
|
-
end
|
|
377
|
-
|
|
378
|
-
tokens_after = response.usage.output_tokens.to_i
|
|
379
|
-
|
|
380
|
-
# Invoke callback if provided
|
|
381
|
-
@compaction_control[:on_compact]&.call(tokens_used, tokens_after)
|
|
382
|
-
|
|
383
|
-
# Replace message history with just the summary
|
|
384
|
-
self.params = {
|
|
385
|
-
**params,
|
|
386
|
-
messages: [
|
|
387
|
-
{role: :user, content: response.content}
|
|
388
|
-
]
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
true
|
|
392
|
-
end
|
|
393
|
-
|
|
394
569
|
# @api private
|
|
395
570
|
#
|
|
396
571
|
# @param client [Anthropic::Client]
|
|
@@ -398,17 +573,18 @@ module Anthropic
|
|
|
398
573
|
# @param params [Anthropic::Models::Beta::MessageCreateParams]
|
|
399
574
|
#
|
|
400
575
|
# @param max_iterations [Integer, nil]
|
|
401
|
-
|
|
402
|
-
# @param compaction_control [Hash, nil]
|
|
403
|
-
def initialize(client, params:, max_iterations: nil, compaction_control: nil)
|
|
576
|
+
def initialize(client, params:, max_iterations: nil)
|
|
404
577
|
@client = client
|
|
405
578
|
@params = params.to_h
|
|
579
|
+
reject_compaction_param!(@params)
|
|
406
580
|
@finished = false
|
|
407
581
|
@max_iterations = max_iterations
|
|
408
582
|
@iteration_count = 0
|
|
409
|
-
@compaction_control = compaction_control
|
|
410
|
-
@compaction_warned = false
|
|
411
583
|
@last_response = nil
|
|
584
|
+
@pending_tool_changes = []
|
|
585
|
+
@tool_overrides = {}
|
|
586
|
+
@pending_compaction = nil
|
|
587
|
+
@compaction_phase = nil
|
|
412
588
|
end
|
|
413
589
|
|
|
414
590
|
private def with_helper_header(params, helper)
|
|
@@ -286,6 +286,9 @@ module Anthropic
|
|
|
286
286
|
method, uninterpolated_path = req.fetch_values(:method, :path)
|
|
287
287
|
|
|
288
288
|
path = Anthropic::Internal::Util.interpolate_path(uninterpolated_path)
|
|
289
|
+
# Only a path that starts with a scheme (`https:`) can change host. Other paths, `/x` and `//host/x` included,
|
|
290
|
+
# resolve under the base URL's path: `./` replaces their leading slashes so `/https://x` is not read as a URL.
|
|
291
|
+
path = path.sub(%r{\A/*}, "./") unless path.match?(/\A[a-z][a-z0-9+.-]*:/i)
|
|
289
292
|
|
|
290
293
|
query = Anthropic::Internal::Util.deep_merge(req[:query].to_h, opts[:extra_query].to_h)
|
|
291
294
|
|
|
@@ -85,11 +85,10 @@ module Anthropic
|
|
|
85
85
|
case value
|
|
86
86
|
in StringIO | String
|
|
87
87
|
# https://datatracker.ietf.org/doc/html/rfc7578#section-4.2
|
|
88
|
-
|
|
89
|
-
Anthropic::FilePart.new(value, filename: "upload")
|
|
88
|
+
Anthropic::FilePart.new(value, filename: "")
|
|
90
89
|
in IO
|
|
91
90
|
state[:can_retry] = false
|
|
92
|
-
value.to_path.nil? ? Anthropic::FilePart.new(value, filename: "
|
|
91
|
+
value.to_path.nil? ? Anthropic::FilePart.new(value, filename: "") : value
|
|
93
92
|
in Anthropic::FilePart if value.content.is_a?(IO)
|
|
94
93
|
state[:can_retry] = false
|
|
95
94
|
value
|
|
@@ -97,6 +97,10 @@ module Anthropic
|
|
|
97
97
|
|
|
98
98
|
variant const: -> { Anthropic::Models::AnthropicBeta::COMPACT_2026_09_04 }
|
|
99
99
|
|
|
100
|
+
variant const: -> { Anthropic::Models::AnthropicBeta::INLINE_TOOLS_2026_09_15 }
|
|
101
|
+
|
|
102
|
+
variant const: -> { Anthropic::Models::AnthropicBeta::MCP_CLIENT_2026_09_15 }
|
|
103
|
+
|
|
100
104
|
variant String
|
|
101
105
|
|
|
102
106
|
# @!method self.variants
|
|
@@ -154,6 +158,8 @@ module Anthropic
|
|
|
154
158
|
THINKING_BINDING_CONTROLS_2026_08_01 = :"thinking-binding-controls-2026-08-01"
|
|
155
159
|
MID_CONVERSATION_SYSTEM_CLEAR_AT_2026_08_21 = :"mid-conversation-system-clear-at-2026-08-21"
|
|
156
160
|
COMPACT_2026_09_04 = :"compact-2026-09-04"
|
|
161
|
+
INLINE_TOOLS_2026_09_15 = :"inline-tools-2026-09-15"
|
|
162
|
+
MCP_CLIENT_2026_09_15 = :"mcp-client-2026-09-15"
|
|
157
163
|
|
|
158
164
|
# @!endgroup
|
|
159
165
|
end
|
|
@@ -9,6 +9,7 @@ module Anthropic
|
|
|
9
9
|
include Anthropic::Internal::Type::RequestParameters
|
|
10
10
|
|
|
11
11
|
# @!attribute agent_id
|
|
12
|
+
# Unique identifier of the agent to archive.
|
|
12
13
|
#
|
|
13
14
|
# @return [String]
|
|
14
15
|
required :agent_id, String
|
|
@@ -20,16 +21,25 @@ module Anthropic
|
|
|
20
21
|
optional :betas, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::AnthropicBeta] }
|
|
21
22
|
|
|
22
23
|
# @!attribute workspace_id
|
|
24
|
+
# Optional header to select the Workspace for this request. The value is a
|
|
25
|
+
# Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
26
|
+
#
|
|
27
|
+
# Only needed for credentials that can act on more than one Workspace. A
|
|
28
|
+
# credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
29
|
+
# match that Workspace.
|
|
23
30
|
#
|
|
24
31
|
# @return [String, nil]
|
|
25
32
|
optional :workspace_id, String
|
|
26
33
|
|
|
27
34
|
# @!method initialize(agent_id:, betas: nil, workspace_id: nil, request_options: {})
|
|
28
|
-
#
|
|
35
|
+
# Some parameter documentations has been truncated, see
|
|
36
|
+
# {Anthropic::Models::Beta::AgentArchiveParams} for more details.
|
|
37
|
+
#
|
|
38
|
+
# @param agent_id [String] Unique identifier of the agent to archive.
|
|
29
39
|
#
|
|
30
40
|
# @param betas [Array<Symbol, String, Anthropic::Models::AnthropicBeta>] Optional header to specify the beta version(s) you want to use.
|
|
31
41
|
#
|
|
32
|
-
# @param workspace_id [String]
|
|
42
|
+
# @param workspace_id [String] Optional header to select the Workspace for this request. The value is a Workspa
|
|
33
43
|
#
|
|
34
44
|
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}]
|
|
35
45
|
end
|