anthropic 0.74.1__py3-none-any.whl → 0.76.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. anthropic/_base_client.py +140 -11
  2. anthropic/_client.py +4 -12
  3. anthropic/_models.py +16 -1
  4. anthropic/_streaming.py +78 -76
  5. anthropic/_types.py +12 -2
  6. anthropic/_version.py +1 -1
  7. anthropic/lib/streaming/_beta_messages.py +1 -1
  8. anthropic/lib/tools/_beta_compaction_control.py +48 -0
  9. anthropic/lib/tools/_beta_functions.py +30 -8
  10. anthropic/lib/tools/_beta_runner.py +233 -34
  11. anthropic/resources/beta/messages/messages.py +134 -27
  12. anthropic/resources/messages/messages.py +4 -0
  13. anthropic/types/anthropic_beta_param.py +1 -0
  14. anthropic/types/beta/__init__.py +31 -0
  15. anthropic/types/beta/beta_code_execution_tool_20250522_param.py +9 -1
  16. anthropic/types/beta/beta_code_execution_tool_20250825_param.py +9 -1
  17. anthropic/types/beta/beta_container.py +4 -0
  18. anthropic/types/beta/beta_container_params.py +2 -0
  19. anthropic/types/beta/beta_container_upload_block.py +2 -0
  20. anthropic/types/beta/beta_container_upload_block_param.py +5 -0
  21. anthropic/types/beta/beta_content_block.py +2 -0
  22. anthropic/types/beta/beta_content_block_param.py +2 -0
  23. anthropic/types/beta/beta_direct_caller.py +13 -0
  24. anthropic/types/beta/beta_direct_caller_param.py +13 -0
  25. anthropic/types/beta/beta_mcp_tool_config_param.py +15 -0
  26. anthropic/types/beta/beta_mcp_tool_default_config_param.py +15 -0
  27. anthropic/types/beta/beta_mcp_toolset_param.py +34 -0
  28. anthropic/types/beta/beta_memory_tool_20250818_param.py +11 -1
  29. anthropic/types/beta/beta_output_config_param.py +13 -0
  30. anthropic/types/beta/beta_raw_content_block_start_event.py +2 -0
  31. anthropic/types/beta/beta_server_tool_caller.py +15 -0
  32. anthropic/types/beta/beta_server_tool_caller_param.py +15 -0
  33. anthropic/types/beta/beta_server_tool_use_block.py +20 -4
  34. anthropic/types/beta/beta_server_tool_use_block_param.py +19 -4
  35. anthropic/types/beta/beta_skill.py +2 -0
  36. anthropic/types/beta/beta_skill_params.py +2 -0
  37. anthropic/types/beta/beta_tool_bash_20241022_param.py +11 -1
  38. anthropic/types/beta/beta_tool_bash_20250124_param.py +11 -1
  39. anthropic/types/beta/beta_tool_choice_any_param.py +2 -0
  40. anthropic/types/beta/beta_tool_choice_auto_param.py +2 -0
  41. anthropic/types/beta/beta_tool_choice_none_param.py +2 -0
  42. anthropic/types/beta/beta_tool_choice_tool_param.py +2 -0
  43. anthropic/types/beta/beta_tool_computer_use_20241022_param.py +11 -1
  44. anthropic/types/beta/beta_tool_computer_use_20250124_param.py +11 -1
  45. anthropic/types/beta/beta_tool_computer_use_20251124_param.py +47 -0
  46. anthropic/types/beta/beta_tool_param.py +16 -1
  47. anthropic/types/beta/beta_tool_reference_block.py +13 -0
  48. anthropic/types/beta/beta_tool_reference_block_param.py +21 -0
  49. anthropic/types/beta/beta_tool_result_block_param.py +6 -1
  50. anthropic/types/beta/beta_tool_search_tool_bm25_20251119_param.py +33 -0
  51. anthropic/types/beta/beta_tool_search_tool_regex_20251119_param.py +33 -0
  52. anthropic/types/beta/beta_tool_search_tool_result_block.py +20 -0
  53. anthropic/types/beta/beta_tool_search_tool_result_block_param.py +25 -0
  54. anthropic/types/beta/beta_tool_search_tool_result_error.py +16 -0
  55. anthropic/types/beta/beta_tool_search_tool_result_error_param.py +13 -0
  56. anthropic/types/beta/beta_tool_search_tool_search_result_block.py +15 -0
  57. anthropic/types/beta/beta_tool_search_tool_search_result_block_param.py +16 -0
  58. anthropic/types/beta/beta_tool_text_editor_20241022_param.py +11 -1
  59. anthropic/types/beta/beta_tool_text_editor_20250124_param.py +11 -1
  60. anthropic/types/beta/beta_tool_text_editor_20250429_param.py +11 -1
  61. anthropic/types/beta/beta_tool_text_editor_20250728_param.py +11 -1
  62. anthropic/types/beta/beta_tool_union_param.py +8 -0
  63. anthropic/types/beta/beta_tool_use_block.py +11 -3
  64. anthropic/types/beta/beta_tool_use_block_param.py +10 -3
  65. anthropic/types/beta/beta_web_fetch_tool_20250910_param.py +9 -1
  66. anthropic/types/beta/beta_web_search_tool_20250305_param.py +14 -1
  67. anthropic/types/beta/message_count_tokens_params.py +15 -0
  68. anthropic/types/beta/message_create_params.py +7 -0
  69. anthropic/types/beta/messages/batch_create_params.py +4 -4
  70. anthropic/types/beta/messages/beta_message_batch_individual_response.py +4 -0
  71. anthropic/types/messages/batch_create_params.py +2 -2
  72. anthropic/types/messages/message_batch_individual_response.py +4 -0
  73. anthropic/types/model.py +2 -0
  74. anthropic/types/model_param.py +2 -0
  75. anthropic/types/tool_choice_any_param.py +2 -0
  76. anthropic/types/tool_choice_auto_param.py +2 -0
  77. anthropic/types/tool_choice_none_param.py +2 -0
  78. anthropic/types/tool_choice_tool_param.py +2 -0
  79. anthropic/types/tool_param.py +5 -0
  80. anthropic/types/web_search_tool_20250305_param.py +5 -0
  81. {anthropic-0.74.1.dist-info → anthropic-0.76.0.dist-info}/METADATA +4 -2
  82. {anthropic-0.74.1.dist-info → anthropic-0.76.0.dist-info}/RECORD +84 -64
  83. {anthropic-0.74.1.dist-info → anthropic-0.76.0.dist-info}/WHEEL +0 -0
  84. {anthropic-0.74.1.dist-info → anthropic-0.76.0.dist-info}/licenses/LICENSE +0 -0
@@ -18,6 +18,7 @@ from .beta_skill_params import BetaSkillParams as BetaSkillParams
18
18
  from .model_list_params import ModelListParams as ModelListParams
19
19
  from .skill_list_params import SkillListParams as SkillListParams
20
20
  from .beta_content_block import BetaContentBlock as BetaContentBlock
21
+ from .beta_direct_caller import BetaDirectCaller as BetaDirectCaller
21
22
  from .beta_message_param import BetaMessageParam as BetaMessageParam
22
23
  from .beta_text_citation import BetaTextCitation as BetaTextCitation
23
24
  from .file_upload_params import FileUploadParams as FileUploadParams
@@ -42,20 +43,26 @@ from .skill_create_response import SkillCreateResponse as SkillCreateResponse
42
43
  from .skill_delete_response import SkillDeleteResponse as SkillDeleteResponse
43
44
  from .beta_base64_pdf_source import BetaBase64PDFSource as BetaBase64PDFSource
44
45
  from .beta_image_block_param import BetaImageBlockParam as BetaImageBlockParam
46
+ from .beta_mcp_toolset_param import BetaMCPToolsetParam as BetaMCPToolsetParam
45
47
  from .beta_plain_text_source import BetaPlainTextSource as BetaPlainTextSource
46
48
  from .beta_server_tool_usage import BetaServerToolUsage as BetaServerToolUsage
47
49
  from .beta_tool_choice_param import BetaToolChoiceParam as BetaToolChoiceParam
48
50
  from .beta_mcp_tool_use_block import BetaMCPToolUseBlock as BetaMCPToolUseBlock
51
+ from .beta_server_tool_caller import BetaServerToolCaller as BetaServerToolCaller
49
52
  from .skill_retrieve_response import SkillRetrieveResponse as SkillRetrieveResponse
50
53
  from .beta_content_block_param import BetaContentBlockParam as BetaContentBlockParam
54
+ from .beta_direct_caller_param import BetaDirectCallerParam as BetaDirectCallerParam
51
55
  from .beta_message_delta_usage import BetaMessageDeltaUsage as BetaMessageDeltaUsage
56
+ from .beta_output_config_param import BetaOutputConfigParam as BetaOutputConfigParam
52
57
  from .beta_text_citation_param import BetaTextCitationParam as BetaTextCitationParam
53
58
  from .beta_message_tokens_count import BetaMessageTokensCount as BetaMessageTokensCount
54
59
  from .beta_thinking_block_param import BetaThinkingBlockParam as BetaThinkingBlockParam
55
60
  from .beta_thinking_turns_param import BetaThinkingTurnsParam as BetaThinkingTurnsParam
61
+ from .beta_tool_reference_block import BetaToolReferenceBlock as BetaToolReferenceBlock
56
62
  from .beta_tool_use_block_param import BetaToolUseBlockParam as BetaToolUseBlockParam
57
63
  from .beta_tool_uses_keep_param import BetaToolUsesKeepParam as BetaToolUsesKeepParam
58
64
  from .beta_url_pdf_source_param import BetaURLPDFSourceParam as BetaURLPDFSourceParam
65
+ from .beta_mcp_tool_config_param import BetaMCPToolConfigParam as BetaMCPToolConfigParam
59
66
  from .beta_mcp_tool_result_block import BetaMCPToolResultBlock as BetaMCPToolResultBlock
60
67
  from .beta_server_tool_use_block import BetaServerToolUseBlock as BetaServerToolUseBlock
61
68
  from .beta_thinking_config_param import BetaThinkingConfigParam as BetaThinkingConfigParam
@@ -86,6 +93,7 @@ from .beta_all_thinking_turns_param import BetaAllThinkingTurnsParam as BetaAllT
86
93
  from .beta_json_output_format_param import BetaJSONOutputFormatParam as BetaJSONOutputFormatParam
87
94
  from .beta_mcp_tool_use_block_param import BetaMCPToolUseBlockParam as BetaMCPToolUseBlockParam
88
95
  from .beta_raw_message_stream_event import BetaRawMessageStreamEvent as BetaRawMessageStreamEvent
96
+ from .beta_server_tool_caller_param import BetaServerToolCallerParam as BetaServerToolCallerParam
89
97
  from .beta_tool_bash_20241022_param import BetaToolBash20241022Param as BetaToolBash20241022Param
90
98
  from .beta_tool_bash_20250124_param import BetaToolBash20250124Param as BetaToolBash20250124Param
91
99
  from .beta_base64_image_source_param import BetaBase64ImageSourceParam as BetaBase64ImageSourceParam
@@ -94,6 +102,7 @@ from .beta_content_block_source_param import BetaContentBlockSourceParam as Beta
94
102
  from .beta_file_document_source_param import BetaFileDocumentSourceParam as BetaFileDocumentSourceParam
95
103
  from .beta_input_tokens_trigger_param import BetaInputTokensTriggerParam as BetaInputTokensTriggerParam
96
104
  from .beta_memory_tool_20250818_param import BetaMemoryTool20250818Param as BetaMemoryTool20250818Param
105
+ from .beta_tool_reference_block_param import BetaToolReferenceBlockParam as BetaToolReferenceBlockParam
97
106
  from .beta_code_execution_output_block import BetaCodeExecutionOutputBlock as BetaCodeExecutionOutputBlock
98
107
  from .beta_code_execution_result_block import BetaCodeExecutionResultBlock as BetaCodeExecutionResultBlock
99
108
  from .beta_context_management_response import BetaContextManagementResponse as BetaContextManagementResponse
@@ -108,10 +117,13 @@ from .beta_request_document_block_param import BetaRequestDocumentBlockParam as
108
117
  from .beta_web_search_tool_result_block import BetaWebSearchToolResultBlock as BetaWebSearchToolResultBlock
109
118
  from .beta_web_search_tool_result_error import BetaWebSearchToolResultError as BetaWebSearchToolResultError
110
119
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam as BetaCacheControlEphemeralParam
120
+ from .beta_mcp_tool_default_config_param import BetaMCPToolDefaultConfigParam as BetaMCPToolDefaultConfigParam
111
121
  from .beta_raw_content_block_delta_event import BetaRawContentBlockDeltaEvent as BetaRawContentBlockDeltaEvent
112
122
  from .beta_raw_content_block_start_event import BetaRawContentBlockStartEvent as BetaRawContentBlockStartEvent
113
123
  from .beta_redacted_thinking_block_param import BetaRedactedThinkingBlockParam as BetaRedactedThinkingBlockParam
114
124
  from .beta_thinking_config_enabled_param import BetaThinkingConfigEnabledParam as BetaThinkingConfigEnabledParam
125
+ from .beta_tool_search_tool_result_block import BetaToolSearchToolResultBlock as BetaToolSearchToolResultBlock
126
+ from .beta_tool_search_tool_result_error import BetaToolSearchToolResultError as BetaToolSearchToolResultError
115
127
  from .beta_web_fetch_tool_20250910_param import BetaWebFetchTool20250910Param as BetaWebFetchTool20250910Param
116
128
  from .beta_web_search_result_block_param import BetaWebSearchResultBlockParam as BetaWebSearchResultBlockParam
117
129
  from .beta_thinking_config_disabled_param import BetaThinkingConfigDisabledParam as BetaThinkingConfigDisabledParam
@@ -129,6 +141,7 @@ from .beta_code_execution_tool_result_block import BetaCodeExecutionToolResultBl
129
141
  from .beta_code_execution_tool_result_error import BetaCodeExecutionToolResultError as BetaCodeExecutionToolResultError
130
142
  from .beta_tool_computer_use_20241022_param import BetaToolComputerUse20241022Param as BetaToolComputerUse20241022Param
131
143
  from .beta_tool_computer_use_20250124_param import BetaToolComputerUse20250124Param as BetaToolComputerUse20250124Param
144
+ from .beta_tool_computer_use_20251124_param import BetaToolComputerUse20251124Param as BetaToolComputerUse20251124Param
132
145
  from .beta_web_fetch_tool_result_error_code import BetaWebFetchToolResultErrorCode as BetaWebFetchToolResultErrorCode
133
146
  from .beta_code_execution_output_block_param import (
134
147
  BetaCodeExecutionOutputBlockParam as BetaCodeExecutionOutputBlockParam,
@@ -176,12 +189,24 @@ from .beta_memory_tool_20250818_rename_command import (
176
189
  from .beta_request_mcp_tool_result_block_param import (
177
190
  BetaRequestMCPToolResultBlockParam as BetaRequestMCPToolResultBlockParam,
178
191
  )
192
+ from .beta_tool_search_tool_result_block_param import (
193
+ BetaToolSearchToolResultBlockParam as BetaToolSearchToolResultBlockParam,
194
+ )
195
+ from .beta_tool_search_tool_result_error_param import (
196
+ BetaToolSearchToolResultErrorParam as BetaToolSearchToolResultErrorParam,
197
+ )
179
198
  from .beta_web_search_tool_request_error_param import (
180
199
  BetaWebSearchToolRequestErrorParam as BetaWebSearchToolRequestErrorParam,
181
200
  )
182
201
  from .beta_citations_web_search_result_location import (
183
202
  BetaCitationsWebSearchResultLocation as BetaCitationsWebSearchResultLocation,
184
203
  )
204
+ from .beta_tool_search_tool_bm25_20251119_param import (
205
+ BetaToolSearchToolBm25_20251119Param as BetaToolSearchToolBm25_20251119Param,
206
+ )
207
+ from .beta_tool_search_tool_search_result_block import (
208
+ BetaToolSearchToolSearchResultBlock as BetaToolSearchToolSearchResultBlock,
209
+ )
185
210
  from .beta_web_search_tool_result_block_content import (
186
211
  BetaWebSearchToolResultBlockContent as BetaWebSearchToolResultBlockContent,
187
212
  )
@@ -203,6 +228,9 @@ from .beta_clear_thinking_20251015_edit_response import (
203
228
  from .beta_code_execution_tool_result_error_code import (
204
229
  BetaCodeExecutionToolResultErrorCode as BetaCodeExecutionToolResultErrorCode,
205
230
  )
231
+ from .beta_tool_search_tool_regex_20251119_param import (
232
+ BetaToolSearchToolRegex20251119Param as BetaToolSearchToolRegex20251119Param,
233
+ )
206
234
  from .beta_bash_code_execution_output_block_param import (
207
235
  BetaBashCodeExecutionOutputBlockParam as BetaBashCodeExecutionOutputBlockParam,
208
236
  )
@@ -236,6 +264,9 @@ from .beta_memory_tool_20250818_str_replace_command import (
236
264
  from .beta_citation_web_search_result_location_param import (
237
265
  BetaCitationWebSearchResultLocationParam as BetaCitationWebSearchResultLocationParam,
238
266
  )
267
+ from .beta_tool_search_tool_search_result_block_param import (
268
+ BetaToolSearchToolSearchResultBlockParam as BetaToolSearchToolSearchResultBlockParam,
269
+ )
239
270
  from .beta_bash_code_execution_tool_result_block_param import (
240
271
  BetaBashCodeExecutionToolResultBlockParam as BetaBashCodeExecutionToolResultBlockParam,
241
272
  )
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import List, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
@@ -19,7 +19,15 @@ class BetaCodeExecutionTool20250522Param(TypedDict, total=False):
19
19
 
20
20
  type: Required[Literal["code_execution_20250522"]]
21
21
 
22
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
23
+
22
24
  cache_control: Optional[BetaCacheControlEphemeralParam]
23
25
  """Create a cache control breakpoint at this content block."""
24
26
 
27
+ defer_loading: bool
28
+ """If true, tool will not be included in initial system prompt.
29
+
30
+ Only loaded when returned via tool_reference from tool search.
31
+ """
32
+
25
33
  strict: bool
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import List, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
@@ -19,7 +19,15 @@ class BetaCodeExecutionTool20250825Param(TypedDict, total=False):
19
19
 
20
20
  type: Required[Literal["code_execution_20250825"]]
21
21
 
22
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
23
+
22
24
  cache_control: Optional[BetaCacheControlEphemeralParam]
23
25
  """Create a cache control breakpoint at this content block."""
24
26
 
27
+ defer_loading: bool
28
+ """If true, tool will not be included in initial system prompt.
29
+
30
+ Only loaded when returned via tool_reference from tool search.
31
+ """
32
+
25
33
  strict: bool
@@ -10,6 +10,10 @@ __all__ = ["BetaContainer"]
10
10
 
11
11
 
12
12
  class BetaContainer(BaseModel):
13
+ """
14
+ Information about the container used in the request (for the code execution tool)
15
+ """
16
+
13
17
  id: str
14
18
  """Identifier for the container used in this request"""
15
19
 
@@ -11,6 +11,8 @@ __all__ = ["BetaContainerParams"]
11
11
 
12
12
 
13
13
  class BetaContainerParams(TypedDict, total=False):
14
+ """Container parameters with skills to be loaded."""
15
+
14
16
  id: Optional[str]
15
17
  """Container id"""
16
18
 
@@ -8,6 +8,8 @@ __all__ = ["BetaContainerUploadBlock"]
8
8
 
9
9
 
10
10
  class BetaContainerUploadBlock(BaseModel):
11
+ """Response model for a file uploaded to the container."""
12
+
11
13
  file_id: str
12
14
 
13
15
  type: Literal["container_upload"]
@@ -11,6 +11,11 @@ __all__ = ["BetaContainerUploadBlockParam"]
11
11
 
12
12
 
13
13
  class BetaContainerUploadBlockParam(TypedDict, total=False):
14
+ """
15
+ A content block that represents a file to be uploaded to the container
16
+ Files uploaded via this block will be available in the container's input directory.
17
+ """
18
+
14
19
  file_id: Required[str]
15
20
 
16
21
  type: Required[Literal["container_upload"]]
@@ -14,6 +14,7 @@ from .beta_container_upload_block import BetaContainerUploadBlock
14
14
  from .beta_redacted_thinking_block import BetaRedactedThinkingBlock
15
15
  from .beta_web_fetch_tool_result_block import BetaWebFetchToolResultBlock
16
16
  from .beta_web_search_tool_result_block import BetaWebSearchToolResultBlock
17
+ from .beta_tool_search_tool_result_block import BetaToolSearchToolResultBlock
17
18
  from .beta_code_execution_tool_result_block import BetaCodeExecutionToolResultBlock
18
19
  from .beta_bash_code_execution_tool_result_block import BetaBashCodeExecutionToolResultBlock
19
20
  from .beta_text_editor_code_execution_tool_result_block import BetaTextEditorCodeExecutionToolResultBlock
@@ -32,6 +33,7 @@ BetaContentBlock: TypeAlias = Annotated[
32
33
  BetaCodeExecutionToolResultBlock,
33
34
  BetaBashCodeExecutionToolResultBlock,
34
35
  BetaTextEditorCodeExecutionToolResultBlock,
36
+ BetaToolSearchToolResultBlock,
35
37
  BetaMCPToolUseBlock,
36
38
  BetaMCPToolResultBlock,
37
39
  BetaContainerUploadBlock,
@@ -20,6 +20,7 @@ from .beta_redacted_thinking_block_param import BetaRedactedThinkingBlockParam
20
20
  from .beta_web_fetch_tool_result_block_param import BetaWebFetchToolResultBlockParam
21
21
  from .beta_web_search_tool_result_block_param import BetaWebSearchToolResultBlockParam
22
22
  from .beta_request_mcp_tool_result_block_param import BetaRequestMCPToolResultBlockParam
23
+ from .beta_tool_search_tool_result_block_param import BetaToolSearchToolResultBlockParam
23
24
  from .beta_code_execution_tool_result_block_param import BetaCodeExecutionToolResultBlockParam
24
25
  from .beta_bash_code_execution_tool_result_block_param import BetaBashCodeExecutionToolResultBlockParam
25
26
  from .beta_text_editor_code_execution_tool_result_block_param import BetaTextEditorCodeExecutionToolResultBlockParam
@@ -41,6 +42,7 @@ BetaContentBlockParam: TypeAlias = Union[
41
42
  BetaCodeExecutionToolResultBlockParam,
42
43
  BetaBashCodeExecutionToolResultBlockParam,
43
44
  BetaTextEditorCodeExecutionToolResultBlockParam,
45
+ BetaToolSearchToolResultBlockParam,
44
46
  BetaMCPToolUseBlockParam,
45
47
  BetaRequestMCPToolResultBlockParam,
46
48
  BetaContainerUploadBlockParam,
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing_extensions import Literal
4
+
5
+ from ..._models import BaseModel
6
+
7
+ __all__ = ["BetaDirectCaller"]
8
+
9
+
10
+ class BetaDirectCaller(BaseModel):
11
+ """Tool invocation directly from the model."""
12
+
13
+ type: Literal["direct"]
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Literal, Required, TypedDict
6
+
7
+ __all__ = ["BetaDirectCallerParam"]
8
+
9
+
10
+ class BetaDirectCallerParam(TypedDict, total=False):
11
+ """Tool invocation directly from the model."""
12
+
13
+ type: Required[Literal["direct"]]
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import TypedDict
6
+
7
+ __all__ = ["BetaMCPToolConfigParam"]
8
+
9
+
10
+ class BetaMCPToolConfigParam(TypedDict, total=False):
11
+ """Configuration for a specific tool in an MCP toolset."""
12
+
13
+ defer_loading: bool
14
+
15
+ enabled: bool
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import TypedDict
6
+
7
+ __all__ = ["BetaMCPToolDefaultConfigParam"]
8
+
9
+
10
+ class BetaMCPToolDefaultConfigParam(TypedDict, total=False):
11
+ """Default configuration for tools in an MCP toolset."""
12
+
13
+ defer_loading: bool
14
+
15
+ enabled: bool
@@ -0,0 +1,34 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Dict, Optional
6
+ from typing_extensions import Literal, Required, TypedDict
7
+
8
+ from .beta_mcp_tool_config_param import BetaMCPToolConfigParam
9
+ from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
10
+ from .beta_mcp_tool_default_config_param import BetaMCPToolDefaultConfigParam
11
+
12
+ __all__ = ["BetaMCPToolsetParam"]
13
+
14
+
15
+ class BetaMCPToolsetParam(TypedDict, total=False):
16
+ """Configuration for a group of tools from an MCP server.
17
+
18
+ Allows configuring enabled status and defer_loading for all tools
19
+ from an MCP server, with optional per-tool overrides.
20
+ """
21
+
22
+ mcp_server_name: Required[str]
23
+ """Name of the MCP server to configure tools for"""
24
+
25
+ type: Required[Literal["mcp_toolset"]]
26
+
27
+ cache_control: Optional[BetaCacheControlEphemeralParam]
28
+ """Create a cache control breakpoint at this content block."""
29
+
30
+ configs: Optional[Dict[str, BetaMCPToolConfigParam]]
31
+ """Configuration overrides for specific tools, keyed by tool name"""
32
+
33
+ default_config: BetaMCPToolDefaultConfigParam
34
+ """Default configuration applied to all tools from this server"""
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import Dict, List, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
@@ -19,7 +19,17 @@ class BetaMemoryTool20250818Param(TypedDict, total=False):
19
19
 
20
20
  type: Required[Literal["memory_20250818"]]
21
21
 
22
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
23
+
22
24
  cache_control: Optional[BetaCacheControlEphemeralParam]
23
25
  """Create a cache control breakpoint at this content block."""
24
26
 
27
+ defer_loading: bool
28
+ """If true, tool will not be included in initial system prompt.
29
+
30
+ Only loaded when returned via tool_reference from tool search.
31
+ """
32
+
33
+ input_examples: Iterable[Dict[str, object]]
34
+
25
35
  strict: bool
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal, TypedDict
7
+
8
+ __all__ = ["BetaOutputConfigParam"]
9
+
10
+
11
+ class BetaOutputConfigParam(TypedDict, total=False):
12
+ effort: Optional[Literal["low", "medium", "high"]]
13
+ """All possible effort levels."""
@@ -15,6 +15,7 @@ from .beta_container_upload_block import BetaContainerUploadBlock
15
15
  from .beta_redacted_thinking_block import BetaRedactedThinkingBlock
16
16
  from .beta_web_fetch_tool_result_block import BetaWebFetchToolResultBlock
17
17
  from .beta_web_search_tool_result_block import BetaWebSearchToolResultBlock
18
+ from .beta_tool_search_tool_result_block import BetaToolSearchToolResultBlock
18
19
  from .beta_code_execution_tool_result_block import BetaCodeExecutionToolResultBlock
19
20
  from .beta_bash_code_execution_tool_result_block import BetaBashCodeExecutionToolResultBlock
20
21
  from .beta_text_editor_code_execution_tool_result_block import BetaTextEditorCodeExecutionToolResultBlock
@@ -33,6 +34,7 @@ ContentBlock: TypeAlias = Annotated[
33
34
  BetaCodeExecutionToolResultBlock,
34
35
  BetaBashCodeExecutionToolResultBlock,
35
36
  BetaTextEditorCodeExecutionToolResultBlock,
37
+ BetaToolSearchToolResultBlock,
36
38
  BetaMCPToolUseBlock,
37
39
  BetaMCPToolResultBlock,
38
40
  BetaContainerUploadBlock,
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing_extensions import Literal
4
+
5
+ from ..._models import BaseModel
6
+
7
+ __all__ = ["BetaServerToolCaller"]
8
+
9
+
10
+ class BetaServerToolCaller(BaseModel):
11
+ """Tool invocation generated by a server-side tool."""
12
+
13
+ tool_id: str
14
+
15
+ type: Literal["code_execution_20250825"]
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Literal, Required, TypedDict
6
+
7
+ __all__ = ["BetaServerToolCallerParam"]
8
+
9
+
10
+ class BetaServerToolCallerParam(TypedDict, total=False):
11
+ """Tool invocation generated by a server-side tool."""
12
+
13
+ tool_id: Required[str]
14
+
15
+ type: Required[Literal["code_execution_20250825"]]
@@ -1,18 +1,34 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- from typing import Dict
4
- from typing_extensions import Literal
3
+ from typing import Dict, Union
4
+ from typing_extensions import Literal, Annotated, TypeAlias
5
5
 
6
+ from ..._utils import PropertyInfo
6
7
  from ..._models import BaseModel
8
+ from .beta_direct_caller import BetaDirectCaller
9
+ from .beta_server_tool_caller import BetaServerToolCaller
7
10
 
8
- __all__ = ["BetaServerToolUseBlock"]
11
+ __all__ = ["BetaServerToolUseBlock", "Caller"]
12
+
13
+ Caller: TypeAlias = Annotated[Union[BetaDirectCaller, BetaServerToolCaller], PropertyInfo(discriminator="type")]
9
14
 
10
15
 
11
16
  class BetaServerToolUseBlock(BaseModel):
12
17
  id: str
13
18
 
19
+ caller: Caller
20
+ """Tool invocation directly from the model."""
21
+
14
22
  input: Dict[str, object]
15
23
 
16
- name: Literal["web_search", "web_fetch", "code_execution", "bash_code_execution", "text_editor_code_execution"]
24
+ name: Literal[
25
+ "web_search",
26
+ "web_fetch",
27
+ "code_execution",
28
+ "bash_code_execution",
29
+ "text_editor_code_execution",
30
+ "tool_search_tool_regex",
31
+ "tool_search_tool_bm25",
32
+ ]
17
33
 
18
34
  type: Literal["server_tool_use"]
@@ -2,12 +2,16 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, Optional
6
- from typing_extensions import Literal, Required, TypedDict
5
+ from typing import Dict, Union, Optional
6
+ from typing_extensions import Literal, Required, TypeAlias, TypedDict
7
7
 
8
+ from .beta_direct_caller_param import BetaDirectCallerParam
9
+ from .beta_server_tool_caller_param import BetaServerToolCallerParam
8
10
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
9
11
 
10
- __all__ = ["BetaServerToolUseBlockParam"]
12
+ __all__ = ["BetaServerToolUseBlockParam", "Caller"]
13
+
14
+ Caller: TypeAlias = Union[BetaDirectCallerParam, BetaServerToolCallerParam]
11
15
 
12
16
 
13
17
  class BetaServerToolUseBlockParam(TypedDict, total=False):
@@ -16,10 +20,21 @@ class BetaServerToolUseBlockParam(TypedDict, total=False):
16
20
  input: Required[Dict[str, object]]
17
21
 
18
22
  name: Required[
19
- Literal["web_search", "web_fetch", "code_execution", "bash_code_execution", "text_editor_code_execution"]
23
+ Literal[
24
+ "web_search",
25
+ "web_fetch",
26
+ "code_execution",
27
+ "bash_code_execution",
28
+ "text_editor_code_execution",
29
+ "tool_search_tool_regex",
30
+ "tool_search_tool_bm25",
31
+ ]
20
32
  ]
21
33
 
22
34
  type: Required[Literal["server_tool_use"]]
23
35
 
24
36
  cache_control: Optional[BetaCacheControlEphemeralParam]
25
37
  """Create a cache control breakpoint at this content block."""
38
+
39
+ caller: Caller
40
+ """Tool invocation directly from the model."""
@@ -8,6 +8,8 @@ __all__ = ["BetaSkill"]
8
8
 
9
9
 
10
10
  class BetaSkill(BaseModel):
11
+ """A skill that was loaded in a container (response model)."""
12
+
11
13
  skill_id: str
12
14
  """Skill ID"""
13
15
 
@@ -8,6 +8,8 @@ __all__ = ["BetaSkillParams"]
8
8
 
9
9
 
10
10
  class BetaSkillParams(TypedDict, total=False):
11
+ """Specification for a skill to be loaded in a container (request model)."""
12
+
11
13
  skill_id: Required[str]
12
14
  """Skill ID"""
13
15
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import Dict, List, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
@@ -19,7 +19,17 @@ class BetaToolBash20241022Param(TypedDict, total=False):
19
19
 
20
20
  type: Required[Literal["bash_20241022"]]
21
21
 
22
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
23
+
22
24
  cache_control: Optional[BetaCacheControlEphemeralParam]
23
25
  """Create a cache control breakpoint at this content block."""
24
26
 
27
+ defer_loading: bool
28
+ """If true, tool will not be included in initial system prompt.
29
+
30
+ Only loaded when returned via tool_reference from tool search.
31
+ """
32
+
33
+ input_examples: Iterable[Dict[str, object]]
34
+
25
35
  strict: bool
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import Dict, List, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
@@ -19,7 +19,17 @@ class BetaToolBash20250124Param(TypedDict, total=False):
19
19
 
20
20
  type: Required[Literal["bash_20250124"]]
21
21
 
22
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
23
+
22
24
  cache_control: Optional[BetaCacheControlEphemeralParam]
23
25
  """Create a cache control breakpoint at this content block."""
24
26
 
27
+ defer_loading: bool
28
+ """If true, tool will not be included in initial system prompt.
29
+
30
+ Only loaded when returned via tool_reference from tool search.
31
+ """
32
+
33
+ input_examples: Iterable[Dict[str, object]]
34
+
25
35
  strict: bool
@@ -8,6 +8,8 @@ __all__ = ["BetaToolChoiceAnyParam"]
8
8
 
9
9
 
10
10
  class BetaToolChoiceAnyParam(TypedDict, total=False):
11
+ """The model will use any available tools."""
12
+
11
13
  type: Required[Literal["any"]]
12
14
 
13
15
  disable_parallel_tool_use: bool
@@ -8,6 +8,8 @@ __all__ = ["BetaToolChoiceAutoParam"]
8
8
 
9
9
 
10
10
  class BetaToolChoiceAutoParam(TypedDict, total=False):
11
+ """The model will automatically decide whether to use tools."""
12
+
11
13
  type: Required[Literal["auto"]]
12
14
 
13
15
  disable_parallel_tool_use: bool
@@ -8,4 +8,6 @@ __all__ = ["BetaToolChoiceNoneParam"]
8
8
 
9
9
 
10
10
  class BetaToolChoiceNoneParam(TypedDict, total=False):
11
+ """The model will not be allowed to use tools."""
12
+
11
13
  type: Required[Literal["none"]]
@@ -8,6 +8,8 @@ __all__ = ["BetaToolChoiceToolParam"]
8
8
 
9
9
 
10
10
  class BetaToolChoiceToolParam(TypedDict, total=False):
11
+ """The model will use the specified tool with `tool_choice.name`."""
12
+
11
13
  name: Required[str]
12
14
  """The name of the tool to use."""
13
15