From d2023274f69dd0609ddabbf8f6af08041f868d8b Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Tue, 1 Sep 2026 12:58:22 -0700 Subject: [PATCH 01/10] chore(internal): clean up code comments (#578) Co-authored-by: Claude --- examples/memory/basic.py | 12 ----- examples/structured_outputs_streaming.py | 1 - examples/web_search.py | 3 -- examples/web_search_stream.py | 4 -- src/anthropic/lib/_stainless_helpers.py | 1 - src/anthropic/lib/bedrock/_mantle.py | 15 ------- src/anthropic/lib/credentials/_providers.py | 8 ---- src/anthropic/lib/foundry.py | 3 -- src/anthropic/lib/google_cloud/_client.py | 3 -- src/anthropic/lib/middleware/_fallbacks.py | 9 ---- src/anthropic/lib/streaming/_beta_messages.py | 2 - src/anthropic/lib/streaming/_messages.py | 2 - src/anthropic/lib/tools/_beta_functions.py | 1 - .../lib/tools/_beta_session_runner.py | 10 ----- src/anthropic/lib/tools/mcp.py | 44 ------------------- tests/lib/streaming/test_beta_messages.py | 7 --- tests/lib/streaming/test_messages.py | 6 --- tests/lib/streaming/test_partial_json.py | 6 --- tests/lib/tools/test_functions.py | 3 -- 19 files changed, 140 deletions(-) diff --git a/examples/memory/basic.py b/examples/memory/basic.py index 8a61576a6..18db19344 100644 --- a/examples/memory/basic.py +++ b/examples/memory/basic.py @@ -73,7 +73,6 @@ def conversation_loop(): messages: list[BetaMessageParam] = [] - # Initialize tracking for debug last_response_id: Optional[str] = None last_usage = None @@ -85,7 +84,6 @@ def conversation_loop(): print(" /memory_clear - Delete all memory") print(" /debug - View conversation history and token usage") - # Display context management settings print(f"\n๐Ÿงน Context Management") print("=" * 60) @@ -115,11 +113,9 @@ def conversation_loop(): elif user_input.lower() == "/debug": print("\n๐Ÿ” Conversation history:") - # Show last response ID if available if last_response_id: print(f"๐Ÿ“Œ Last response ID: {last_response_id}") - # Show token usage if available if last_usage: usage = last_usage input_tokens = usage.get("input_tokens", 0) @@ -170,7 +166,6 @@ def conversation_loop(): spinner = Spinner("Thinking") spinner.start() - # Use tool_runner with memory tool try: runner = client.beta.messages.tool_runner( betas=["context-management-2025-06-27"], @@ -185,22 +180,18 @@ def conversation_loop(): spinner.stop() raise - # Process all messages from the runner for message in runner: spinner.stop() - # Store response ID and usage for debug display last_response_id = message.id if hasattr(message, "usage") and message.usage: last_usage = message.usage.model_dump() if hasattr(message.usage, "model_dump") else dict(message.usage) - # Check for context management actions if message.context_management: for edit in message.context_management.applied_edits: print(f"\n๐Ÿงน [Context Management: {edit.type} applied]") - # Process content blocks assistant_content: list[BetaContentBlockParam] = [] for content in message.content: if content.type == "text": @@ -222,14 +213,11 @@ def conversation_loop(): } ) - # Store assistant message if assistant_content: messages.append({"role": "assistant", "content": assistant_content}) - # Generate tool response automatically tool_response = runner.generate_tool_call_response() if tool_response and tool_response["content"]: - # Add tool results to messages messages.append({"role": "user", "content": tool_response["content"]}) for result in tool_response["content"]: diff --git a/examples/structured_outputs_streaming.py b/examples/structured_outputs_streaming.py index b076b762c..5a9438c9c 100644 --- a/examples/structured_outputs_streaming.py +++ b/examples/structured_outputs_streaming.py @@ -26,6 +26,5 @@ class Order(pydantic.BaseModel): if event.type == "text": print(event.parsed_snapshot()) - # Get the final parsed output final_message = stream.get_final_message() print(f"\nFinal parsed order: {final_message.parsed_output}") diff --git a/examples/web_search.py b/examples/web_search.py index 76cfcdd00..fbbfd7b0e 100644 --- a/examples/web_search.py +++ b/examples/web_search.py @@ -17,17 +17,14 @@ ], ) -# Print the full response print("\nFull response:") print(message.model_dump_json(indent=2)) -# Extract and print the content print("\nResponse content:") for content_block in message.content: if content_block.type == "text": print(content_block.text) -# Print usage information print("\nUsage statistics:") print(f"Input tokens: {message.usage.input_tokens}") print(f"Output tokens: {message.usage.output_tokens}") diff --git a/examples/web_search_stream.py b/examples/web_search_stream.py index b34b61c16..d816fac8d 100644 --- a/examples/web_search_stream.py +++ b/examples/web_search_stream.py @@ -21,9 +21,7 @@ async def main() -> None: } ], ) as stream: - # Process streaming events async for chunk in stream: - # Print text deltas as they arrive if chunk.type == "content_block_delta" and chunk.delta.type == "text_delta": print(chunk.delta.text, end="", flush=True) @@ -34,7 +32,6 @@ async def main() -> None: elif chunk.type == "content_block_stop" and chunk.content_block.type == "web_search_tool_result": print("[Web search completed]", end="\n\n", flush=True) - # Get the final complete message message = await stream.get_final_message() print("\n\nFinal usage statistics:") @@ -52,7 +49,6 @@ async def main() -> None: for i, block in enumerate(message.content): print(f"Content Block {i + 1}: Type = {block.type}") - # Show the entire message structure as JSON for debugging print("\nComplete message structure (JSON):") print(message.model_dump_json(indent=2)) diff --git a/src/anthropic/lib/_stainless_helpers.py b/src/anthropic/lib/_stainless_helpers.py index 9b14fb1cc..d7d65dcc4 100644 --- a/src/anthropic/lib/_stainless_helpers.py +++ b/src/anthropic/lib/_stainless_helpers.py @@ -113,7 +113,6 @@ def _add(tag: str | None) -> None: for message in messages: _add(get_helper_tag(message)) - # Check content blocks within messages if isinstance(message, dict): blocks: Any = cast(dict[str, Any], message).get("content") else: diff --git a/src/anthropic/lib/bedrock/_mantle.py b/src/anthropic/lib/bedrock/_mantle.py index 8c8c0f32c..85e261b05 100644 --- a/src/anthropic/lib/bedrock/_mantle.py +++ b/src/anthropic/lib/bedrock/_mantle.py @@ -41,9 +41,6 @@ _DefaultStreamT = TypeVar("_DefaultStreamT", bound=Union[Stream[Any], AsyncStream[Any]]) -# --- Beta resources (messages-only) --- - - class MantleBeta(SyncAPIResource): @cached_property def messages(self) -> BetaMessages: @@ -56,9 +53,6 @@ def messages(self) -> AsyncBetaMessages: return AsyncBetaMessages(self._client) -# --- Base --- - - class BaseMantleClient(BaseClient[_HttpxClientT, _DefaultStreamT]): @override def _make_status_error( @@ -100,9 +94,6 @@ def _make_status_error( return APIStatusError(err_msg, response=response, body=body) -# --- Shared init logic --- - - def _resolve_mantle_config( *, api_key: str | None, @@ -158,9 +149,6 @@ def _resolve_mantle_config( return resolved_api_key, base_url, use_sigv4, merged_headers -# --- Sync client --- - - class AnthropicBedrockMantle(BaseMantleClient[httpx2.Client, Stream[Any]], SyncAPIClient): messages: Messages beta: MantleBeta @@ -354,9 +342,6 @@ def with_middleware(self, *middleware: MiddlewareInput) -> Self: return self.copy(middleware=[*self._middleware, *middleware]) -# --- Async client --- - - class AsyncAnthropicBedrockMantle(BaseMantleClient[httpx2.AsyncClient, AsyncStream[Any]], AsyncAPIClient): messages: AsyncMessages beta: AsyncMantleBeta diff --git a/src/anthropic/lib/credentials/_providers.py b/src/anthropic/lib/credentials/_providers.py index 605628bf2..a50d529d3 100644 --- a/src/anthropic/lib/credentials/_providers.py +++ b/src/anthropic/lib/credentials/_providers.py @@ -301,8 +301,6 @@ def extra_headers(self) -> Dict[str, str]: headers["anthropic-workspace-id"] = str(workspace_id) return headers - # -- file IO ----------------------------------------------------------- - def _load_config(self) -> Dict[str, Any]: """Read and cache the config file, resolving ``base_url`` and ``credentials_path``.""" if self._config is not None: @@ -496,8 +494,6 @@ def _atomic_write_credentials(self, data: Dict[str, Any]) -> None: except OSError: pass - # -- dispatch ---------------------------------------------------------- - def _auth_block(self) -> Dict[str, Any]: """Return the cached ``authentication`` sub-object from the config file.""" config = self._load_config() @@ -518,8 +514,6 @@ def __call__(self, *, force_refresh: bool = False) -> AccessToken: f"Expected {AUTH_TYPE_OIDC_FEDERATION!r} or {AUTH_TYPE_USER_OAUTH!r}." ) - # -- "user_oauth" ----------------------------------------------------- - def _call_user_oauth(self, auth: Dict[str, Any], *, force_refresh: bool = False) -> AccessToken: """Interactive-login profile. With a ``client_id`` in the auth block, we run the refresh_token grant on expiry; without one, we treat the @@ -630,8 +624,6 @@ def _call_user_oauth(self, auth: Dict[str, Any], *, force_refresh: bool = False) return AccessToken(token=_unwrap_secret(new_access), expires_at=new_expires_at) - # -- "oidc_federation" ------------------------------------------------ - def _read_credentials_if_exists(self) -> Optional[Dict[str, Any]]: """``_read_credentials`` variant that returns ``None`` on absence instead of raising โ€” used by the federation disk-cache path where a diff --git a/src/anthropic/lib/foundry.py b/src/anthropic/lib/foundry.py index 78500a5c3..bcd7f133a 100644 --- a/src/anthropic/lib/foundry.py +++ b/src/anthropic/lib/foundry.py @@ -89,9 +89,6 @@ def messages(self) -> AsyncBetaMessages: # type: ignore[override] return AsyncBetaFoundryMessages(self._client) -# ============================================================================== - - class AnthropicFoundry(BaseFoundryClient[httpx2.Client, Stream[Any]], Anthropic): @overload def __init__( diff --git a/src/anthropic/lib/google_cloud/_client.py b/src/anthropic/lib/google_cloud/_client.py index 73c5c3675..2d8a95879 100644 --- a/src/anthropic/lib/google_cloud/_client.py +++ b/src/anthropic/lib/google_cloud/_client.py @@ -183,9 +183,6 @@ def _project_from_credentials(credentials: GoogleCredentials) -> str | None: return None -# ============================================================================== - - class AnthropicGoogleCloud(BaseGoogleCloudClient[httpx2.Client, Stream[Any]], Anthropic): """Synchronous client for the first-party Anthropic API served through Google's gateway (Claude Platform on Google Cloud). diff --git a/src/anthropic/lib/middleware/_fallbacks.py b/src/anthropic/lib/middleware/_fallbacks.py index 8c0314380..cd9cc1f27 100644 --- a/src/anthropic/lib/middleware/_fallbacks.py +++ b/src/anthropic/lib/middleware/_fallbacks.py @@ -722,9 +722,6 @@ async def _spliced_frames_async( await current.aclose() -# --- hop consumption --------------------------------------------------------- - - class _Refusal(BaseModel): token: Optional[str] """The minted credit token; `None` for a token-less start-of-stream refusal.""" @@ -1311,9 +1308,6 @@ def close_open_blocks(self) -> Iterator[bytes]: self._open.clear() -# --- block accumulation & prefill conversion ------------------------------- - - def _apply_delta(blocks: list[tuple[int, dict[str, Any]]], index: int, delta: dict[str, Any]) -> None: """Apply a content_block_delta to the accumulating block at `index`.""" block = next((block for block_index, block in blocks if block_index == index), None) @@ -1366,9 +1360,6 @@ def _to_prefill_blocks(response_blocks: list[dict[str, Any]]) -> list[Any]: return out -# --- helpers -------------------------------------------------------------- - - def _strip_seam_blocks(body: dict[str, Any]) -> dict[str, Any]: """A copy of `body` with `{type: "fallback"}` seam blocks filtered out of the replayed message history; `body` itself when there are none. diff --git a/src/anthropic/lib/streaming/_beta_messages.py b/src/anthropic/lib/streaming/_beta_messages.py index 028dd80ef..59aebba72 100644 --- a/src/anthropic/lib/streaming/_beta_messages.py +++ b/src/anthropic/lib/streaming/_beta_messages.py @@ -126,7 +126,6 @@ def until_done(self) -> None: """Blocks until the stream has been consumed""" consume_sync_iterator(self) - # properties @property def current_message_snapshot(self) -> ParsedBetaMessage[ResponseFormatT]: assert self.__final_message_snapshot is not None @@ -279,7 +278,6 @@ async def until_done(self) -> None: """Waits until the stream has been consumed""" await consume_async_iterator(self) - # properties @property def current_message_snapshot(self) -> ParsedBetaMessage[ResponseFormatT]: assert self.__final_message_snapshot is not None diff --git a/src/anthropic/lib/streaming/_messages.py b/src/anthropic/lib/streaming/_messages.py index ae7b42393..80a5e6403 100644 --- a/src/anthropic/lib/streaming/_messages.py +++ b/src/anthropic/lib/streaming/_messages.py @@ -123,7 +123,6 @@ def until_done(self) -> None: """Blocks until the stream has been consumed""" consume_sync_iterator(self) - # properties @property def current_message_snapshot(self) -> ParsedMessage[ResponseFormatT]: assert self.__final_message_snapshot is not None @@ -275,7 +274,6 @@ async def until_done(self) -> None: """Waits until the stream has been consumed""" await consume_async_iterator(self) - # properties @property def current_message_snapshot(self) -> ParsedMessage[ResponseFormatT]: assert self.__final_message_snapshot is not None diff --git a/src/anthropic/lib/tools/_beta_functions.py b/src/anthropic/lib/tools/_beta_functions.py index ca69c06b6..6b49e1407 100644 --- a/src/anthropic/lib/tools/_beta_functions.py +++ b/src/anthropic/lib/tools/_beta_functions.py @@ -249,7 +249,6 @@ def kw_arguments_schema( if not properties or not is_dict(properties): return schema - # Add parameter descriptions from docstring for param in self._parsed_docstring.params: prop_schema = properties.get(param.arg_name) if not prop_schema or not is_dict(prop_schema): diff --git a/src/anthropic/lib/tools/_beta_session_runner.py b/src/anthropic/lib/tools/_beta_session_runner.py index 633072bf2..9d7186305 100644 --- a/src/anthropic/lib/tools/_beta_session_runner.py +++ b/src/anthropic/lib/tools/_beta_session_runner.py @@ -481,8 +481,6 @@ async def until_done(self) -> None: async for _ in self: pass - # -- run lifecycle ------------------------------------------------------ - @contextlib.asynccontextmanager async def _run(self) -> AsyncIterator[AsyncIterator[DispatchedToolCall]]: """Drive the session tool loop, yielding an iterator of @@ -571,8 +569,6 @@ async def iterator() -> AsyncIterator[DispatchedToolCall]: for tool in self.tools: await aclose_runnable_tool(tool) - # -- event-stream + reconcile ------------------------------------------ - async def _reconcile(self) -> None: """Read full history and enqueue every tool-call event still unanswered. @@ -696,8 +692,6 @@ async def _stream_loop(self) -> None: await self._stop.wait() backoff = min(backoff * 2, STREAM_BACKOFF_CAP) - # -- confirmation gating (always_ask tools) ------------------------------ - async def _route_tool_event(self, ev: DispatchedToolUseEvent) -> None: """Enqueue ``ev`` for dispatch, honoring its evaluated permission. @@ -812,8 +806,6 @@ async def _surface_call(self, call: DispatchedToolCall) -> None: except (anyio.BrokenResourceError, anyio.ClosedResourceError): pass - # -- tool dispatch ------------------------------------------------------ - async def _dispatch_loop(self) -> None: try: while True: @@ -948,8 +940,6 @@ async def _send_result(self, tool_result: DispatchedToolResultParams, tool_use_i log.error("failed to send tool result tool_use_id=%s attempts=%d error=%s", tool_use_id, attempt, last_err) return False - # -- background watchers ----------------------------------------------- - async def _idle_watchdog(self) -> None: """Stop the runner once the session has been idle (``end_turn``) for ``max_idle`` seconds with no new events. diff --git a/src/anthropic/lib/tools/mcp.py b/src/anthropic/lib/tools/mcp.py index ec9915ea5..95f1888da 100644 --- a/src/anthropic/lib/tools/mcp.py +++ b/src/anthropic/lib/tools/mcp.py @@ -64,10 +64,6 @@ "UnsupportedMCPValueError", ] -# ----------------------------------------------------------------------- -# mcp version compatibility -# ----------------------------------------------------------------------- - # mcp<2 exposes camelCase model fields (`tool.inputSchema`); mcp>=2 exposes # snake_case (`tool.input_schema`). Read through this helper to support both. @@ -86,10 +82,6 @@ def _mcp_field_v1_or_v2(obj: Any, name: str) -> Any: return getattr(obj, _MCP_V1_NAMES[name]) -# ----------------------------------------------------------------------- -# Supported MIME types -# ----------------------------------------------------------------------- - _SUPPORTED_IMAGE_TYPES = frozenset({"image/jpeg", "image/png", "image/gif", "image/webp"}) @@ -118,20 +110,10 @@ def _is_supported_resource_mime_type(mime_type: str | None) -> bool: ) -# ----------------------------------------------------------------------- -# Errors -# ----------------------------------------------------------------------- - - class UnsupportedMCPValueError(Exception): """Raised when an MCP value cannot be converted to a format supported by the Claude API.""" -# ----------------------------------------------------------------------- -# Content conversion -# ----------------------------------------------------------------------- - - def mcp_content( content: ContentBlock, *, @@ -184,7 +166,6 @@ def _resource_contents_to_block( """Convert MCP resource contents to an Anthropic content block.""" mime_type = _mcp_field_v1_or_v2(resource, "mime_type") - # Images if mime_type is not None and _is_supported_image_type(mime_type): if not isinstance(resource, BlobResourceContents): raise UnsupportedMCPValueError(f"Image resource must have blob data, not text. URI: {resource.uri}") @@ -203,7 +184,6 @@ def _resource_contents_to_block( tag_helper(image_block, "mcp_resource_to_content") return image_block # type: ignore[return-value] - # PDFs if mime_type == "application/pdf": if not isinstance(resource, BlobResourceContents): raise UnsupportedMCPValueError(f"PDF resource must have blob data, not text. URI: {resource.uri}") @@ -222,7 +202,6 @@ def _resource_contents_to_block( tag_helper(pdf_block, "mcp_resource_to_content") return pdf_block # type: ignore[return-value] - # Text (text/*, or no MIME type) if mime_type is None or mime_type.startswith("text/"): if isinstance(resource, TextResourceContents): data = resource.text @@ -246,11 +225,6 @@ def _resource_contents_to_block( raise UnsupportedMCPValueError(f'Unsupported MIME type "{mime_type}" for resource: {resource.uri}') -# ----------------------------------------------------------------------- -# Message conversion -# ----------------------------------------------------------------------- - - def mcp_message( message: PromptMessage, *, @@ -267,11 +241,6 @@ def mcp_message( return result -# ----------------------------------------------------------------------- -# Resource conversion -# ----------------------------------------------------------------------- - - def mcp_resource_to_content( result: ReadResourceResult, *, @@ -313,11 +282,9 @@ def mcp_resource_to_file( resource = result.contents[0] uri_str = str(resource.uri) - # Extract filename from URI path = urlparse(uri_str).path name = path.rsplit("/", 1)[-1] if path else None - # Get bytes if isinstance(resource, BlobResourceContents): content_bytes = base64.b64decode(resource.blob) else: @@ -328,17 +295,11 @@ def mcp_resource_to_file( return file_tuple -# ----------------------------------------------------------------------- -# Tool result conversion (used by tool call handlers) -# ----------------------------------------------------------------------- - - def _convert_tool_result(result: CallToolResult) -> BetaFunctionToolResultType: """Convert MCP ``CallToolResult`` to a value suitable for returning from ``call()``.""" if _mcp_field_v1_or_v2(result, "is_error"): raise ToolError([mcp_content(item) for item in result.content]) - # If content is empty but structuredContent is present, JSON-encode it structured_content = _mcp_field_v1_or_v2(result, "structured_content") if not result.content and structured_content is not None: return json.dumps(structured_content) @@ -346,11 +307,6 @@ def _convert_tool_result(result: CallToolResult) -> BetaFunctionToolResultType: return [mcp_content(item) for item in result.content] -# ----------------------------------------------------------------------- -# Public factory functions -# ----------------------------------------------------------------------- - - def mcp_tool( tool: Tool, client: ClientSession, diff --git a/tests/lib/streaming/test_beta_messages.py b/tests/lib/streaming/test_beta_messages.py index c1cdf4915..a6856980c 100644 --- a/tests/lib/streaming/test_beta_messages.py +++ b/tests/lib/streaming/test_beta_messages.py @@ -888,7 +888,6 @@ def test_tool_runner_method_definition_in_sync(sync: bool) -> None: # go through all the ContentBlock types to make sure the type alias is up to date # with any type that has an input property of type object def test_tracks_tool_input_type_alias_is_up_to_date() -> None: - # only run this on Pydantic v2 if PYDANTIC_V1: pytest.skip("This test is only applicable for Pydantic v2") from typing import get_args @@ -897,24 +896,18 @@ def test_tracks_tool_input_type_alias_is_up_to_date() -> None: from anthropic.types.beta.beta_content_block import BetaContentBlock - # Get the content block union type content_block_union = get_args(BetaContentBlock)[0] - # Get all types from BetaContentBlock union content_block_types = get_args(content_block_union) - # Types that should have an input property types_with_input: Set[Any] = set() - # Check each type to see if it has an input property in its model_fields for block_type in content_block_types: if issubclass(block_type, BaseModel) and "input" in block_type.model_fields: types_with_input.add(block_type) - # Get the types included in TRACKS_TOOL_INPUT tracked_types = TRACKS_TOOL_INPUT - # Make sure all types with input are tracked for block_type in types_with_input: assert block_type in tracked_types, ( f"ContentBlock type {block_type.__name__} has an input property, " diff --git a/tests/lib/streaming/test_messages.py b/tests/lib/streaming/test_messages.py index 7d4783a8b..ce425c35f 100644 --- a/tests/lib/streaming/test_messages.py +++ b/tests/lib/streaming/test_messages.py @@ -629,24 +629,18 @@ def test_tracks_tool_input_type_alias_is_up_to_date() -> None: from anthropic.types.content_block import ContentBlock - # Get the content block union type content_block_union = get_args(ContentBlock)[0] - # Get all types from ContentBlock union content_block_types = get_args(content_block_union) - # Types that should have an input property types_with_input: Set[Any] = set() - # Check each type to see if it has an input property in its model_fields for block_type in content_block_types: if issubclass(block_type, BaseModel) and "input" in block_type.model_fields: types_with_input.add(block_type) - # Get the types included in TRACKS_TOOL_INPUT tracked_types = TRACKS_TOOL_INPUT - # Make sure all types with input are tracked for block_type in types_with_input: assert block_type in tracked_types, ( f"ContentBlock type {block_type.__name__} has an input property, " diff --git a/tests/lib/streaming/test_partial_json.py b/tests/lib/streaming/test_partial_json.py index 7415792b8..c1daf7eab 100644 --- a/tests/lib/streaming/test_partial_json.py +++ b/tests/lib/streaming/test_partial_json.py @@ -52,7 +52,6 @@ def test_trailing_strings_mode_header(self) -> None: request_headers=httpx2.Headers({"anthropic-beta": "fine-grained-tool-streaming-2025-05-14"}), ) - # Both should parse complete JSON correctly assert cast(ToolUseBlock, message1.content[0]).input == {"key": "value"} assert cast(ToolUseBlock, message2.content[0]).input == {"key": "value"} @@ -79,7 +78,6 @@ def test_trailing_strings_mode_header(self) -> None: request_headers=httpx2.Headers({"anthropic-beta": "fine-grained-tool-streaming-2025-05-14"}), ) - # Get the tool use blocks standard_tool = cast(ToolUseBlock, message_standard.content[0]) trailing_tool = cast(ToolUseBlock, message_trailing.content[0]) @@ -90,7 +88,6 @@ def test_trailing_strings_mode_header(self) -> None: standard_input = standard_tool.input # type: ignore trailing_input = trailing_tool.input # type: ignore - # The input should have the items array in both cases items_standard = cast(List[str], standard_input["items"]) items_trailing = cast(List[str], trailing_input["items"]) assert items_standard == ["item1", "item2"] @@ -104,7 +101,6 @@ def test_trailing_strings_mode_header(self) -> None: assert "unfinished_field" in trailing_input assert trailing_input["unfinished_field"] == "incomplete value" - # test that with invalid JSON we throw the correct error def test_partial_json_with_invalid_json(self) -> None: """Test that invalid JSON raises an error.""" message = ParsedBetaMessage( @@ -126,14 +122,12 @@ def test_partial_json_with_invalid_json(self) -> None: usage=BetaUsage(input_tokens=10, output_tokens=10), ) - # Invalid JSON input invalid_json = '{"key": "value", "incomplete_field": bad_value' event_invalid = BetaRawContentBlockDeltaEvent( type="content_block_delta", index=0, delta=BetaInputJSONDelta(type="input_json_delta", partial_json=invalid_json), ) - # Expect an error when trying to accumulate the invalid JSON try: accumulate_event( event=event_invalid, diff --git a/tests/lib/tools/test_functions.py b/tests/lib/tools/test_functions.py index 0b06aa026..f7b1873be 100644 --- a/tests/lib/tools/test_functions.py +++ b/tests/lib/tools/test_functions.py @@ -52,11 +52,9 @@ def simple_function( function_tool = beta_tool(simple_function) - # Test that we can create the tool and call it assert function_tool.name == "simple_function" assert function_tool.description == "A simple function with basic parameter types." - # Test calling the function result = function_tool.call( { "name": "John", @@ -65,7 +63,6 @@ def simple_function( ) assert result == "Person: John, 25 years old" - # Test schema structure expected_schema = { "additionalProperties": False, "type": "object", From 6673bdb87b4ee627ca6e5609a4f2371cb05dbcd8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 14:38:08 +0000 Subject: [PATCH 02/10] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0b01440ef..a31d63e5a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 201 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-e50cf35b74cc0471a2b5af7ea03765aa81c035f82588e9a1ba1b29aeaa17d064.yml -openapi_spec_hash: e4ae88bdd84c7e293dd46037a6769b8d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-9a79dfd9ca3d3374e075db9851540579773cc4f56d01d9a8d237a7248c844eaa.yml +openapi_spec_hash: a7973f70d74d2571b46cb142e5eaa428 config_hash: e7cae7a85b1d1ebf25c2bfdff6b8fc4c From d1d2c01d8aa128080dea3d711e12cb3df95a2149 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 16:00:30 +0000 Subject: [PATCH 03/10] feat(api): add support for sending a workspace ID on more endpoints --- .stats.yml | 6 +- src/anthropic/resources/beta/agents/agents.py | 40 +++++-- .../resources/beta/agents/versions.py | 8 +- .../resources/beta/deployment_runs.py | 16 ++- src/anthropic/resources/beta/deployments.py | 64 +++++++--- src/anthropic/resources/beta/dreams.py | 40 +++++-- .../beta/environments/environments.py | 48 ++++++-- .../resources/beta/environments/work.py | 32 +++-- src/anthropic/resources/beta/files.py | 80 +++++++++++-- .../resources/beta/memory_stores/memories.py | 40 +++++-- .../beta/memory_stores/memory_stores.py | 48 ++++++-- .../beta/memory_stores/memory_versions.py | 24 +++- .../resources/beta/messages/batches.py | 44 +++++-- .../resources/beta/messages/messages.py | 14 +++ src/anthropic/resources/beta/models.py | 32 ++++- .../resources/beta/sessions/events.py | 24 +++- .../resources/beta/sessions/resources.py | 40 +++++-- .../resources/beta/sessions/sessions.py | 48 ++++++-- .../resources/beta/sessions/threads/events.py | 16 ++- .../beta/sessions/threads/threads.py | 24 +++- src/anthropic/resources/beta/skills/skills.py | 64 ++++++++-- .../resources/beta/skills/versions.py | 80 +++++++++++-- .../resources/beta/tunnels/certificates.py | 32 +++-- .../resources/beta/tunnels/tunnels.py | 48 ++++++-- .../resources/beta/vaults/credentials.py | 56 ++++++--- src/anthropic/resources/beta/vaults/vaults.py | 48 ++++++-- src/anthropic/resources/files.py | 24 +++- src/anthropic/resources/messages/batches.py | 46 ++++++- src/anthropic/resources/messages/messages.py | 62 +++++++++- src/anthropic/resources/models.py | 32 ++++- src/anthropic/resources/skills/skills.py | 18 ++- src/anthropic/resources/skills/versions.py | 18 ++- .../types/beta/agent_create_params.py | 2 + src/anthropic/types/beta/agent_list_params.py | 2 + .../types/beta/agent_retrieve_params.py | 2 + .../types/beta/agent_update_params.py | 2 + .../types/beta/agents/version_list_params.py | 2 + .../types/beta/deployment_create_params.py | 2 + .../types/beta/deployment_list_params.py | 2 + .../types/beta/deployment_run_list_params.py | 2 + .../types/beta/deployment_update_params.py | 2 + .../types/beta/dream_create_params.py | 2 + src/anthropic/types/beta/dream_list_params.py | 2 + .../types/beta/environment_create_params.py | 2 + .../types/beta/environment_list_params.py | 2 + .../types/beta/environment_update_params.py | 2 + .../beta/environments/work_stop_params.py | 2 + .../beta/environments/work_update_params.py | 2 + src/anthropic/types/beta/file_list_params.py | 2 + .../types/beta/file_upload_params.py | 2 + .../types/beta/memory_store_create_params.py | 2 + .../types/beta/memory_store_list_params.py | 2 + .../types/beta/memory_store_update_params.py | 2 + .../memory_stores/memory_create_params.py | 2 + .../memory_stores/memory_delete_params.py | 2 + .../beta/memory_stores/memory_list_params.py | 2 + .../memory_stores/memory_retrieve_params.py | 2 + .../memory_stores/memory_update_params.py | 2 + .../memory_version_list_params.py | 2 + .../memory_version_retrieve_params.py | 2 + .../types/beta/message_count_tokens_params.py | 2 + .../types/beta/message_create_params.py | 2 + .../beta/messages/batch_create_params.py | 2 + .../types/beta/messages/batch_list_params.py | 2 + src/anthropic/types/beta/model_list_params.py | 2 + .../types/beta/session_create_params.py | 2 + .../types/beta/session_list_params.py | 2 + .../types/beta/session_update_params.py | 2 + .../types/beta/sessions/event_list_params.py | 2 + .../types/beta/sessions/event_send_params.py | 2 + .../beta/sessions/event_stream_params.py | 2 + .../beta/sessions/resource_add_params.py | 2 + .../beta/sessions/resource_list_params.py | 2 + .../beta/sessions/resource_update_params.py | 2 + .../types/beta/sessions/thread_list_params.py | 2 + .../sessions/threads/event_list_params.py | 2 + .../sessions/threads/event_stream_params.py | 2 + .../types/beta/skill_create_params.py | 2 + src/anthropic/types/beta/skill_list_params.py | 2 + .../beta/skills/version_create_params.py | 2 + .../types/beta/skills/version_list_params.py | 2 + .../types/beta/tunnel_create_params.py | 2 + .../types/beta/tunnel_list_params.py | 2 + .../types/beta/tunnel_rotate_token_params.py | 2 + .../beta/tunnels/certificate_create_params.py | 2 + .../beta/tunnels/certificate_list_params.py | 2 + .../types/beta/vault_create_params.py | 2 + src/anthropic/types/beta/vault_list_params.py | 2 + .../types/beta/vault_update_params.py | 2 + .../beta/vaults/credential_create_params.py | 2 + .../beta/vaults/credential_list_params.py | 2 + .../beta/vaults/credential_update_params.py | 2 + src/anthropic/types/file_list_params.py | 2 + src/anthropic/types/file_upload_params.py | 2 + .../types/message_count_tokens_params.py | 2 + src/anthropic/types/message_create_params.py | 2 + .../types/messages/batch_create_params.py | 2 + .../types/messages/batch_list_params.py | 2 + src/anthropic/types/model_list_params.py | 2 + src/anthropic/types/skill_create_params.py | 2 + src/anthropic/types/skill_list_params.py | 2 + .../types/skills/version_create_params.py | 2 + .../types/skills/version_list_params.py | 2 + .../beta/agents/test_versions.py | 6 +- .../beta/environments/test_work.py | 8 ++ .../beta/memory_stores/test_memories.py | 10 ++ .../memory_stores/test_memory_versions.py | 6 + .../beta/messages/test_batches.py | 2 + .../beta/sessions/test_events.py | 18 ++- .../beta/sessions/test_resources.py | 30 +++-- .../beta/sessions/test_threads.py | 6 + .../beta/sessions/threads/test_events.py | 4 + .../beta/skills/test_versions.py | 26 ++-- tests/api_resources/beta/test_agents.py | 10 ++ .../beta/test_deployment_runs.py | 4 + tests/api_resources/beta/test_deployments.py | 16 +++ tests/api_resources/beta/test_dreams.py | 10 ++ tests/api_resources/beta/test_environments.py | 36 ++++-- tests/api_resources/beta/test_files.py | 30 +++-- .../api_resources/beta/test_memory_stores.py | 12 ++ tests/api_resources/beta/test_messages.py | 6 + tests/api_resources/beta/test_models.py | 12 +- tests/api_resources/beta/test_sessions.py | 36 ++++-- tests/api_resources/beta/test_skills.py | 24 ++-- tests/api_resources/beta/test_tunnels.py | 12 ++ tests/api_resources/beta/test_vaults.py | 36 ++++-- .../beta/tunnels/test_certificates.py | 8 ++ .../beta/vaults/test_credentials.py | 38 ++++-- tests/api_resources/messages/test_batches.py | 112 +++++++++++++----- tests/api_resources/skills/test_versions.py | 56 +++++++++ tests/api_resources/test_files.py | 110 +++++++++++++---- tests/api_resources/test_messages.py | 6 + tests/api_resources/test_models.py | 12 +- tests/api_resources/test_skills.py | 68 ++++++++--- 134 files changed, 1722 insertions(+), 406 deletions(-) diff --git a/.stats.yml b/.stats.yml index a31d63e5a..6f37ca6c4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 201 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-9a79dfd9ca3d3374e075db9851540579773cc4f56d01d9a8d237a7248c844eaa.yml -openapi_spec_hash: a7973f70d74d2571b46cb142e5eaa428 -config_hash: e7cae7a85b1d1ebf25c2bfdff6b8fc4c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-912199b1ed1eb56d611881c5323eb554b56187aa46d6da7f2a3cb51d12b193fd.yml +openapi_spec_hash: 3914347dffe1c12ce191cfa2ed26738e +config_hash: f76dc225c5c58c929490ef8dd6e50111 diff --git a/src/anthropic/resources/beta/agents/agents.py b/src/anthropic/resources/beta/agents/agents.py index b80f7e08d..d3a3b2e09 100644 --- a/src/anthropic/resources/beta/agents/agents.py +++ b/src/anthropic/resources/beta/agents/agents.py @@ -81,6 +81,7 @@ def create( system: Optional[str] | Omit = omit, tools: Iterable[agent_create_params.Tool] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -135,7 +136,8 @@ def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -169,6 +171,7 @@ def retrieve( *, version: int | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -201,7 +204,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -234,6 +238,7 @@ def update( tools: Optional[Iterable[agent_update_params.Tool]] | Omit = omit, version: int | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -298,7 +303,8 @@ def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -336,6 +342,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -372,7 +379,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -405,6 +413,7 @@ def archive( agent_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -433,7 +442,8 @@ def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -485,6 +495,7 @@ async def create( system: Optional[str] | Omit = omit, tools: Iterable[agent_create_params.Tool] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -539,7 +550,8 @@ async def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -573,6 +585,7 @@ async def retrieve( *, version: int | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -605,7 +618,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -638,6 +652,7 @@ async def update( tools: Optional[Iterable[agent_update_params.Tool]] | Omit = omit, version: int | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -702,7 +717,8 @@ async def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -740,6 +756,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -776,7 +793,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -809,6 +827,7 @@ async def archive( agent_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -837,7 +856,8 @@ async def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/agents/versions.py b/src/anthropic/resources/beta/agents/versions.py index 835b0f91a..f83df745b 100644 --- a/src/anthropic/resources/beta/agents/versions.py +++ b/src/anthropic/resources/beta/agents/versions.py @@ -53,6 +53,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -86,7 +87,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -139,6 +141,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -172,7 +175,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/deployment_runs.py b/src/anthropic/resources/beta/deployment_runs.py index 5ae3554dd..565280cc9 100644 --- a/src/anthropic/resources/beta/deployment_runs.py +++ b/src/anthropic/resources/beta/deployment_runs.py @@ -53,6 +53,7 @@ def retrieve( deployment_run_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -81,7 +82,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -108,6 +110,7 @@ def list( page: str | Omit = omit, trigger_type: BetaManagedAgentsTriggerType | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -156,7 +159,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -214,6 +218,7 @@ async def retrieve( deployment_run_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -242,7 +247,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -269,6 +275,7 @@ def list( page: str | Omit = omit, trigger_type: BetaManagedAgentsTriggerType | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -317,7 +324,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/deployments.py b/src/anthropic/resources/beta/deployments.py index 0956b4388..dcc8dfc8b 100644 --- a/src/anthropic/resources/beta/deployments.py +++ b/src/anthropic/resources/beta/deployments.py @@ -74,6 +74,7 @@ def create( schedule: Optional[BetaManagedAgentsScheduleParams] | Omit = omit, vault_ids: SequenceNotStr[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -130,7 +131,8 @@ def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -164,6 +166,7 @@ def retrieve( deployment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -192,7 +195,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -221,6 +225,7 @@ def update( schedule: Optional[BetaManagedAgentsScheduleParams] | Omit = omit, vault_ids: Optional[SequenceNotStr[str]] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -279,7 +284,8 @@ def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -319,6 +325,7 @@ def list( page: str | Omit = omit, status: BetaManagedAgentsDeploymentStatus | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -360,7 +367,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -395,6 +403,7 @@ def archive( deployment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -423,7 +432,8 @@ def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -442,6 +452,7 @@ def pause( deployment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -470,7 +481,8 @@ def pause( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -489,6 +501,7 @@ def run( deployment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -517,7 +530,8 @@ def run( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -536,6 +550,7 @@ def unpause( deployment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -564,7 +579,8 @@ def unpause( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -613,6 +629,7 @@ async def create( schedule: Optional[BetaManagedAgentsScheduleParams] | Omit = omit, vault_ids: SequenceNotStr[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -669,7 +686,8 @@ async def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -703,6 +721,7 @@ async def retrieve( deployment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -731,7 +750,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -760,6 +780,7 @@ async def update( schedule: Optional[BetaManagedAgentsScheduleParams] | Omit = omit, vault_ids: Optional[SequenceNotStr[str]] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -818,7 +839,8 @@ async def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -858,6 +880,7 @@ def list( page: str | Omit = omit, status: BetaManagedAgentsDeploymentStatus | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -899,7 +922,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -934,6 +958,7 @@ async def archive( deployment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -962,7 +987,8 @@ async def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -981,6 +1007,7 @@ async def pause( deployment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1009,7 +1036,8 @@ async def pause( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -1028,6 +1056,7 @@ async def run( deployment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1056,7 +1085,8 @@ async def run( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -1075,6 +1105,7 @@ async def unpause( deployment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1103,7 +1134,8 @@ async def unpause( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/dreams.py b/src/anthropic/resources/beta/dreams.py index cccf14f08..06ce22621 100644 --- a/src/anthropic/resources/beta/dreams.py +++ b/src/anthropic/resources/beta/dreams.py @@ -58,6 +58,7 @@ def create( instructions: Optional[str] | Omit = omit, output_behavior: BetaOutputBehaviorParam | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -90,7 +91,8 @@ def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["dreaming-2026-04-21"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -118,6 +120,7 @@ def retrieve( dream_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -146,7 +149,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["dreaming-2026-04-21"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -170,6 +174,7 @@ def list( page: str | Omit = omit, statuses: List[BetaDreamStatus] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -211,7 +216,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["dreaming-2026-04-21"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -245,6 +251,7 @@ def archive( dream_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -273,7 +280,8 @@ def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["dreaming-2026-04-21"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -292,6 +300,7 @@ def cancel( dream_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -320,7 +329,8 @@ def cancel( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["dreaming-2026-04-21"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -363,6 +373,7 @@ async def create( instructions: Optional[str] | Omit = omit, output_behavior: BetaOutputBehaviorParam | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -395,7 +406,8 @@ async def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["dreaming-2026-04-21"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -423,6 +435,7 @@ async def retrieve( dream_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -451,7 +464,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["dreaming-2026-04-21"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -475,6 +489,7 @@ def list( page: str | Omit = omit, statuses: List[BetaDreamStatus] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -516,7 +531,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["dreaming-2026-04-21"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -550,6 +566,7 @@ async def archive( dream_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -578,7 +595,8 @@ async def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["dreaming-2026-04-21"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -597,6 +615,7 @@ async def cancel( dream_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -625,7 +644,8 @@ async def cancel( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["dreaming-2026-04-21"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/environments/environments.py b/src/anthropic/resources/beta/environments/environments.py index b6b03fc69..3c025670e 100644 --- a/src/anthropic/resources/beta/environments/environments.py +++ b/src/anthropic/resources/beta/environments/environments.py @@ -69,6 +69,7 @@ def create( metadata: Dict[str, str] | Omit = omit, scope: Optional[Literal["organization", "account"]] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -108,7 +109,8 @@ def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -137,6 +139,7 @@ def retrieve( environment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -165,7 +168,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -189,6 +193,7 @@ def update( name: Optional[str] | Omit = omit, scope: Optional[Literal["organization", "account"]] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -231,7 +236,8 @@ def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -262,6 +268,7 @@ def list( limit: int | Omit = omit, page: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -295,7 +302,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -326,6 +334,7 @@ def delete( environment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -355,7 +364,8 @@ def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -374,6 +384,7 @@ def archive( environment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -404,7 +415,8 @@ def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -452,6 +464,7 @@ async def create( metadata: Dict[str, str] | Omit = omit, scope: Optional[Literal["organization", "account"]] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -491,7 +504,8 @@ async def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -520,6 +534,7 @@ async def retrieve( environment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -548,7 +563,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -572,6 +588,7 @@ async def update( name: Optional[str] | Omit = omit, scope: Optional[Literal["organization", "account"]] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -614,7 +631,8 @@ async def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -645,6 +663,7 @@ def list( limit: int | Omit = omit, page: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -678,7 +697,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -709,6 +729,7 @@ async def delete( environment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -738,7 +759,8 @@ async def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -757,6 +779,7 @@ async def archive( environment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -787,7 +810,8 @@ async def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/environments/work.py b/src/anthropic/resources/beta/environments/work.py index 2d2d63019..d725555e3 100644 --- a/src/anthropic/resources/beta/environments/work.py +++ b/src/anthropic/resources/beta/environments/work.py @@ -70,6 +70,7 @@ def retrieve( *, environment_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -105,7 +106,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -130,6 +132,7 @@ def update( environment_id: str, metadata: Dict[str, Optional[str]], betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -168,7 +171,8 @@ def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -475,6 +479,7 @@ def stats( environment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -503,7 +508,8 @@ def stats( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -524,6 +530,7 @@ def stop( environment_id: str, force: bool | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -561,7 +568,8 @@ def stop( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -607,6 +615,7 @@ async def retrieve( *, environment_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -642,7 +651,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -667,6 +677,7 @@ async def update( environment_id: str, metadata: Dict[str, Optional[str]], betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -705,7 +716,8 @@ async def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -1012,6 +1024,7 @@ async def stats( environment_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1040,7 +1053,8 @@ async def stats( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -1061,6 +1075,7 @@ async def stop( environment_id: str, force: bool | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1098,7 +1113,8 @@ async def stop( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/files.py b/src/anthropic/resources/beta/files.py index c3ee31087..d69c4bb55 100644 --- a/src/anthropic/resources/beta/files.py +++ b/src/anthropic/resources/beta/files.py @@ -78,6 +78,7 @@ def list( page: Optional[str] | Omit = omit, scope_id: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -116,7 +117,12 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get_api_list( @@ -145,6 +151,7 @@ def delete( file_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -171,7 +178,12 @@ def delete( if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._delete( @@ -187,6 +199,7 @@ def download( file_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -214,7 +227,12 @@ def download( raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") extra_headers = {"Accept": "application/binary", **(extra_headers or {})} extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get( @@ -230,6 +248,7 @@ def retrieve_metadata( file_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -256,7 +275,12 @@ def retrieve_metadata( if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get( @@ -273,6 +297,7 @@ def upload( file: FileTypes, expires_in_seconds: int | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -300,7 +325,12 @@ def upload( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } extra_headers = merge_headers(_stainless_helper_header_from_file(file), extra_headers) @@ -355,6 +385,7 @@ def list( page: Optional[str] | Omit = omit, scope_id: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -393,7 +424,12 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get_api_list( @@ -422,6 +458,7 @@ async def delete( file_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -448,7 +485,12 @@ async def delete( if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return await self._delete( @@ -464,6 +506,7 @@ async def download( file_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -491,7 +534,12 @@ async def download( raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") extra_headers = {"Accept": "application/binary", **(extra_headers or {})} extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return await self._get( @@ -507,6 +555,7 @@ async def retrieve_metadata( file_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -533,7 +582,12 @@ async def retrieve_metadata( if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return await self._get( @@ -550,6 +604,7 @@ async def upload( file: FileTypes, expires_in_seconds: int | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -577,7 +632,12 @@ async def upload( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } extra_headers = merge_headers(_stainless_helper_header_from_file(file), extra_headers) diff --git a/src/anthropic/resources/beta/memory_stores/memories.py b/src/anthropic/resources/beta/memory_stores/memories.py index ad22ab9ca..fa73fbf9a 100644 --- a/src/anthropic/resources/beta/memory_stores/memories.py +++ b/src/anthropic/resources/beta/memory_stores/memories.py @@ -65,6 +65,7 @@ def create( path: str, view: BetaManagedAgentsMemoryView | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -105,7 +106,8 @@ def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -137,6 +139,7 @@ def retrieve( memory_store_id: str, view: BetaManagedAgentsMemoryView | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -169,7 +172,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -201,6 +205,7 @@ def update( path: Optional[str] | Omit = omit, precondition: BetaManagedAgentsPreconditionParam | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -250,7 +255,8 @@ def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -290,6 +296,7 @@ def list( path_prefix: str | Omit = omit, view: BetaManagedAgentsMemoryView | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -337,7 +344,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -374,6 +382,7 @@ def delete( memory_store_id: str, expected_content_sha256: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -406,7 +415,8 @@ def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -459,6 +469,7 @@ async def create( path: str, view: BetaManagedAgentsMemoryView | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -499,7 +510,8 @@ async def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -531,6 +543,7 @@ async def retrieve( memory_store_id: str, view: BetaManagedAgentsMemoryView | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -563,7 +576,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -595,6 +609,7 @@ async def update( path: Optional[str] | Omit = omit, precondition: BetaManagedAgentsPreconditionParam | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -644,7 +659,8 @@ async def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -684,6 +700,7 @@ def list( path_prefix: str | Omit = omit, view: BetaManagedAgentsMemoryView | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -731,7 +748,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -768,6 +786,7 @@ async def delete( memory_store_id: str, expected_content_sha256: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -800,7 +819,8 @@ async def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/memory_stores/memory_stores.py b/src/anthropic/resources/beta/memory_stores/memory_stores.py index cfa05c4af..39e5ee8cb 100644 --- a/src/anthropic/resources/beta/memory_stores/memory_stores.py +++ b/src/anthropic/resources/beta/memory_stores/memory_stores.py @@ -79,6 +79,7 @@ def create( description: str | Omit = omit, metadata: Dict[str, str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -119,7 +120,8 @@ def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -146,6 +148,7 @@ def retrieve( memory_store_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -174,7 +177,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -196,6 +200,7 @@ def update( metadata: Optional[Dict[str, Optional[str]]] | Omit = omit, name: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -235,7 +240,8 @@ def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -266,6 +272,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -307,7 +314,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -340,6 +348,7 @@ def delete( memory_store_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -368,7 +377,8 @@ def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -387,6 +397,7 @@ def archive( memory_store_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -415,7 +426,8 @@ def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -465,6 +477,7 @@ async def create( description: str | Omit = omit, metadata: Dict[str, str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -505,7 +518,8 @@ async def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -532,6 +546,7 @@ async def retrieve( memory_store_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -560,7 +575,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -582,6 +598,7 @@ async def update( metadata: Optional[Dict[str, Optional[str]]] | Omit = omit, name: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -621,7 +638,8 @@ async def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -652,6 +670,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -693,7 +712,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -726,6 +746,7 @@ async def delete( memory_store_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -754,7 +775,8 @@ async def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -773,6 +795,7 @@ async def archive( memory_store_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -801,7 +824,8 @@ async def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/memory_stores/memory_versions.py b/src/anthropic/resources/beta/memory_stores/memory_versions.py index 7626d4936..4446c9f88 100644 --- a/src/anthropic/resources/beta/memory_stores/memory_versions.py +++ b/src/anthropic/resources/beta/memory_stores/memory_versions.py @@ -63,6 +63,7 @@ def retrieve( memory_store_id: str, view: BetaManagedAgentsMemoryView | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -95,7 +96,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -132,6 +134,7 @@ def list( session_id: str | Omit = omit, view: BetaManagedAgentsMemoryView | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -180,7 +183,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -221,6 +225,7 @@ def redact( *, memory_store_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -251,7 +256,8 @@ def redact( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -297,6 +303,7 @@ async def retrieve( memory_store_id: str, view: BetaManagedAgentsMemoryView | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -329,7 +336,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -368,6 +376,7 @@ def list( session_id: str | Omit = omit, view: BetaManagedAgentsMemoryView | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -416,7 +425,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -457,6 +467,7 @@ async def redact( *, memory_store_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -487,7 +498,8 @@ async def redact( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["agent-memory-2026-07-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/messages/batches.py b/src/anthropic/resources/beta/messages/batches.py index d69147bfd..fe1b466b0 100644 --- a/src/anthropic/resources/beta/messages/batches.py +++ b/src/anthropic/resources/beta/messages/batches.py @@ -56,6 +56,7 @@ def create( requests: Iterable[batch_create_params.Request], betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -99,6 +100,7 @@ def create( if is_given(betas) else not_given, "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -118,6 +120,7 @@ def retrieve( message_batch_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -154,7 +157,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -175,6 +179,7 @@ def list( before_id: str | Omit = omit, limit: int | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -216,7 +221,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -247,6 +253,7 @@ def delete( message_batch_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -283,7 +290,8 @@ def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -302,6 +310,7 @@ def cancel( message_batch_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -344,7 +353,8 @@ def cancel( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -365,6 +375,7 @@ def results( message_batch_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -410,7 +421,8 @@ def results( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -452,6 +464,7 @@ async def create( requests: Iterable[batch_create_params.Request], betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -495,6 +508,7 @@ async def create( if is_given(betas) else not_given, "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -514,6 +528,7 @@ async def retrieve( message_batch_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -550,7 +565,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -571,6 +587,7 @@ def list( before_id: str | Omit = omit, limit: int | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -612,7 +629,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -643,6 +661,7 @@ async def delete( message_batch_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -679,7 +698,8 @@ async def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -698,6 +718,7 @@ async def cancel( message_batch_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -740,7 +761,8 @@ async def cancel( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -761,6 +783,7 @@ async def results( message_batch_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -806,7 +829,8 @@ async def results( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/messages/messages.py b/src/anthropic/resources/beta/messages/messages.py index 8237f47eb..b7a09c647 100644 --- a/src/anthropic/resources/beta/messages/messages.py +++ b/src/anthropic/resources/beta/messages/messages.py @@ -146,6 +146,7 @@ def create( tools: Iterable[BetaToolUnionParam] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -461,6 +462,7 @@ def create( tools: Iterable[BetaToolUnionParam] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -776,6 +778,7 @@ def create( tools: Iterable[BetaToolUnionParam] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1091,6 +1094,7 @@ def create( tools: Iterable[BetaToolUnionParam] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1122,6 +1126,7 @@ def create( { "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, } ), _stainless_helper_header(tools, messages), @@ -1700,6 +1705,7 @@ def count_tokens( tools: Iterable[message_count_tokens_params.Tool] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1922,6 +1928,7 @@ def count_tokens( if is_given(betas) else not_given, "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -2003,6 +2010,7 @@ async def create( tools: Iterable[BetaToolUnionParam] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2318,6 +2326,7 @@ async def create( tools: Iterable[BetaToolUnionParam] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2633,6 +2642,7 @@ async def create( tools: Iterable[BetaToolUnionParam] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2948,6 +2958,7 @@ async def create( tools: Iterable[BetaToolUnionParam] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2979,6 +2990,7 @@ async def create( { "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, } ), _stainless_helper_header(tools, messages), @@ -3547,6 +3559,7 @@ async def count_tokens( tools: Iterable[message_count_tokens_params.Tool] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -3769,6 +3782,7 @@ async def count_tokens( if is_given(betas) else not_given, "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/models.py b/src/anthropic/resources/beta/models.py index 6f438e17c..87a13a3f8 100644 --- a/src/anthropic/resources/beta/models.py +++ b/src/anthropic/resources/beta/models.py @@ -50,6 +50,7 @@ def retrieve( model_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -79,7 +80,12 @@ def retrieve( if not model_id: raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get( @@ -97,6 +103,7 @@ def list( before_id: str | Omit = omit, limit: int | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -132,7 +139,12 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get_api_list( @@ -181,6 +193,7 @@ async def retrieve( model_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -210,7 +223,12 @@ async def retrieve( if not model_id: raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return await self._get( @@ -228,6 +246,7 @@ def list( before_id: str | Omit = omit, limit: int | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -263,7 +282,12 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get_api_list( diff --git a/src/anthropic/resources/beta/sessions/events.py b/src/anthropic/resources/beta/sessions/events.py index 21e404246..cb10e6592 100644 --- a/src/anthropic/resources/beta/sessions/events.py +++ b/src/anthropic/resources/beta/sessions/events.py @@ -72,6 +72,7 @@ def list( page: str | Omit = omit, types: SequenceNotStr[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -122,7 +123,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -161,6 +163,7 @@ def send( *, events: Iterable[BetaManagedAgentsEventParams], betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -191,7 +194,8 @@ def send( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -212,6 +216,7 @@ def stream( *, event_deltas: List[BetaManagedAgentsDeltaType] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -251,7 +256,8 @@ def stream( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -307,6 +313,7 @@ def list( page: str | Omit = omit, types: SequenceNotStr[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -357,7 +364,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -396,6 +404,7 @@ async def send( *, events: Iterable[BetaManagedAgentsEventParams], betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -426,7 +435,8 @@ async def send( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -447,6 +457,7 @@ async def stream( *, event_deltas: List[BetaManagedAgentsDeltaType] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -486,7 +497,8 @@ async def stream( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/sessions/resources.py b/src/anthropic/resources/beta/sessions/resources.py index 961b13920..a374ffeed 100644 --- a/src/anthropic/resources/beta/sessions/resources.py +++ b/src/anthropic/resources/beta/sessions/resources.py @@ -57,6 +57,7 @@ def retrieve( *, session_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -87,7 +88,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -117,6 +119,7 @@ def update( session_id: str, authorization_token: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -150,7 +153,8 @@ def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -183,6 +187,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -216,7 +221,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -249,6 +255,7 @@ def delete( *, session_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -279,7 +286,8 @@ def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -305,6 +313,7 @@ def add( type: Literal["file"], mount_path: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -337,7 +346,8 @@ def add( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -386,6 +396,7 @@ async def retrieve( *, session_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -416,7 +427,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -446,6 +458,7 @@ async def update( session_id: str, authorization_token: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -479,7 +492,8 @@ async def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -512,6 +526,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -545,7 +560,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -578,6 +594,7 @@ async def delete( *, session_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -608,7 +625,8 @@ async def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -634,6 +652,7 @@ async def add( type: Literal["file"], mount_path: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -666,7 +685,8 @@ async def add( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/sessions/sessions.py b/src/anthropic/resources/beta/sessions/sessions.py index 8f8db5963..3305cd0fe 100644 --- a/src/anthropic/resources/beta/sessions/sessions.py +++ b/src/anthropic/resources/beta/sessions/sessions.py @@ -103,6 +103,7 @@ def create( title: Optional[str] | Omit = omit, vault_ids: SequenceNotStr[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -150,7 +151,8 @@ def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -182,6 +184,7 @@ def retrieve( session_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -210,7 +213,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -234,6 +238,7 @@ def update( title: Optional[str] | Omit = omit, vault_ids: SequenceNotStr[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -278,7 +283,8 @@ def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -319,6 +325,7 @@ def list( page: str | Omit = omit, statuses: List[Literal["rescheduling", "running", "idle", "terminated"]] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -374,7 +381,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -415,6 +423,7 @@ def delete( session_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -443,7 +452,8 @@ def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -462,6 +472,7 @@ def archive( session_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -490,7 +501,8 @@ def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -549,6 +561,7 @@ async def create( title: Optional[str] | Omit = omit, vault_ids: SequenceNotStr[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -596,7 +609,8 @@ async def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -628,6 +642,7 @@ async def retrieve( session_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -656,7 +671,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -680,6 +696,7 @@ async def update( title: Optional[str] | Omit = omit, vault_ids: SequenceNotStr[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -724,7 +741,8 @@ async def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -765,6 +783,7 @@ def list( page: str | Omit = omit, statuses: List[Literal["rescheduling", "running", "idle", "terminated"]] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -820,7 +839,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -861,6 +881,7 @@ async def delete( session_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -889,7 +910,8 @@ async def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -908,6 +930,7 @@ async def archive( session_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -936,7 +959,8 @@ async def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/sessions/threads/events.py b/src/anthropic/resources/beta/sessions/threads/events.py index 80715010c..8fd967426 100644 --- a/src/anthropic/resources/beta/sessions/threads/events.py +++ b/src/anthropic/resources/beta/sessions/threads/events.py @@ -59,6 +59,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -93,7 +94,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -131,6 +133,7 @@ def stream( session_id: str, event_deltas: List[BetaManagedAgentsDeltaType] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -172,7 +175,8 @@ def stream( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -227,6 +231,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -261,7 +266,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -299,6 +305,7 @@ async def stream( session_id: str, event_deltas: List[BetaManagedAgentsDeltaType] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -340,7 +347,8 @@ async def stream( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/sessions/threads/threads.py b/src/anthropic/resources/beta/sessions/threads/threads.py index 568573b8d..fb787eed4 100644 --- a/src/anthropic/resources/beta/sessions/threads/threads.py +++ b/src/anthropic/resources/beta/sessions/threads/threads.py @@ -64,6 +64,7 @@ def retrieve( *, session_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -94,7 +95,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -117,6 +119,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -150,7 +153,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -181,6 +185,7 @@ def archive( *, session_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -211,7 +216,8 @@ def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -260,6 +266,7 @@ async def retrieve( *, session_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -290,7 +297,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -313,6 +321,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -346,7 +355,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -377,6 +387,7 @@ async def archive( *, session_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -407,7 +418,8 @@ async def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/skills/skills.py b/src/anthropic/resources/beta/skills/skills.py index 29040f0a4..2dde6b78a 100644 --- a/src/anthropic/resources/beta/skills/skills.py +++ b/src/anthropic/resources/beta/skills/skills.py @@ -75,6 +75,7 @@ def create( files: SequenceNotStr[FileTypes], display_name: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -106,7 +107,12 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } body = deepcopy_with_paths( @@ -136,6 +142,7 @@ def retrieve( skill_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -164,7 +171,12 @@ def retrieve( if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get( @@ -182,6 +194,7 @@ def list( page: Optional[str] | Omit = omit, source: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -220,7 +233,12 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get_api_list( @@ -248,6 +266,7 @@ def delete( skill_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -276,7 +295,12 @@ def delete( if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._delete( @@ -318,6 +342,7 @@ async def create( files: SequenceNotStr[FileTypes], display_name: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -349,7 +374,12 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } body = deepcopy_with_paths( @@ -379,6 +409,7 @@ async def retrieve( skill_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -407,7 +438,12 @@ async def retrieve( if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return await self._get( @@ -425,6 +461,7 @@ def list( page: Optional[str] | Omit = omit, source: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -463,7 +500,12 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get_api_list( @@ -491,6 +533,7 @@ async def delete( skill_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -519,7 +562,12 @@ async def delete( if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return await self._delete( diff --git a/src/anthropic/resources/beta/skills/versions.py b/src/anthropic/resources/beta/skills/versions.py index f23f948d9..097135efa 100644 --- a/src/anthropic/resources/beta/skills/versions.py +++ b/src/anthropic/resources/beta/skills/versions.py @@ -71,6 +71,7 @@ def create( *, files: SequenceNotStr[FileTypes], betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -104,7 +105,12 @@ def create( if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } body = deepcopy_with_paths({"files": files}, [["files", ""]]) @@ -129,6 +135,7 @@ def retrieve( *, skill_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -165,7 +172,12 @@ def retrieve( if not version: raise ValueError(f"Expected a non-empty value for `version` but received {version!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get( @@ -183,6 +195,7 @@ def list( limit: Optional[int] | Omit = omit, page: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -217,7 +230,12 @@ def list( if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get_api_list( @@ -245,6 +263,7 @@ def delete( *, skill_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -280,7 +299,12 @@ def delete( if not version: raise ValueError(f"Expected a non-empty value for `version` but received {version!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._delete( @@ -297,6 +321,7 @@ def download( *, skill_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -333,7 +358,12 @@ def download( raise ValueError(f"Expected a non-empty value for `version` but received {version!r}") extra_headers = {"Accept": "application/binary", **(extra_headers or {})} extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get( @@ -373,6 +403,7 @@ async def create( *, files: SequenceNotStr[FileTypes], betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -406,7 +437,12 @@ async def create( if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } body = deepcopy_with_paths({"files": files}, [["files", ""]]) @@ -431,6 +467,7 @@ async def retrieve( *, skill_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -467,7 +504,12 @@ async def retrieve( if not version: raise ValueError(f"Expected a non-empty value for `version` but received {version!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return await self._get( @@ -485,6 +527,7 @@ def list( limit: Optional[int] | Omit = omit, page: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -519,7 +562,12 @@ def list( if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get_api_list( @@ -547,6 +595,7 @@ async def delete( *, skill_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -582,7 +631,12 @@ async def delete( if not version: raise ValueError(f"Expected a non-empty value for `version` but received {version!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return await self._delete( @@ -599,6 +653,7 @@ async def download( *, skill_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -635,7 +690,12 @@ async def download( raise ValueError(f"Expected a non-empty value for `version` but received {version!r}") extra_headers = {"Accept": "application/binary", **(extra_headers or {})} extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return await self._get( diff --git a/src/anthropic/resources/beta/tunnels/certificates.py b/src/anthropic/resources/beta/tunnels/certificates.py index 232474ccc..00e77353a 100644 --- a/src/anthropic/resources/beta/tunnels/certificates.py +++ b/src/anthropic/resources/beta/tunnels/certificates.py @@ -52,6 +52,7 @@ def create( *, ca_certificate_pem: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -91,7 +92,8 @@ def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -114,6 +116,7 @@ def retrieve( *, tunnel_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -150,7 +153,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -176,6 +180,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -217,7 +222,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -249,6 +255,7 @@ def archive( *, tunnel_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -288,7 +295,8 @@ def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -333,6 +341,7 @@ async def create( *, ca_certificate_pem: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -372,7 +381,8 @@ async def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -395,6 +405,7 @@ async def retrieve( *, tunnel_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -431,7 +442,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -457,6 +469,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -498,7 +511,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -530,6 +544,7 @@ async def archive( *, tunnel_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -569,7 +584,8 @@ async def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/tunnels/tunnels.py b/src/anthropic/resources/beta/tunnels/tunnels.py index 1682f23f1..aedf3be47 100644 --- a/src/anthropic/resources/beta/tunnels/tunnels.py +++ b/src/anthropic/resources/beta/tunnels/tunnels.py @@ -64,6 +64,7 @@ def create( *, display_name: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -100,7 +101,8 @@ def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -120,6 +122,7 @@ def retrieve( tunnel_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -154,7 +157,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -175,6 +179,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -214,7 +219,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -245,6 +251,7 @@ def archive( tunnel_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -282,7 +289,8 @@ def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -301,6 +309,7 @@ def reveal_token( tunnel_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -338,7 +347,8 @@ def reveal_token( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -358,6 +368,7 @@ def rotate_token( *, reason: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -396,7 +407,8 @@ def rotate_token( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -441,6 +453,7 @@ async def create( *, display_name: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -477,7 +490,8 @@ async def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -497,6 +511,7 @@ async def retrieve( tunnel_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -531,7 +546,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -552,6 +568,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -591,7 +608,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -622,6 +640,7 @@ async def archive( tunnel_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -659,7 +678,8 @@ async def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -678,6 +698,7 @@ async def reveal_token( tunnel_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -715,7 +736,8 @@ async def reveal_token( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -735,6 +757,7 @@ async def rotate_token( *, reason: Optional[str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -773,7 +796,8 @@ async def rotate_token( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["mcp-tunnels-2026-06-22"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/vaults/credentials.py b/src/anthropic/resources/beta/vaults/credentials.py index 0909f6690..56ee8faa5 100644 --- a/src/anthropic/resources/beta/vaults/credentials.py +++ b/src/anthropic/resources/beta/vaults/credentials.py @@ -56,6 +56,7 @@ def create( display_name: Optional[str] | Omit = omit, metadata: Dict[str, str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -91,7 +92,8 @@ def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -119,6 +121,7 @@ def retrieve( *, vault_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -149,7 +152,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -176,6 +180,7 @@ def update( display_name: Optional[str] | Omit = omit, metadata: Optional[Dict[str, Optional[str]]] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -213,7 +218,8 @@ def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -247,6 +253,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -281,7 +288,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -313,6 +321,7 @@ def delete( *, vault_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -343,7 +352,8 @@ def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -367,6 +377,7 @@ def archive( *, vault_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -397,7 +408,8 @@ def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -421,6 +433,7 @@ def mcp_oauth_validate( *, vault_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -451,7 +464,8 @@ def mcp_oauth_validate( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -498,6 +512,7 @@ async def create( display_name: Optional[str] | Omit = omit, metadata: Dict[str, str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -533,7 +548,8 @@ async def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -561,6 +577,7 @@ async def retrieve( *, vault_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -591,7 +608,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -618,6 +636,7 @@ async def update( display_name: Optional[str] | Omit = omit, metadata: Optional[Dict[str, Optional[str]]] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -655,7 +674,8 @@ async def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -689,6 +709,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -723,7 +744,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -755,6 +777,7 @@ async def delete( *, vault_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -785,7 +808,8 @@ async def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -809,6 +833,7 @@ async def archive( *, vault_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -839,7 +864,8 @@ async def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -863,6 +889,7 @@ async def mcp_oauth_validate( *, vault_id: str, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -893,7 +920,8 @@ async def mcp_oauth_validate( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/beta/vaults/vaults.py b/src/anthropic/resources/beta/vaults/vaults.py index b495750d7..24ed12d56 100644 --- a/src/anthropic/resources/beta/vaults/vaults.py +++ b/src/anthropic/resources/beta/vaults/vaults.py @@ -65,6 +65,7 @@ def create( display_name: str, metadata: Dict[str, str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -97,7 +98,8 @@ def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -123,6 +125,7 @@ def retrieve( vault_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -151,7 +154,8 @@ def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -172,6 +176,7 @@ def update( display_name: Optional[str] | Omit = omit, metadata: Optional[Dict[str, Optional[str]]] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -206,7 +211,8 @@ def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -234,6 +240,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -266,7 +273,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -297,6 +305,7 @@ def delete( vault_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -325,7 +334,8 @@ def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -344,6 +354,7 @@ def archive( vault_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -372,7 +383,8 @@ def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -417,6 +429,7 @@ async def create( display_name: str, metadata: Dict[str, str] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -449,7 +462,8 @@ async def create( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -475,6 +489,7 @@ async def retrieve( vault_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -503,7 +518,8 @@ async def retrieve( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -524,6 +540,7 @@ async def update( display_name: Optional[str] | Omit = omit, metadata: Optional[Dict[str, Optional[str]]] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -558,7 +575,8 @@ async def update( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -586,6 +604,7 @@ def list( limit: int | Omit = omit, page: str | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -618,7 +637,8 @@ def list( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -649,6 +669,7 @@ async def delete( vault_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -677,7 +698,8 @@ async def delete( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), @@ -696,6 +718,7 @@ async def archive( vault_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -724,7 +747,8 @@ async def archive( { "anthropic-beta": ",".join(chain((str(e) for e in betas), ["managed-agents-2026-04-01"])) if is_given(betas) - else not_given + else not_given, + "anthropic-workspace-id": workspace_id, } ), **(extra_headers or {}), diff --git a/src/anthropic/resources/files.py b/src/anthropic/resources/files.py index ea8f94ffb..b8c842f66 100644 --- a/src/anthropic/resources/files.py +++ b/src/anthropic/resources/files.py @@ -9,7 +9,7 @@ from ..types import file_list_params, file_upload_params from .._files import deepcopy_with_paths from .._types import Body, Omit, Query, Headers, NotGiven, FileTypes, SequenceNotStr, omit, not_given -from .._utils import extract_files, path_template, maybe_transform, async_maybe_transform +from .._utils import extract_files, path_template, maybe_transform, strip_not_given, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -65,6 +65,7 @@ def list( ids: Optional[SequenceNotStr[str]] | Omit = omit, limit: int | Omit = omit, page: Optional[str] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -97,6 +98,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get_api_list( "/v1/files", page=SyncPageCursor[FileMetadata], @@ -121,6 +123,7 @@ def delete( self, file_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -144,6 +147,7 @@ def delete( """ if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._delete( path_template("/v1/files/{file_id}", file_id=file_id), options=make_request_options( @@ -156,6 +160,7 @@ def download( self, file_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -180,6 +185,7 @@ def download( if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") extra_headers = {"Accept": "application/binary", **(extra_headers or {})} + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get( path_template("/v1/files/{file_id}/content", file_id=file_id), options=make_request_options( @@ -192,6 +198,7 @@ def retrieve_metadata( self, file_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -215,6 +222,7 @@ def retrieve_metadata( """ if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get( path_template("/v1/files/{file_id}", file_id=file_id), options=make_request_options( @@ -228,6 +236,7 @@ def upload( *, file: FileTypes, expires_in_seconds: int | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -252,7 +261,7 @@ def upload( timeout: Override the client-level default timeout for this request, in seconds """ - extra_headers = merge_headers(_stainless_helper_header_from_file(file), extra_headers or {}) + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} body = deepcopy_with_paths( { "file": file, @@ -302,6 +311,7 @@ def list( ids: Optional[SequenceNotStr[str]] | Omit = omit, limit: int | Omit = omit, page: Optional[str] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -334,6 +344,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get_api_list( "/v1/files", page=AsyncPageCursor[FileMetadata], @@ -358,6 +369,7 @@ async def delete( self, file_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -381,6 +393,7 @@ async def delete( """ if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return await self._delete( path_template("/v1/files/{file_id}", file_id=file_id), options=make_request_options( @@ -393,6 +406,7 @@ async def download( self, file_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -417,6 +431,7 @@ async def download( if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") extra_headers = {"Accept": "application/binary", **(extra_headers or {})} + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return await self._get( path_template("/v1/files/{file_id}/content", file_id=file_id), options=make_request_options( @@ -429,6 +444,7 @@ async def retrieve_metadata( self, file_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -452,6 +468,7 @@ async def retrieve_metadata( """ if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return await self._get( path_template("/v1/files/{file_id}", file_id=file_id), options=make_request_options( @@ -465,6 +482,7 @@ async def upload( *, file: FileTypes, expires_in_seconds: int | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -489,7 +507,7 @@ async def upload( timeout: Override the client-level default timeout for this request, in seconds """ - extra_headers = merge_headers(_stainless_helper_header_from_file(file), extra_headers or {}) + body = deepcopy_with_paths( { "file": file, diff --git a/src/anthropic/resources/messages/batches.py b/src/anthropic/resources/messages/batches.py index c53f6fd81..b4c584032 100644 --- a/src/anthropic/resources/messages/batches.py +++ b/src/anthropic/resources/messages/batches.py @@ -53,6 +53,7 @@ def create( *, requests: Iterable[batch_create_params.Request], user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -87,7 +88,15 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - extra_headers = {**strip_not_given({"anthropic-user-profile-id": user_profile_id}), **(extra_headers or {})} + extra_headers = { + **strip_not_given( + { + "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, + } + ), + **(extra_headers or {}), + } return self._post( "/v1/messages/batches", body=maybe_transform({"requests": requests}, batch_create_params.BatchCreateParams), @@ -101,6 +110,7 @@ def retrieve( self, message_batch_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -130,6 +140,7 @@ def retrieve( """ if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get( path_template("/v1/messages/batches/{message_batch_id}", message_batch_id=message_batch_id), options=make_request_options( @@ -144,6 +155,7 @@ def list( after_id: str | Omit = omit, before_id: str | Omit = omit, limit: int | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -178,6 +190,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get_api_list( "/v1/messages/batches", page=SyncPage[MessageBatch], @@ -202,6 +215,7 @@ def delete( self, message_batch_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -231,6 +245,7 @@ def delete( """ if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._delete( path_template("/v1/messages/batches/{message_batch_id}", message_batch_id=message_batch_id), options=make_request_options( @@ -243,6 +258,7 @@ def cancel( self, message_batch_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -278,6 +294,7 @@ def cancel( """ if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._post( path_template("/v1/messages/batches/{message_batch_id}/cancel", message_batch_id=message_batch_id), options=make_request_options( @@ -290,6 +307,7 @@ def results( self, message_batch_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -321,13 +339,14 @@ def results( if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") - batch = self.retrieve(message_batch_id=message_batch_id) + batch = self.retrieve(message_batch_id=message_batch_id, workspace_id=workspace_id) if not batch.results_url: raise AnthropicError( f"No `results_url` for the given batch; Has it finished processing? {batch.processing_status}" ) extra_headers = {"Accept": "application/binary", **(extra_headers or {})} + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get( path_template(batch.results_url, message_batch_id=message_batch_id), options=make_request_options( @@ -363,6 +382,7 @@ async def create( *, requests: Iterable[batch_create_params.Request], user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -397,7 +417,15 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - extra_headers = {**strip_not_given({"anthropic-user-profile-id": user_profile_id}), **(extra_headers or {})} + extra_headers = { + **strip_not_given( + { + "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, + } + ), + **(extra_headers or {}), + } return await self._post( "/v1/messages/batches", body=await async_maybe_transform({"requests": requests}, batch_create_params.BatchCreateParams), @@ -411,6 +439,7 @@ async def retrieve( self, message_batch_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -440,6 +469,7 @@ async def retrieve( """ if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return await self._get( path_template("/v1/messages/batches/{message_batch_id}", message_batch_id=message_batch_id), options=make_request_options( @@ -454,6 +484,7 @@ def list( after_id: str | Omit = omit, before_id: str | Omit = omit, limit: int | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -488,6 +519,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get_api_list( "/v1/messages/batches", page=AsyncPage[MessageBatch], @@ -512,6 +544,7 @@ async def delete( self, message_batch_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -541,6 +574,7 @@ async def delete( """ if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return await self._delete( path_template("/v1/messages/batches/{message_batch_id}", message_batch_id=message_batch_id), options=make_request_options( @@ -553,6 +587,7 @@ async def cancel( self, message_batch_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -588,6 +623,7 @@ async def cancel( """ if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return await self._post( path_template("/v1/messages/batches/{message_batch_id}/cancel", message_batch_id=message_batch_id), options=make_request_options( @@ -600,6 +636,7 @@ async def results( self, message_batch_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -631,13 +668,14 @@ async def results( if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") - batch = await self.retrieve(message_batch_id=message_batch_id) + batch = await self.retrieve(message_batch_id=message_batch_id, workspace_id=workspace_id) if not batch.results_url: raise AnthropicError( f"No `results_url` for the given batch; Has it finished processing? {batch.processing_status}" ) extra_headers = {"Accept": "application/binary", **(extra_headers or {})} + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return await self._get( path_template(batch.results_url, message_batch_id=message_batch_id), options=make_request_options( diff --git a/src/anthropic/resources/messages/messages.py b/src/anthropic/resources/messages/messages.py index e077f6a34..09324068e 100644 --- a/src/anthropic/resources/messages/messages.py +++ b/src/anthropic/resources/messages/messages.py @@ -137,6 +137,7 @@ def create( tool_choice: ToolChoiceParam | Omit = omit, tools: Iterable[ToolUnionParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -404,6 +405,7 @@ def create( tool_choice: ToolChoiceParam | Omit = omit, tools: Iterable[ToolUnionParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -671,6 +673,7 @@ def create( tool_choice: ToolChoiceParam | Omit = omit, tools: Iterable[ToolUnionParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -938,6 +941,7 @@ def create( tool_choice: ToolChoiceParam | Omit = omit, tools: Iterable[ToolUnionParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -964,7 +968,15 @@ def create( stacklevel=3, ) - extra_headers = {**strip_not_given({"anthropic-user-profile-id": user_profile_id}), **(extra_headers or {})} + extra_headers = { + **strip_not_given( + { + "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, + } + ), + **(extra_headers or {}), + } return self._post( "/v1/messages", body=maybe_transform( @@ -1237,6 +1249,7 @@ def count_tokens( tool_choice: ToolChoiceParam | Omit = omit, tools: Iterable[MessageCountTokensToolParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1440,7 +1453,21 @@ def count_tokens( timeout: Override the client-level default timeout for this request, in seconds """ - extra_headers = {**strip_not_given({"anthropic-user-profile-id": user_profile_id}), **(extra_headers or {})} + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = { + **strip_not_given( + { + "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, + } + ), + **(extra_headers or {}), + } # Transform output_format if provided transformed_output_format: Optional[JSONOutputFormatParam] | NotGiven = not_given @@ -1539,6 +1566,7 @@ async def create( tool_choice: ToolChoiceParam | Omit = omit, tools: Iterable[ToolUnionParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1806,6 +1834,7 @@ async def create( tool_choice: ToolChoiceParam | Omit = omit, tools: Iterable[ToolUnionParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2073,6 +2102,7 @@ async def create( tool_choice: ToolChoiceParam | Omit = omit, tools: Iterable[ToolUnionParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2340,6 +2370,7 @@ async def create( tool_choice: ToolChoiceParam | Omit = omit, tools: Iterable[ToolUnionParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2366,7 +2397,15 @@ async def create( stacklevel=3, ) - extra_headers = {**strip_not_given({"anthropic-user-profile-id": user_profile_id}), **(extra_headers or {})} + extra_headers = { + **strip_not_given( + { + "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, + } + ), + **(extra_headers or {}), + } return await self._post( "/v1/messages", body=await async_maybe_transform( @@ -2638,6 +2677,7 @@ async def count_tokens( tool_choice: ToolChoiceParam | Omit = omit, tools: Iterable[MessageCountTokensToolParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2841,7 +2881,21 @@ async def count_tokens( timeout: Override the client-level default timeout for this request, in seconds """ - extra_headers = {**strip_not_given({"anthropic-user-profile-id": user_profile_id}), **(extra_headers or {})} + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = { + **strip_not_given( + { + "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, + } + ), + **(extra_headers or {}), + } # Transform output_format if provided transformed_output_format: Optional[JSONOutputFormatParam] | NotGiven = not_given diff --git a/src/anthropic/resources/models.py b/src/anthropic/resources/models.py index 75d8ca0b4..76995a34e 100644 --- a/src/anthropic/resources/models.py +++ b/src/anthropic/resources/models.py @@ -50,6 +50,7 @@ def retrieve( model_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -79,7 +80,12 @@ def retrieve( if not model_id: raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get( @@ -97,6 +103,7 @@ def list( before_id: str | Omit = omit, limit: int | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -132,7 +139,12 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get_api_list( @@ -181,6 +193,7 @@ async def retrieve( model_id: str, *, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -210,7 +223,12 @@ async def retrieve( if not model_id: raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return await self._get( @@ -228,6 +246,7 @@ def list( before_id: str | Omit = omit, limit: int | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -263,7 +282,12 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}), + **strip_not_given( + { + "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, + "anthropic-workspace-id": workspace_id, + } + ), **(extra_headers or {}), } return self._get_api_list( diff --git a/src/anthropic/resources/skills/skills.py b/src/anthropic/resources/skills/skills.py index 516353fc7..2366319d9 100644 --- a/src/anthropic/resources/skills/skills.py +++ b/src/anthropic/resources/skills/skills.py @@ -19,7 +19,7 @@ omit, not_given, ) -from ..._utils import extract_files, path_template, maybe_transform, async_maybe_transform +from ..._utils import extract_files, path_template, maybe_transform, strip_not_given, async_maybe_transform from .versions import ( Versions, AsyncVersions, @@ -73,6 +73,7 @@ def create( *, files: SequenceNotStr[FileTypes], display_name: Optional[str] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -101,6 +102,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} body = deepcopy_with_paths( { "files": files, @@ -127,6 +129,7 @@ def retrieve( self, skill_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -152,6 +155,7 @@ def retrieve( """ if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get( path_template("/v1/skills/{skill_id}", skill_id=skill_id), options=make_request_options( @@ -166,6 +170,7 @@ def list( limit: int | Omit = omit, page: Optional[str] | Omit = omit, source: Optional[str] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -201,6 +206,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get_api_list( "/v1/skills", page=SyncPageCursor[Skill], @@ -225,6 +231,7 @@ def delete( self, skill_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -250,6 +257,7 @@ def delete( """ if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._delete( path_template("/v1/skills/{skill_id}", skill_id=skill_id), options=make_request_options( @@ -288,6 +296,7 @@ async def create( *, files: SequenceNotStr[FileTypes], display_name: Optional[str] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -316,6 +325,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} body = deepcopy_with_paths( { "files": files, @@ -342,6 +352,7 @@ async def retrieve( self, skill_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -367,6 +378,7 @@ async def retrieve( """ if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return await self._get( path_template("/v1/skills/{skill_id}", skill_id=skill_id), options=make_request_options( @@ -381,6 +393,7 @@ def list( limit: int | Omit = omit, page: Optional[str] | Omit = omit, source: Optional[str] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -416,6 +429,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get_api_list( "/v1/skills", page=AsyncPageCursor[Skill], @@ -440,6 +454,7 @@ async def delete( self, skill_id: str, *, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -465,6 +480,7 @@ async def delete( """ if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return await self._delete( path_template("/v1/skills/{skill_id}", skill_id=skill_id), options=make_request_options( diff --git a/src/anthropic/resources/skills/versions.py b/src/anthropic/resources/skills/versions.py index b32aa4945..a29485d3d 100644 --- a/src/anthropic/resources/skills/versions.py +++ b/src/anthropic/resources/skills/versions.py @@ -18,7 +18,7 @@ omit, not_given, ) -from ..._utils import extract_files, path_template, maybe_transform, async_maybe_transform +from ..._utils import extract_files, path_template, maybe_transform, strip_not_given, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -61,6 +61,7 @@ def create( skill_id: str, *, files: SequenceNotStr[FileTypes], + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -91,6 +92,7 @@ def create( """ if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} body = deepcopy_with_paths({"files": files}, [["files", ""]]) extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", ""]]) # It should be noted that the actual Content-Type header that will be @@ -112,6 +114,7 @@ def retrieve( version: str, *, skill_id: str, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -145,6 +148,7 @@ def retrieve( raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") if not version: raise ValueError(f"Expected a non-empty value for `version` but received {version!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get( path_template("/v1/skills/{skill_id}/versions/{version}", skill_id=skill_id, version=version), options=make_request_options( @@ -159,6 +163,7 @@ def list( *, limit: Optional[int] | Omit = omit, page: Optional[str] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -190,6 +195,7 @@ def list( """ if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get_api_list( path_template("/v1/skills/{skill_id}/versions", skill_id=skill_id), page=SyncPageCursor[SkillVersion], @@ -214,6 +220,7 @@ def delete( version: str, *, skill_id: str, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -246,6 +253,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") if not version: raise ValueError(f"Expected a non-empty value for `version` but received {version!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._delete( path_template("/v1/skills/{skill_id}/versions/{version}", skill_id=skill_id, version=version), options=make_request_options( @@ -280,6 +288,7 @@ async def create( skill_id: str, *, files: SequenceNotStr[FileTypes], + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -310,6 +319,7 @@ async def create( """ if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} body = deepcopy_with_paths({"files": files}, [["files", ""]]) extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", ""]]) # It should be noted that the actual Content-Type header that will be @@ -331,6 +341,7 @@ async def retrieve( version: str, *, skill_id: str, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -364,6 +375,7 @@ async def retrieve( raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") if not version: raise ValueError(f"Expected a non-empty value for `version` but received {version!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return await self._get( path_template("/v1/skills/{skill_id}/versions/{version}", skill_id=skill_id, version=version), options=make_request_options( @@ -378,6 +390,7 @@ def list( *, limit: Optional[int] | Omit = omit, page: Optional[str] | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -409,6 +422,7 @@ def list( """ if not skill_id: raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return self._get_api_list( path_template("/v1/skills/{skill_id}/versions", skill_id=skill_id), page=AsyncPageCursor[SkillVersion], @@ -433,6 +447,7 @@ async def delete( version: str, *, skill_id: str, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -465,6 +480,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") if not version: raise ValueError(f"Expected a non-empty value for `version` but received {version!r}") + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} return await self._delete( path_template("/v1/skills/{skill_id}/versions/{version}", skill_id=skill_id, version=version), options=make_request_options( diff --git a/src/anthropic/types/beta/agent_create_params.py b/src/anthropic/types/beta/agent_create_params.py index 70240acae..e9bcb6253 100644 --- a/src/anthropic/types/beta/agent_create_params.py +++ b/src/anthropic/types/beta/agent_create_params.py @@ -70,6 +70,8 @@ class AgentCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + workspace_id: str + Model: TypeAlias = Union[BetaManagedAgentsModelParam, BetaManagedAgentsModelConfigParams] diff --git a/src/anthropic/types/beta/agent_list_params.py b/src/anthropic/types/beta/agent_list_params.py index 757878fb0..16490591a 100644 --- a/src/anthropic/types/beta/agent_list_params.py +++ b/src/anthropic/types/beta/agent_list_params.py @@ -30,3 +30,5 @@ class AgentListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/agent_retrieve_params.py b/src/anthropic/types/beta/agent_retrieve_params.py index 8abbb9cc2..ffef48afd 100644 --- a/src/anthropic/types/beta/agent_retrieve_params.py +++ b/src/anthropic/types/beta/agent_retrieve_params.py @@ -19,3 +19,5 @@ class AgentRetrieveParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/agent_update_params.py b/src/anthropic/types/beta/agent_update_params.py index be1fa157a..b0ae08095 100644 --- a/src/anthropic/types/beta/agent_update_params.py +++ b/src/anthropic/types/beta/agent_update_params.py @@ -81,6 +81,8 @@ class AgentUpdateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + workspace_id: str + Model: TypeAlias = Union[BetaManagedAgentsModelParam, BetaManagedAgentsModelConfigParams] diff --git a/src/anthropic/types/beta/agents/version_list_params.py b/src/anthropic/types/beta/agents/version_list_params.py index fc5e64131..5acc9da66 100644 --- a/src/anthropic/types/beta/agents/version_list_params.py +++ b/src/anthropic/types/beta/agents/version_list_params.py @@ -19,3 +19,5 @@ class VersionListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/deployment_create_params.py b/src/anthropic/types/beta/deployment_create_params.py index 2b40c8824..b10632ea1 100644 --- a/src/anthropic/types/beta/deployment_create_params.py +++ b/src/anthropic/types/beta/deployment_create_params.py @@ -79,6 +79,8 @@ class DeploymentCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + workspace_id: str + Agent: TypeAlias = Union[str, BetaManagedAgentsAgentParams] diff --git a/src/anthropic/types/beta/deployment_list_params.py b/src/anthropic/types/beta/deployment_list_params.py index d8ae41579..7518db9dc 100644 --- a/src/anthropic/types/beta/deployment_list_params.py +++ b/src/anthropic/types/beta/deployment_list_params.py @@ -41,3 +41,5 @@ class DeploymentListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/deployment_run_list_params.py b/src/anthropic/types/beta/deployment_run_list_params.py index 5ece9a7e5..c8a078f26 100644 --- a/src/anthropic/types/beta/deployment_run_list_params.py +++ b/src/anthropic/types/beta/deployment_run_list_params.py @@ -54,3 +54,5 @@ class DeploymentRunListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/deployment_update_params.py b/src/anthropic/types/beta/deployment_update_params.py index 8ad636e5b..41cb91cca 100644 --- a/src/anthropic/types/beta/deployment_update_params.py +++ b/src/anthropic/types/beta/deployment_update_params.py @@ -83,6 +83,8 @@ class DeploymentUpdateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + workspace_id: str + Agent: TypeAlias = Union[str, BetaManagedAgentsAgentParams] diff --git a/src/anthropic/types/beta/dream_create_params.py b/src/anthropic/types/beta/dream_create_params.py index f4b7f36aa..a73715a57 100644 --- a/src/anthropic/types/beta/dream_create_params.py +++ b/src/anthropic/types/beta/dream_create_params.py @@ -31,5 +31,7 @@ class DreamCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + workspace_id: str + Model: TypeAlias = Union[str, BetaDreamModelConfigParam] diff --git a/src/anthropic/types/beta/dream_list_params.py b/src/anthropic/types/beta/dream_list_params.py index 2b98246fc..153673a7b 100644 --- a/src/anthropic/types/beta/dream_list_params.py +++ b/src/anthropic/types/beta/dream_list_params.py @@ -44,3 +44,5 @@ class DreamListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/environment_create_params.py b/src/anthropic/types/beta/environment_create_params.py index f22e144d2..72c879bf5 100644 --- a/src/anthropic/types/beta/environment_create_params.py +++ b/src/anthropic/types/beta/environment_create_params.py @@ -36,5 +36,7 @@ class EnvironmentCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + workspace_id: str + Config: TypeAlias = Union[BetaCloudConfigParams, BetaSelfHostedConfigParams] diff --git a/src/anthropic/types/beta/environment_list_params.py b/src/anthropic/types/beta/environment_list_params.py index 8b30b277c..3099d8234 100644 --- a/src/anthropic/types/beta/environment_list_params.py +++ b/src/anthropic/types/beta/environment_list_params.py @@ -25,3 +25,5 @@ class EnvironmentListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/environment_update_params.py b/src/anthropic/types/beta/environment_update_params.py index 769244c8b..df85f160c 100644 --- a/src/anthropic/types/beta/environment_update_params.py +++ b/src/anthropic/types/beta/environment_update_params.py @@ -42,5 +42,7 @@ class EnvironmentUpdateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + workspace_id: str + Config: TypeAlias = Union[BetaCloudConfigParams, BetaSelfHostedConfigParams] diff --git a/src/anthropic/types/beta/environments/work_stop_params.py b/src/anthropic/types/beta/environments/work_stop_params.py index cb67abb4c..dc89bca35 100644 --- a/src/anthropic/types/beta/environments/work_stop_params.py +++ b/src/anthropic/types/beta/environments/work_stop_params.py @@ -18,3 +18,5 @@ class WorkStopParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/environments/work_update_params.py b/src/anthropic/types/beta/environments/work_update_params.py index 5edfd2d6d..605332c98 100644 --- a/src/anthropic/types/beta/environments/work_update_params.py +++ b/src/anthropic/types/beta/environments/work_update_params.py @@ -22,3 +22,5 @@ class WorkUpdateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/file_list_params.py b/src/anthropic/types/beta/file_list_params.py index b3721ef22..97d98caa9 100644 --- a/src/anthropic/types/beta/file_list_params.py +++ b/src/anthropic/types/beta/file_list_params.py @@ -41,3 +41,5 @@ class FileListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/file_upload_params.py b/src/anthropic/types/beta/file_upload_params.py index a4da7d091..aabc6181b 100644 --- a/src/anthropic/types/beta/file_upload_params.py +++ b/src/anthropic/types/beta/file_upload_params.py @@ -23,3 +23,5 @@ class FileUploadParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/memory_store_create_params.py b/src/anthropic/types/beta/memory_store_create_params.py index 89b9364ff..b34e583ab 100644 --- a/src/anthropic/types/beta/memory_store_create_params.py +++ b/src/anthropic/types/beta/memory_store_create_params.py @@ -35,3 +35,5 @@ class MemoryStoreCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/memory_store_list_params.py b/src/anthropic/types/beta/memory_store_list_params.py index 49878f515..6cfa3a788 100644 --- a/src/anthropic/types/beta/memory_store_list_params.py +++ b/src/anthropic/types/beta/memory_store_list_params.py @@ -46,3 +46,5 @@ class MemoryStoreListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/memory_store_update_params.py b/src/anthropic/types/beta/memory_store_update_params.py index 1c9ccccef..66bd9235c 100644 --- a/src/anthropic/types/beta/memory_store_update_params.py +++ b/src/anthropic/types/beta/memory_store_update_params.py @@ -34,3 +34,5 @@ class MemoryStoreUpdateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/memory_stores/memory_create_params.py b/src/anthropic/types/beta/memory_stores/memory_create_params.py index 347574390..ddc96b762 100644 --- a/src/anthropic/types/beta/memory_stores/memory_create_params.py +++ b/src/anthropic/types/beta/memory_stores/memory_create_params.py @@ -34,3 +34,5 @@ class MemoryCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/memory_stores/memory_delete_params.py b/src/anthropic/types/beta/memory_stores/memory_delete_params.py index 3caa43a4b..48cdd2a7f 100644 --- a/src/anthropic/types/beta/memory_stores/memory_delete_params.py +++ b/src/anthropic/types/beta/memory_stores/memory_delete_params.py @@ -18,3 +18,5 @@ class MemoryDeleteParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/memory_stores/memory_list_params.py b/src/anthropic/types/beta/memory_stores/memory_list_params.py index 85ada242e..ab302741d 100644 --- a/src/anthropic/types/beta/memory_stores/memory_list_params.py +++ b/src/anthropic/types/beta/memory_stores/memory_list_params.py @@ -49,3 +49,5 @@ class MemoryListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/memory_stores/memory_retrieve_params.py b/src/anthropic/types/beta/memory_stores/memory_retrieve_params.py index 2d2ad56fd..c90e303b7 100644 --- a/src/anthropic/types/beta/memory_stores/memory_retrieve_params.py +++ b/src/anthropic/types/beta/memory_stores/memory_retrieve_params.py @@ -19,3 +19,5 @@ class MemoryRetrieveParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/memory_stores/memory_update_params.py b/src/anthropic/types/beta/memory_stores/memory_update_params.py index 2dce0da12..2384c4337 100644 --- a/src/anthropic/types/beta/memory_stores/memory_update_params.py +++ b/src/anthropic/types/beta/memory_stores/memory_update_params.py @@ -47,3 +47,5 @@ class MemoryUpdateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/memory_stores/memory_version_list_params.py b/src/anthropic/types/beta/memory_stores/memory_version_list_params.py index e2e4f81c1..d7775d6e6 100644 --- a/src/anthropic/types/beta/memory_stores/memory_version_list_params.py +++ b/src/anthropic/types/beta/memory_stores/memory_version_list_params.py @@ -47,3 +47,5 @@ class MemoryVersionListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/memory_stores/memory_version_retrieve_params.py b/src/anthropic/types/beta/memory_stores/memory_version_retrieve_params.py index 71b662cee..766eadf35 100644 --- a/src/anthropic/types/beta/memory_stores/memory_version_retrieve_params.py +++ b/src/anthropic/types/beta/memory_stores/memory_version_retrieve_params.py @@ -19,3 +19,5 @@ class MemoryVersionRetrieveParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/message_count_tokens_params.py b/src/anthropic/types/beta/message_count_tokens_params.py index 38cc789c2..35dc5dc2d 100644 --- a/src/anthropic/types/beta/message_count_tokens_params.py +++ b/src/anthropic/types/beta/message_count_tokens_params.py @@ -267,6 +267,8 @@ class MessageCountTokensParams(TypedDict, total=False): `user-profiles` beta header. """ + workspace_id: str + Tool: TypeAlias = Union[ BetaToolParam, diff --git a/src/anthropic/types/beta/message_create_params.py b/src/anthropic/types/beta/message_create_params.py index 8e466d191..112d44a7e 100644 --- a/src/anthropic/types/beta/message_create_params.py +++ b/src/anthropic/types/beta/message_create_params.py @@ -340,6 +340,8 @@ class MessageCreateParamsBase(TypedDict, total=False): `user-profiles` beta header. """ + workspace_id: str + Container: TypeAlias = Union[BetaContainerParams, str] diff --git a/src/anthropic/types/beta/messages/batch_create_params.py b/src/anthropic/types/beta/messages/batch_create_params.py index d2a774b78..54abbc6f0 100644 --- a/src/anthropic/types/beta/messages/batch_create_params.py +++ b/src/anthropic/types/beta/messages/batch_create_params.py @@ -30,6 +30,8 @@ class BatchCreateParams(TypedDict, total=False): is errored. """ + workspace_id: str + class Request(TypedDict, total=False): custom_id: Required[str] diff --git a/src/anthropic/types/beta/messages/batch_list_params.py b/src/anthropic/types/beta/messages/batch_list_params.py index 034332ef5..04871d9b2 100644 --- a/src/anthropic/types/beta/messages/batch_list_params.py +++ b/src/anthropic/types/beta/messages/batch_list_params.py @@ -31,3 +31,5 @@ class BatchListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/model_list_params.py b/src/anthropic/types/beta/model_list_params.py index 34e39baac..a400e12cd 100644 --- a/src/anthropic/types/beta/model_list_params.py +++ b/src/anthropic/types/beta/model_list_params.py @@ -31,3 +31,5 @@ class ModelListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/session_create_params.py b/src/anthropic/types/beta/session_create_params.py index 105c8b74b..31df9d4cf 100644 --- a/src/anthropic/types/beta/session_create_params.py +++ b/src/anthropic/types/beta/session_create_params.py @@ -61,6 +61,8 @@ class SessionCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + workspace_id: str + Agent: TypeAlias = Union[str, BetaManagedAgentsAgentParams, BetaManagedAgentsAgentWithOverridesParams] diff --git a/src/anthropic/types/beta/session_list_params.py b/src/anthropic/types/beta/session_list_params.py index 9212d86ea..a1ba4704f 100644 --- a/src/anthropic/types/beta/session_list_params.py +++ b/src/anthropic/types/beta/session_list_params.py @@ -63,3 +63,5 @@ class SessionListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/session_update_params.py b/src/anthropic/types/beta/session_update_params.py index 5f02d6e1d..34888fbdd 100644 --- a/src/anthropic/types/beta/session_update_params.py +++ b/src/anthropic/types/beta/session_update_params.py @@ -48,3 +48,5 @@ class SessionUpdateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/sessions/event_list_params.py b/src/anthropic/types/beta/sessions/event_list_params.py index 5fc639f6c..560bf38da 100644 --- a/src/anthropic/types/beta/sessions/event_list_params.py +++ b/src/anthropic/types/beta/sessions/event_list_params.py @@ -59,3 +59,5 @@ class EventListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/sessions/event_send_params.py b/src/anthropic/types/beta/sessions/event_send_params.py index 7f82bf984..1f30492da 100644 --- a/src/anthropic/types/beta/sessions/event_send_params.py +++ b/src/anthropic/types/beta/sessions/event_send_params.py @@ -17,3 +17,5 @@ class EventSendParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/sessions/event_stream_params.py b/src/anthropic/types/beta/sessions/event_stream_params.py index fbce48a33..0fa94a6e4 100644 --- a/src/anthropic/types/beta/sessions/event_stream_params.py +++ b/src/anthropic/types/beta/sessions/event_stream_params.py @@ -28,3 +28,5 @@ class EventStreamParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/sessions/resource_add_params.py b/src/anthropic/types/beta/sessions/resource_add_params.py index dfb2cc0de..48e6c456b 100644 --- a/src/anthropic/types/beta/sessions/resource_add_params.py +++ b/src/anthropic/types/beta/sessions/resource_add_params.py @@ -21,3 +21,5 @@ class ResourceAddParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/sessions/resource_list_params.py b/src/anthropic/types/beta/sessions/resource_list_params.py index e35ac2573..ef4acf14e 100644 --- a/src/anthropic/types/beta/sessions/resource_list_params.py +++ b/src/anthropic/types/beta/sessions/resource_list_params.py @@ -22,3 +22,5 @@ class ResourceListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/sessions/resource_update_params.py b/src/anthropic/types/beta/sessions/resource_update_params.py index be48a1e6b..bd4326eac 100644 --- a/src/anthropic/types/beta/sessions/resource_update_params.py +++ b/src/anthropic/types/beta/sessions/resource_update_params.py @@ -21,3 +21,5 @@ class ResourceUpdateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/sessions/thread_list_params.py b/src/anthropic/types/beta/sessions/thread_list_params.py index cf635ba62..8602c8ff5 100644 --- a/src/anthropic/types/beta/sessions/thread_list_params.py +++ b/src/anthropic/types/beta/sessions/thread_list_params.py @@ -19,3 +19,5 @@ class ThreadListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/sessions/threads/event_list_params.py b/src/anthropic/types/beta/sessions/threads/event_list_params.py index 39eb860cc..e5189ccdf 100644 --- a/src/anthropic/types/beta/sessions/threads/event_list_params.py +++ b/src/anthropic/types/beta/sessions/threads/event_list_params.py @@ -21,3 +21,5 @@ class EventListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/sessions/threads/event_stream_params.py b/src/anthropic/types/beta/sessions/threads/event_stream_params.py index 4d4cad7e0..921823f63 100644 --- a/src/anthropic/types/beta/sessions/threads/event_stream_params.py +++ b/src/anthropic/types/beta/sessions/threads/event_stream_params.py @@ -30,3 +30,5 @@ class EventStreamParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/skill_create_params.py b/src/anthropic/types/beta/skill_create_params.py index ec9b53f4c..1dcf5f05c 100644 --- a/src/anthropic/types/beta/skill_create_params.py +++ b/src/anthropic/types/beta/skill_create_params.py @@ -28,3 +28,5 @@ class SkillCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/skill_list_params.py b/src/anthropic/types/beta/skill_list_params.py index eee872f79..07521de1a 100644 --- a/src/anthropic/types/beta/skill_list_params.py +++ b/src/anthropic/types/beta/skill_list_params.py @@ -35,3 +35,5 @@ class SkillListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/skills/version_create_params.py b/src/anthropic/types/beta/skills/version_create_params.py index 982e1c384..44f2550b8 100644 --- a/src/anthropic/types/beta/skills/version_create_params.py +++ b/src/anthropic/types/beta/skills/version_create_params.py @@ -21,3 +21,5 @@ class VersionCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/skills/version_list_params.py b/src/anthropic/types/beta/skills/version_list_params.py index 589603136..fef911602 100644 --- a/src/anthropic/types/beta/skills/version_list_params.py +++ b/src/anthropic/types/beta/skills/version_list_params.py @@ -22,3 +22,5 @@ class VersionListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/tunnel_create_params.py b/src/anthropic/types/beta/tunnel_create_params.py index 9814c08e9..41247355a 100644 --- a/src/anthropic/types/beta/tunnel_create_params.py +++ b/src/anthropic/types/beta/tunnel_create_params.py @@ -16,3 +16,5 @@ class TunnelCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/tunnel_list_params.py b/src/anthropic/types/beta/tunnel_list_params.py index a7ceff41e..56d44612a 100644 --- a/src/anthropic/types/beta/tunnel_list_params.py +++ b/src/anthropic/types/beta/tunnel_list_params.py @@ -22,3 +22,5 @@ class TunnelListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/tunnel_rotate_token_params.py b/src/anthropic/types/beta/tunnel_rotate_token_params.py index 94605c6d0..3a098446c 100644 --- a/src/anthropic/types/beta/tunnel_rotate_token_params.py +++ b/src/anthropic/types/beta/tunnel_rotate_token_params.py @@ -16,3 +16,5 @@ class TunnelRotateTokenParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/tunnels/certificate_create_params.py b/src/anthropic/types/beta/tunnels/certificate_create_params.py index 3b8f72c9e..8d44e723d 100644 --- a/src/anthropic/types/beta/tunnels/certificate_create_params.py +++ b/src/anthropic/types/beta/tunnels/certificate_create_params.py @@ -19,3 +19,5 @@ class CertificateCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/tunnels/certificate_list_params.py b/src/anthropic/types/beta/tunnels/certificate_list_params.py index d542db6ac..e728b52d5 100644 --- a/src/anthropic/types/beta/tunnels/certificate_list_params.py +++ b/src/anthropic/types/beta/tunnels/certificate_list_params.py @@ -25,3 +25,5 @@ class CertificateListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/vault_create_params.py b/src/anthropic/types/beta/vault_create_params.py index a66c84b72..1d19b3017 100644 --- a/src/anthropic/types/beta/vault_create_params.py +++ b/src/anthropic/types/beta/vault_create_params.py @@ -22,3 +22,5 @@ class VaultCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/vault_list_params.py b/src/anthropic/types/beta/vault_list_params.py index fe5d75fb3..717f2bea3 100644 --- a/src/anthropic/types/beta/vault_list_params.py +++ b/src/anthropic/types/beta/vault_list_params.py @@ -22,3 +22,5 @@ class VaultListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/vault_update_params.py b/src/anthropic/types/beta/vault_update_params.py index e412c0869..5d3217ef5 100644 --- a/src/anthropic/types/beta/vault_update_params.py +++ b/src/anthropic/types/beta/vault_update_params.py @@ -23,3 +23,5 @@ class VaultUpdateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/vaults/credential_create_params.py b/src/anthropic/types/beta/vaults/credential_create_params.py index 5afa4faca..c0bf0331d 100644 --- a/src/anthropic/types/beta/vaults/credential_create_params.py +++ b/src/anthropic/types/beta/vaults/credential_create_params.py @@ -29,6 +29,8 @@ class CredentialCreateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + workspace_id: str + Auth: TypeAlias = Union[ BetaManagedAgentsMCPOAuthCreateParams, diff --git a/src/anthropic/types/beta/vaults/credential_list_params.py b/src/anthropic/types/beta/vaults/credential_list_params.py index 8a6d3b2a1..4799d44a7 100644 --- a/src/anthropic/types/beta/vaults/credential_list_params.py +++ b/src/anthropic/types/beta/vaults/credential_list_params.py @@ -22,3 +22,5 @@ class CredentialListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/beta/vaults/credential_update_params.py b/src/anthropic/types/beta/vaults/credential_update_params.py index 7ee4672f7..269494094 100644 --- a/src/anthropic/types/beta/vaults/credential_update_params.py +++ b/src/anthropic/types/beta/vaults/credential_update_params.py @@ -32,6 +32,8 @@ class CredentialUpdateParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + workspace_id: str + Auth: TypeAlias = Union[ BetaManagedAgentsMCPOAuthUpdateParams, diff --git a/src/anthropic/types/file_list_params.py b/src/anthropic/types/file_list_params.py index 72ac3abdd..09c41c4a3 100644 --- a/src/anthropic/types/file_list_params.py +++ b/src/anthropic/types/file_list_params.py @@ -31,3 +31,5 @@ class FileListParams(TypedDict, total=False): Prefixed `page_`. """ + + workspace_id: str diff --git a/src/anthropic/types/file_upload_params.py b/src/anthropic/types/file_upload_params.py index c321953c3..9dd29d80b 100644 --- a/src/anthropic/types/file_upload_params.py +++ b/src/anthropic/types/file_upload_params.py @@ -18,3 +18,5 @@ class FileUploadParams(TypedDict, total=False): Seconds from upload until the file expires and its bytes become permanently unavailable. Must be between 3600 (one hour) and 7776000 (ninety days). """ + + workspace_id: str diff --git a/src/anthropic/types/message_count_tokens_params.py b/src/anthropic/types/message_count_tokens_params.py index eeb30701c..745725c8e 100644 --- a/src/anthropic/types/message_count_tokens_params.py +++ b/src/anthropic/types/message_count_tokens_params.py @@ -216,3 +216,5 @@ class MessageCountTokensParams(TypedDict, total=False): Use when acting on behalf of a party other than your organization. Requires the `user-profiles` beta header. """ + + workspace_id: str diff --git a/src/anthropic/types/message_create_params.py b/src/anthropic/types/message_create_params.py index e03c98d86..f25c96154 100644 --- a/src/anthropic/types/message_create_params.py +++ b/src/anthropic/types/message_create_params.py @@ -281,6 +281,8 @@ class MessageCreateParamsBase(TypedDict, total=False): `user-profiles` beta header. """ + workspace_id: str + Metadata: TypeAlias = MetadataParam """This is deprecated, `MetadataParam` should be used instead""" diff --git a/src/anthropic/types/messages/batch_create_params.py b/src/anthropic/types/messages/batch_create_params.py index 7835ba899..3e1241e98 100644 --- a/src/anthropic/types/messages/batch_create_params.py +++ b/src/anthropic/types/messages/batch_create_params.py @@ -26,6 +26,8 @@ class BatchCreateParams(TypedDict, total=False): is errored. """ + workspace_id: str + class Request(TypedDict, total=False): custom_id: Required[str] diff --git a/src/anthropic/types/messages/batch_list_params.py b/src/anthropic/types/messages/batch_list_params.py index 7b290a774..c2b1cba66 100644 --- a/src/anthropic/types/messages/batch_list_params.py +++ b/src/anthropic/types/messages/batch_list_params.py @@ -25,3 +25,5 @@ class BatchListParams(TypedDict, total=False): Defaults to `20`. Ranges from `1` to `1000`. """ + + workspace_id: str diff --git a/src/anthropic/types/model_list_params.py b/src/anthropic/types/model_list_params.py index 6fc5c9a10..78cb6c481 100644 --- a/src/anthropic/types/model_list_params.py +++ b/src/anthropic/types/model_list_params.py @@ -31,3 +31,5 @@ class ModelListParams(TypedDict, total=False): betas: List[AnthropicBetaParam] """Optional header to specify the beta version(s) you want to use.""" + + workspace_id: str diff --git a/src/anthropic/types/skill_create_params.py b/src/anthropic/types/skill_create_params.py index 9bfd489bf..a44224e6f 100644 --- a/src/anthropic/types/skill_create_params.py +++ b/src/anthropic/types/skill_create_params.py @@ -24,3 +24,5 @@ class SkillCreateParams(TypedDict, total=False): Maximum 255 characters. Always set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not unique. """ + + workspace_id: str diff --git a/src/anthropic/types/skill_list_params.py b/src/anthropic/types/skill_list_params.py index 56da3f47b..2e60bcd7e 100644 --- a/src/anthropic/types/skill_list_params.py +++ b/src/anthropic/types/skill_list_params.py @@ -30,3 +30,5 @@ class SkillListParams(TypedDict, total=False): - `"custom"`: only return user-created skills - `"anthropic"`: only return Anthropic-created skills """ + + workspace_id: str diff --git a/src/anthropic/types/skills/version_create_params.py b/src/anthropic/types/skills/version_create_params.py index bfcc6ec13..bcb45dbf8 100644 --- a/src/anthropic/types/skills/version_create_params.py +++ b/src/anthropic/types/skills/version_create_params.py @@ -16,3 +16,5 @@ class VersionCreateParams(TypedDict, total=False): All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory. """ + + workspace_id: str diff --git a/src/anthropic/types/skills/version_list_params.py b/src/anthropic/types/skills/version_list_params.py index 965ebe8e3..1a1aebdfb 100644 --- a/src/anthropic/types/skills/version_list_params.py +++ b/src/anthropic/types/skills/version_list_params.py @@ -17,3 +17,5 @@ class VersionListParams(TypedDict, total=False): page: Optional[str] """Optionally set to the `next_page` token from the previous response.""" + + workspace_id: str diff --git a/tests/api_resources/beta/agents/test_versions.py b/tests/api_resources/beta/agents/test_versions.py index 95d6cdff7..4fe40e757 100644 --- a/tests/api_resources/beta/agents/test_versions.py +++ b/tests/api_resources/beta/agents/test_versions.py @@ -33,7 +33,8 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: agent_id="agent_011CZkYpogX7uDKUyvBTophP", limit=0, page="page", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsAgent], version, path=["response"]) @@ -92,7 +93,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - agent_id="agent_011CZkYpogX7uDKUyvBTophP", limit=0, page="page", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsAgent], version, path=["response"]) diff --git a/tests/api_resources/beta/environments/test_work.py b/tests/api_resources/beta/environments/test_work.py index 79bf57440..57c0bbe62 100644 --- a/tests/api_resources/beta/environments/test_work.py +++ b/tests/api_resources/beta/environments/test_work.py @@ -36,6 +36,7 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: work_id="work_id", environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSelfHostedWork, work, path=["response"]) @@ -95,6 +96,7 @@ def test_method_update_with_all_params(self, client: Anthropic) -> None: environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", metadata={"foo": "string"}, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSelfHostedWork, work, path=["response"]) @@ -374,6 +376,7 @@ def test_method_stats_with_all_params(self, client: Anthropic) -> None: work = client.beta.environments.work.stats( environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSelfHostedWorkQueueStats, work, path=["response"]) @@ -426,6 +429,7 @@ def test_method_stop_with_all_params(self, client: Anthropic) -> None: environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", force=True, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSelfHostedWork, work, path=["response"]) @@ -489,6 +493,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi work_id="work_id", environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSelfHostedWork, work, path=["response"]) @@ -548,6 +553,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAnthropic) environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", metadata={"foo": "string"}, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSelfHostedWork, work, path=["response"]) @@ -827,6 +833,7 @@ async def test_method_stats_with_all_params(self, async_client: AsyncAnthropic) work = await async_client.beta.environments.work.stats( environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSelfHostedWorkQueueStats, work, path=["response"]) @@ -879,6 +886,7 @@ async def test_method_stop_with_all_params(self, async_client: AsyncAnthropic) - environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", force=True, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSelfHostedWork, work, path=["response"]) diff --git a/tests/api_resources/beta/memory_stores/test_memories.py b/tests/api_resources/beta/memory_stores/test_memories.py index fe91c1a18..0ad4fa615 100644 --- a/tests/api_resources/beta/memory_stores/test_memories.py +++ b/tests/api_resources/beta/memory_stores/test_memories.py @@ -39,6 +39,7 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: path="xx", view="basic", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemory, memory, path=["response"]) @@ -94,6 +95,7 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: memory_store_id="memory_store_id", view="basic", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemory, memory, path=["response"]) @@ -158,6 +160,7 @@ def test_method_update_with_all_params(self, client: Anthropic) -> None: "content_sha256": "content_sha256", }, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemory, memory, path=["response"]) @@ -220,6 +223,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: path_prefix="path_prefix", view="basic", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsMemoryListItem], memory, path=["response"]) @@ -272,6 +276,7 @@ def test_method_delete_with_all_params(self, client: Anthropic) -> None: memory_store_id="memory_store_id", expected_content_sha256="expected_content_sha256", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeletedMemory, memory, path=["response"]) @@ -338,6 +343,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) path="xx", view="basic", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemory, memory, path=["response"]) @@ -393,6 +399,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi memory_store_id="memory_store_id", view="basic", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemory, memory, path=["response"]) @@ -457,6 +464,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAnthropic) "content_sha256": "content_sha256", }, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemory, memory, path=["response"]) @@ -519,6 +527,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - path_prefix="path_prefix", view="basic", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsMemoryListItem], memory, path=["response"]) @@ -571,6 +580,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) memory_store_id="memory_store_id", expected_content_sha256="expected_content_sha256", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeletedMemory, memory, path=["response"]) diff --git a/tests/api_resources/beta/memory_stores/test_memory_versions.py b/tests/api_resources/beta/memory_stores/test_memory_versions.py index 0ecece0b6..0aaf0f031 100644 --- a/tests/api_resources/beta/memory_stores/test_memory_versions.py +++ b/tests/api_resources/beta/memory_stores/test_memory_versions.py @@ -36,6 +36,7 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: memory_store_id="memory_store_id", view="basic", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemoryVersion, memory_version, path=["response"]) @@ -103,6 +104,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: session_id="session_id", view="basic", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsMemoryVersion], memory_version, path=["response"]) @@ -154,6 +156,7 @@ def test_method_redact_with_all_params(self, client: Anthropic) -> None: memory_version_id="memory_version_id", memory_store_id="memory_store_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemoryVersion, memory_version, path=["response"]) @@ -218,6 +221,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi memory_store_id="memory_store_id", view="basic", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemoryVersion, memory_version, path=["response"]) @@ -285,6 +289,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - session_id="session_id", view="basic", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsMemoryVersion], memory_version, path=["response"]) @@ -336,6 +341,7 @@ async def test_method_redact_with_all_params(self, async_client: AsyncAnthropic) memory_version_id="memory_version_id", memory_store_id="memory_store_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemoryVersion, memory_version, path=["response"]) diff --git a/tests/api_resources/beta/messages/test_batches.py b/tests/api_resources/beta/messages/test_batches.py index eba5e9a0c..47ee2c956 100644 --- a/tests/api_resources/beta/messages/test_batches.py +++ b/tests/api_resources/beta/messages/test_batches.py @@ -189,6 +189,7 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: ], betas=["string"], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaMessageBatch, batch, path=["response"]) @@ -652,6 +653,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) ], betas=["string"], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaMessageBatch, batch, path=["response"]) diff --git a/tests/api_resources/beta/sessions/test_events.py b/tests/api_resources/beta/sessions/test_events.py index 16ec75bf0..26278fa05 100644 --- a/tests/api_resources/beta/sessions/test_events.py +++ b/tests/api_resources/beta/sessions/test_events.py @@ -43,7 +43,8 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: order="asc", page="page", types=["string"], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsSessionEvent], event, path=["response"]) @@ -114,7 +115,8 @@ def test_method_send_with_all_params(self, client: Anthropic) -> None: "type": "user.message", } ], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSendSessionEvents, event, path=["response"]) @@ -194,7 +196,8 @@ def test_method_stream_with_all_params(self, client: Anthropic) -> None: event_stream = client.beta.sessions.events.stream( session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", event_deltas=["agent.message"], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) event_stream.response.close() @@ -255,7 +258,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - order="asc", page="page", types=["string"], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsSessionEvent], event, path=["response"]) @@ -326,7 +330,8 @@ async def test_method_send_with_all_params(self, async_client: AsyncAnthropic) - "type": "user.message", } ], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSendSessionEvents, event, path=["response"]) @@ -406,7 +411,8 @@ async def test_method_stream_with_all_params(self, async_client: AsyncAnthropic) event_stream = await async_client.beta.sessions.events.stream( session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", event_deltas=["agent.message"], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) await event_stream.response.aclose() diff --git a/tests/api_resources/beta/sessions/test_resources.py b/tests/api_resources/beta/sessions/test_resources.py index a57111c61..44826189b 100644 --- a/tests/api_resources/beta/sessions/test_resources.py +++ b/tests/api_resources/beta/sessions/test_resources.py @@ -39,7 +39,8 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: resource = client.beta.sessions.resources.retrieve( resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(ResourceRetrieveResponse, resource, path=["response"]) @@ -103,7 +104,8 @@ def test_method_update_with_all_params(self, client: Anthropic) -> None: resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", authorization_token="ghp_exampletoken", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(ResourceUpdateResponse, resource, path=["response"]) @@ -169,7 +171,8 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", limit=0, page="page", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsSessionResource], resource, path=["response"]) @@ -222,7 +225,8 @@ def test_method_delete_with_all_params(self, client: Anthropic) -> None: resource = client.beta.sessions.resources.delete( resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeleteSessionResource, resource, path=["response"]) @@ -287,7 +291,8 @@ def test_method_add_with_all_params(self, client: Anthropic) -> None: file_id="file_011CNha8iCJcU1wXNR6q4V8w", type="file", mount_path="/uploads/receipt.pdf", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsFileResource, resource, path=["response"]) @@ -352,7 +357,8 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi resource = await async_client.beta.sessions.resources.retrieve( resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(ResourceRetrieveResponse, resource, path=["response"]) @@ -416,7 +422,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncAnthropic) resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", authorization_token="ghp_exampletoken", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(ResourceUpdateResponse, resource, path=["response"]) @@ -482,7 +489,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", limit=0, page="page", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsSessionResource], resource, path=["response"]) @@ -535,7 +543,8 @@ async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) resource = await async_client.beta.sessions.resources.delete( resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht", session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeleteSessionResource, resource, path=["response"]) @@ -600,7 +609,8 @@ async def test_method_add_with_all_params(self, async_client: AsyncAnthropic) -> file_id="file_011CNha8iCJcU1wXNR6q4V8w", type="file", mount_path="/uploads/receipt.pdf", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsFileResource, resource, path=["response"]) diff --git a/tests/api_resources/beta/sessions/test_threads.py b/tests/api_resources/beta/sessions/test_threads.py index db33ef741..1938b39cf 100644 --- a/tests/api_resources/beta/sessions/test_threads.py +++ b/tests/api_resources/beta/sessions/test_threads.py @@ -32,6 +32,7 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: thread_id="sthr_011CZkZVWa6oIjw0rgXZpnBt", session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSessionThread, thread, path=["response"]) @@ -91,6 +92,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: limit=0, page="page", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsSessionThread], thread, path=["response"]) @@ -142,6 +144,7 @@ def test_method_archive_with_all_params(self, client: Anthropic) -> None: thread_id="sthr_011CZkZVWa6oIjw0rgXZpnBt", session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSessionThread, thread, path=["response"]) @@ -205,6 +208,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi thread_id="sthr_011CZkZVWa6oIjw0rgXZpnBt", session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSessionThread, thread, path=["response"]) @@ -264,6 +268,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - limit=0, page="page", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsSessionThread], thread, path=["response"]) @@ -315,6 +320,7 @@ async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic thread_id="sthr_011CZkZVWa6oIjw0rgXZpnBt", session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSessionThread, thread, path=["response"]) diff --git a/tests/api_resources/beta/sessions/threads/test_events.py b/tests/api_resources/beta/sessions/threads/test_events.py index 414fe4611..b4654c022 100644 --- a/tests/api_resources/beta/sessions/threads/test_events.py +++ b/tests/api_resources/beta/sessions/threads/test_events.py @@ -36,6 +36,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: limit=0, page="page", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsSessionEvent], event, path=["response"]) @@ -97,6 +98,7 @@ def test_method_stream_with_all_params(self, client: Anthropic) -> None: session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", event_deltas=["agent.message"], betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) event_stream.response.close() @@ -163,6 +165,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - limit=0, page="page", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsSessionEvent], event, path=["response"]) @@ -224,6 +227,7 @@ async def test_method_stream_with_all_params(self, async_client: AsyncAnthropic) session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", event_deltas=["agent.message"], betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) await event_stream.response.aclose() diff --git a/tests/api_resources/beta/skills/test_versions.py b/tests/api_resources/beta/skills/test_versions.py index cae47cb05..e3cca1408 100644 --- a/tests/api_resources/beta/skills/test_versions.py +++ b/tests/api_resources/beta/skills/test_versions.py @@ -42,7 +42,8 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: version = client.beta.skills.versions.create( skill_id="skill_id", files=[b"Example data"], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSkillVersion, version, path=["response"]) @@ -93,7 +94,8 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: version = client.beta.skills.versions.retrieve( version="version", skill_id="skill_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSkillVersion, version, path=["response"]) @@ -150,7 +152,8 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: skill_id="skill_id", limit=1, page="page", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaSkillVersion], version, path=["response"]) @@ -198,7 +201,8 @@ def test_method_delete_with_all_params(self, client: Anthropic) -> None: version = client.beta.skills.versions.delete( version="version", skill_id="skill_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDeletedSkillVersion, version, path=["response"]) @@ -267,6 +271,7 @@ def test_method_download_with_all_params(self, client: Anthropic, respx_mock: Mo version="version", skill_id="skill_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert version.is_closed assert version.json() == {"foo": "bar"} @@ -343,7 +348,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) version = await async_client.beta.skills.versions.create( skill_id="skill_id", files=[b"Example data"], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSkillVersion, version, path=["response"]) @@ -394,7 +400,8 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi version = await async_client.beta.skills.versions.retrieve( version="version", skill_id="skill_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSkillVersion, version, path=["response"]) @@ -451,7 +458,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - skill_id="skill_id", limit=1, page="page", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaSkillVersion], version, path=["response"]) @@ -499,7 +507,8 @@ async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) version = await async_client.beta.skills.versions.delete( version="version", skill_id="skill_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDeletedSkillVersion, version, path=["response"]) @@ -568,6 +577,7 @@ async def test_method_download_with_all_params(self, async_client: AsyncAnthropi version="version", skill_id="skill_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert version.is_closed assert await version.json() == {"foo": "bar"} diff --git a/tests/api_resources/beta/test_agents.py b/tests/api_resources/beta/test_agents.py index abbc24263..9a293d315 100644 --- a/tests/api_resources/beta/test_agents.py +++ b/tests/api_resources/beta/test_agents.py @@ -73,6 +73,7 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: } ], betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsAgent, agent, path=["response"]) @@ -117,6 +118,7 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: agent_id="agent_011CZkYpogX7uDKUyvBTophP", version=0, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsAgent, agent, path=["response"]) @@ -212,6 +214,7 @@ def test_method_update_with_all_params(self, client: Anthropic) -> None: ], version=1, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsAgent, agent, path=["response"]) @@ -262,6 +265,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: limit=0, page="page", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsAgent], agent, path=["response"]) @@ -299,6 +303,7 @@ def test_method_archive_with_all_params(self, client: Anthropic) -> None: agent = client.beta.agents.archive( agent_id="agent_011CZkYpogX7uDKUyvBTophP", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsAgent, agent, path=["response"]) @@ -391,6 +396,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) } ], betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsAgent, agent, path=["response"]) @@ -435,6 +441,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi agent_id="agent_011CZkYpogX7uDKUyvBTophP", version=0, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsAgent, agent, path=["response"]) @@ -530,6 +537,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAnthropic) ], version=1, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsAgent, agent, path=["response"]) @@ -580,6 +588,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - limit=0, page="page", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsAgent], agent, path=["response"]) @@ -617,6 +626,7 @@ async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic agent = await async_client.beta.agents.archive( agent_id="agent_011CZkYpogX7uDKUyvBTophP", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsAgent, agent, path=["response"]) diff --git a/tests/api_resources/beta/test_deployment_runs.py b/tests/api_resources/beta/test_deployment_runs.py index 5e58168c3..66d8fec65 100644 --- a/tests/api_resources/beta/test_deployment_runs.py +++ b/tests/api_resources/beta/test_deployment_runs.py @@ -35,6 +35,7 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: deployment_run = client.beta.deployment_runs.retrieve( deployment_run_id="deployment_run_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeploymentRun, deployment_run, path=["response"]) @@ -92,6 +93,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: page="page", trigger_type="schedule", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsDeploymentRun], deployment_run, path=["response"]) @@ -137,6 +139,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi deployment_run = await async_client.beta.deployment_runs.retrieve( deployment_run_id="deployment_run_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeploymentRun, deployment_run, path=["response"]) @@ -194,6 +197,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - page="page", trigger_type="schedule", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsDeploymentRun], deployment_run, path=["response"]) diff --git a/tests/api_resources/beta/test_deployments.py b/tests/api_resources/beta/test_deployments.py index 5207abd8c..18fed388d 100644 --- a/tests/api_resources/beta/test_deployments.py +++ b/tests/api_resources/beta/test_deployments.py @@ -82,6 +82,7 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: }, vault_ids=["string"], betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeployment, deployment, path=["response"]) @@ -149,6 +150,7 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: deployment = client.beta.deployments.retrieve( deployment_id="depl_011CZkZcDH3vPqd7xnEfwTai", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeployment, deployment, path=["response"]) @@ -234,6 +236,7 @@ def test_method_update_with_all_params(self, client: Anthropic) -> None: }, vault_ids=["string"], betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeployment, deployment, path=["response"]) @@ -286,6 +289,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: page="page", status="active", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsDeployment], deployment, path=["response"]) @@ -323,6 +327,7 @@ def test_method_archive_with_all_params(self, client: Anthropic) -> None: deployment = client.beta.deployments.archive( deployment_id="depl_011CZkZcDH3vPqd7xnEfwTai", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeployment, deployment, path=["response"]) @@ -369,6 +374,7 @@ def test_method_pause_with_all_params(self, client: Anthropic) -> None: deployment = client.beta.deployments.pause( deployment_id="depl_011CZkZcDH3vPqd7xnEfwTai", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeployment, deployment, path=["response"]) @@ -415,6 +421,7 @@ def test_method_run_with_all_params(self, client: Anthropic) -> None: deployment = client.beta.deployments.run( deployment_id="depl_011CZkZcDH3vPqd7xnEfwTai", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeploymentRun, deployment, path=["response"]) @@ -461,6 +468,7 @@ def test_method_unpause_with_all_params(self, client: Anthropic) -> None: deployment = client.beta.deployments.unpause( deployment_id="depl_011CZkZcDH3vPqd7xnEfwTai", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeployment, deployment, path=["response"]) @@ -561,6 +569,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) }, vault_ids=["string"], betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeployment, deployment, path=["response"]) @@ -628,6 +637,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi deployment = await async_client.beta.deployments.retrieve( deployment_id="depl_011CZkZcDH3vPqd7xnEfwTai", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeployment, deployment, path=["response"]) @@ -713,6 +723,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAnthropic) }, vault_ids=["string"], betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeployment, deployment, path=["response"]) @@ -765,6 +776,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - page="page", status="active", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsDeployment], deployment, path=["response"]) @@ -802,6 +814,7 @@ async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic deployment = await async_client.beta.deployments.archive( deployment_id="depl_011CZkZcDH3vPqd7xnEfwTai", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeployment, deployment, path=["response"]) @@ -848,6 +861,7 @@ async def test_method_pause_with_all_params(self, async_client: AsyncAnthropic) deployment = await async_client.beta.deployments.pause( deployment_id="depl_011CZkZcDH3vPqd7xnEfwTai", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeployment, deployment, path=["response"]) @@ -894,6 +908,7 @@ async def test_method_run_with_all_params(self, async_client: AsyncAnthropic) -> deployment = await async_client.beta.deployments.run( deployment_id="depl_011CZkZcDH3vPqd7xnEfwTai", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeploymentRun, deployment, path=["response"]) @@ -940,6 +955,7 @@ async def test_method_unpause_with_all_params(self, async_client: AsyncAnthropic deployment = await async_client.beta.deployments.unpause( deployment_id="depl_011CZkZcDH3vPqd7xnEfwTai", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeployment, deployment, path=["response"]) diff --git a/tests/api_resources/beta/test_dreams.py b/tests/api_resources/beta/test_dreams.py index c5b9eb1a1..1abf06ca6 100644 --- a/tests/api_resources/beta/test_dreams.py +++ b/tests/api_resources/beta/test_dreams.py @@ -45,6 +45,7 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: instructions="x", output_behavior={"type": "create_new"}, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDream, dream, path=["response"]) @@ -96,6 +97,7 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: dream = client.beta.dreams.retrieve( dream_id="dream_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDream, dream, path=["response"]) @@ -145,6 +147,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: page="page", statuses=["pending"], betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaDream], dream, path=["response"]) @@ -180,6 +183,7 @@ def test_method_archive_with_all_params(self, client: Anthropic) -> None: dream = client.beta.dreams.archive( dream_id="dream_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDream, dream, path=["response"]) @@ -226,6 +230,7 @@ def test_method_cancel_with_all_params(self, client: Anthropic) -> None: dream = client.beta.dreams.cancel( dream_id="dream_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDream, dream, path=["response"]) @@ -292,6 +297,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) instructions="x", output_behavior={"type": "create_new"}, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDream, dream, path=["response"]) @@ -343,6 +349,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi dream = await async_client.beta.dreams.retrieve( dream_id="dream_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDream, dream, path=["response"]) @@ -392,6 +399,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - page="page", statuses=["pending"], betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaDream], dream, path=["response"]) @@ -427,6 +435,7 @@ async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic dream = await async_client.beta.dreams.archive( dream_id="dream_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDream, dream, path=["response"]) @@ -473,6 +482,7 @@ async def test_method_cancel_with_all_params(self, async_client: AsyncAnthropic) dream = await async_client.beta.dreams.cancel( dream_id="dream_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDream, dream, path=["response"]) diff --git a/tests/api_resources/beta/test_environments.py b/tests/api_resources/beta/test_environments.py index c2559b6f7..97618ebee 100644 --- a/tests/api_resources/beta/test_environments.py +++ b/tests/api_resources/beta/test_environments.py @@ -53,7 +53,8 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: description="Python environment with data-analysis packages.", metadata={"foo": "string"}, scope="organization", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaEnvironment, environment, path=["response"]) @@ -92,7 +93,8 @@ def test_method_retrieve(self, client: Anthropic) -> None: def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: environment = client.beta.environments.retrieve( environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaEnvironment, environment, path=["response"]) @@ -160,7 +162,8 @@ def test_method_update_with_all_params(self, client: Anthropic) -> None: metadata={"foo": "string"}, name="x", scope="organization", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaEnvironment, environment, path=["response"]) @@ -206,7 +209,8 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: include_archived=True, limit=1, page="page", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaEnvironment], environment, path=["response"]) @@ -241,7 +245,8 @@ def test_method_delete(self, client: Anthropic) -> None: def test_method_delete_with_all_params(self, client: Anthropic) -> None: environment = client.beta.environments.delete( environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaEnvironmentDeleteResponse, environment, path=["response"]) @@ -287,7 +292,8 @@ def test_method_archive(self, client: Anthropic) -> None: def test_method_archive_with_all_params(self, client: Anthropic) -> None: environment = client.beta.environments.archive( environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaEnvironment, environment, path=["response"]) @@ -360,7 +366,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) description="Python environment with data-analysis packages.", metadata={"foo": "string"}, scope="organization", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaEnvironment, environment, path=["response"]) @@ -399,7 +406,8 @@ async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None: async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None: environment = await async_client.beta.environments.retrieve( environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaEnvironment, environment, path=["response"]) @@ -467,7 +475,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncAnthropic) metadata={"foo": "string"}, name="x", scope="organization", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaEnvironment, environment, path=["response"]) @@ -513,7 +522,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - include_archived=True, limit=1, page="page", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaEnvironment], environment, path=["response"]) @@ -548,7 +558,8 @@ async def test_method_delete(self, async_client: AsyncAnthropic) -> None: async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) -> None: environment = await async_client.beta.environments.delete( environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaEnvironmentDeleteResponse, environment, path=["response"]) @@ -594,7 +605,8 @@ async def test_method_archive(self, async_client: AsyncAnthropic) -> None: async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic) -> None: environment = await async_client.beta.environments.archive( environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaEnvironment, environment, path=["response"]) diff --git a/tests/api_resources/beta/test_files.py b/tests/api_resources/beta/test_files.py index a5e48b2bc..5c51d6822 100644 --- a/tests/api_resources/beta/test_files.py +++ b/tests/api_resources/beta/test_files.py @@ -38,7 +38,8 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: limit=1, page="page", scope_id="scope_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaFileMetadata], file, path=["response"]) @@ -73,7 +74,8 @@ def test_method_delete(self, client: Anthropic) -> None: def test_method_delete_with_all_params(self, client: Anthropic) -> None: file = client.beta.files.delete( file_id="file_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDeletedFile, file, path=["response"]) @@ -130,7 +132,8 @@ def test_method_download_with_all_params(self, client: Anthropic, respx_mock: Mo ) file = client.beta.files.download( file_id="file_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert file.is_closed assert file.json() == {"foo": "bar"} @@ -190,7 +193,8 @@ def test_method_retrieve_metadata(self, client: Anthropic) -> None: def test_method_retrieve_metadata_with_all_params(self, client: Anthropic) -> None: file = client.beta.files.retrieve_metadata( file_id="file_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaFileMetadata, file, path=["response"]) @@ -237,7 +241,8 @@ def test_method_upload_with_all_params(self, client: Anthropic) -> None: file = client.beta.files.upload( file=b"Example data", expires_in_seconds=3600, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaFileMetadata, file, path=["response"]) @@ -283,7 +288,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - limit=1, page="page", scope_id="scope_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaFileMetadata], file, path=["response"]) @@ -318,7 +324,8 @@ async def test_method_delete(self, async_client: AsyncAnthropic) -> None: async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) -> None: file = await async_client.beta.files.delete( file_id="file_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDeletedFile, file, path=["response"]) @@ -375,7 +382,8 @@ async def test_method_download_with_all_params(self, async_client: AsyncAnthropi ) file = await async_client.beta.files.download( file_id="file_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert file.is_closed assert await file.json() == {"foo": "bar"} @@ -435,7 +443,8 @@ async def test_method_retrieve_metadata(self, async_client: AsyncAnthropic) -> N async def test_method_retrieve_metadata_with_all_params(self, async_client: AsyncAnthropic) -> None: file = await async_client.beta.files.retrieve_metadata( file_id="file_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaFileMetadata, file, path=["response"]) @@ -482,7 +491,8 @@ async def test_method_upload_with_all_params(self, async_client: AsyncAnthropic) file = await async_client.beta.files.upload( file=b"Example data", expires_in_seconds=3600, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaFileMetadata, file, path=["response"]) diff --git a/tests/api_resources/beta/test_memory_stores.py b/tests/api_resources/beta/test_memory_stores.py index 109a4afe5..47dfb10bf 100644 --- a/tests/api_resources/beta/test_memory_stores.py +++ b/tests/api_resources/beta/test_memory_stores.py @@ -36,6 +36,7 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: description="description", metadata={"foo": "string"}, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemoryStore, memory_store, path=["response"]) @@ -75,6 +76,7 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: memory_store = client.beta.memory_stores.retrieve( memory_store_id="memory_store_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemoryStore, memory_store, path=["response"]) @@ -124,6 +126,7 @@ def test_method_update_with_all_params(self, client: Anthropic) -> None: metadata={"foo": "string"}, name="x", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemoryStore, memory_store, path=["response"]) @@ -174,6 +177,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: limit=0, page="page", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsMemoryStore], memory_store, path=["response"]) @@ -211,6 +215,7 @@ def test_method_delete_with_all_params(self, client: Anthropic) -> None: memory_store = client.beta.memory_stores.delete( memory_store_id="memory_store_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeletedMemoryStore, memory_store, path=["response"]) @@ -257,6 +262,7 @@ def test_method_archive_with_all_params(self, client: Anthropic) -> None: memory_store = client.beta.memory_stores.archive( memory_store_id="memory_store_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemoryStore, memory_store, path=["response"]) @@ -311,6 +317,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) description="description", metadata={"foo": "string"}, betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemoryStore, memory_store, path=["response"]) @@ -350,6 +357,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi memory_store = await async_client.beta.memory_stores.retrieve( memory_store_id="memory_store_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemoryStore, memory_store, path=["response"]) @@ -399,6 +407,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAnthropic) metadata={"foo": "string"}, name="x", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemoryStore, memory_store, path=["response"]) @@ -449,6 +458,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - limit=0, page="page", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsMemoryStore], memory_store, path=["response"]) @@ -486,6 +496,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) memory_store = await async_client.beta.memory_stores.delete( memory_store_id="memory_store_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeletedMemoryStore, memory_store, path=["response"]) @@ -532,6 +543,7 @@ async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic memory_store = await async_client.beta.memory_stores.archive( memory_store_id="memory_store_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsMemoryStore, memory_store, path=["response"]) diff --git a/tests/api_resources/beta/test_messages.py b/tests/api_resources/beta/test_messages.py index 9e71c61d2..d699bacd2 100644 --- a/tests/api_resources/beta/test_messages.py +++ b/tests/api_resources/beta/test_messages.py @@ -170,6 +170,7 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No ], betas=["message-batches-2024-09-24"], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaMessage, message, path=["response"]) @@ -362,6 +363,7 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No ], betas=["message-batches-2024-09-24"], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) message_stream.response.close() @@ -533,6 +535,7 @@ def test_method_count_tokens_with_all_params(self, client: Anthropic) -> None: } ], betas=["string"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaMessageTokensCount, message, path=["response"]) @@ -728,6 +731,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn ], betas=["message-batches-2024-09-24"], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaMessage, message, path=["response"]) @@ -920,6 +924,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn ], betas=["message-batches-2024-09-24"], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) await message_stream.response.aclose() @@ -1092,6 +1097,7 @@ async def test_method_count_tokens_with_all_params(self, async_client: AsyncAnth ], betas=["string"], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaMessageTokensCount, message, path=["response"]) diff --git a/tests/api_resources/beta/test_models.py b/tests/api_resources/beta/test_models.py index fb0bb93f1..d53fcdd0b 100644 --- a/tests/api_resources/beta/test_models.py +++ b/tests/api_resources/beta/test_models.py @@ -29,7 +29,8 @@ def test_method_retrieve(self, client: Anthropic) -> None: def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: model = client.beta.models.retrieve( model_id="model_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaModelInfo, model, path=["response"]) @@ -75,7 +76,8 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: after_id="after_id", before_id="before_id", limit=1, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPage[BetaModelInfo], model, path=["response"]) @@ -116,7 +118,8 @@ async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None: async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None: model = await async_client.beta.models.retrieve( model_id="model_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaModelInfo, model, path=["response"]) @@ -162,7 +165,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - after_id="after_id", before_id="before_id", limit=1, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPage[BetaModelInfo], model, path=["response"]) diff --git a/tests/api_resources/beta/test_sessions.py b/tests/api_resources/beta/test_sessions.py index 46e6afc51..d82bb453a 100644 --- a/tests/api_resources/beta/test_sessions.py +++ b/tests/api_resources/beta/test_sessions.py @@ -63,7 +63,8 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: ], title="Order #1234 inquiry", vault_ids=["string"], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSession, session, path=["response"]) @@ -104,7 +105,8 @@ def test_method_retrieve(self, client: Anthropic) -> None: def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: session = client.beta.sessions.retrieve( session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSession, session, path=["response"]) @@ -186,7 +188,8 @@ def test_method_update_with_all_params(self, client: Anthropic) -> None: metadata={"foo": "string"}, title="Order #1234 inquiry", vault_ids=["string"], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSession, session, path=["response"]) @@ -244,7 +247,8 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: order="asc", page="page", statuses=["rescheduling"], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncBidirectionalPageCursor[BetaManagedAgentsSession], session, path=["response"]) @@ -281,7 +285,8 @@ def test_method_delete(self, client: Anthropic) -> None: def test_method_delete_with_all_params(self, client: Anthropic) -> None: session = client.beta.sessions.delete( session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeletedSession, session, path=["response"]) @@ -327,7 +332,8 @@ def test_method_archive(self, client: Anthropic) -> None: def test_method_archive_with_all_params(self, client: Anthropic) -> None: session = client.beta.sessions.archive( session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSession, session, path=["response"]) @@ -409,7 +415,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) ], title="Order #1234 inquiry", vault_ids=["string"], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSession, session, path=["response"]) @@ -450,7 +457,8 @@ async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None: async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None: session = await async_client.beta.sessions.retrieve( session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSession, session, path=["response"]) @@ -532,7 +540,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncAnthropic) metadata={"foo": "string"}, title="Order #1234 inquiry", vault_ids=["string"], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSession, session, path=["response"]) @@ -590,7 +599,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - order="asc", page="page", statuses=["rescheduling"], - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncBidirectionalPageCursor[BetaManagedAgentsSession], session, path=["response"]) @@ -627,7 +637,8 @@ async def test_method_delete(self, async_client: AsyncAnthropic) -> None: async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) -> None: session = await async_client.beta.sessions.delete( session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeletedSession, session, path=["response"]) @@ -673,7 +684,8 @@ async def test_method_archive(self, async_client: AsyncAnthropic) -> None: async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic) -> None: session = await async_client.beta.sessions.archive( session_id="sesn_011CZkZAtmR3yMPDzynEDxu7", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsSession, session, path=["response"]) diff --git a/tests/api_resources/beta/test_skills.py b/tests/api_resources/beta/test_skills.py index 113ecd5a7..629ad7c7d 100644 --- a/tests/api_resources/beta/test_skills.py +++ b/tests/api_resources/beta/test_skills.py @@ -30,7 +30,8 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: skill = client.beta.skills.create( files=[b"Example data"], display_name="display_name", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSkill, skill, path=["response"]) @@ -69,7 +70,8 @@ def test_method_retrieve(self, client: Anthropic) -> None: def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: skill = client.beta.skills.retrieve( skill_id="skill_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSkill, skill, path=["response"]) @@ -115,7 +117,8 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: limit=1, page="page", source="source", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaSkill], skill, path=["response"]) @@ -150,7 +153,8 @@ def test_method_delete(self, client: Anthropic) -> None: def test_method_delete_with_all_params(self, client: Anthropic) -> None: skill = client.beta.skills.delete( skill_id="skill_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDeletedSkill, skill, path=["response"]) @@ -203,7 +207,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) skill = await async_client.beta.skills.create( files=[b"Example data"], display_name="display_name", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSkill, skill, path=["response"]) @@ -242,7 +247,8 @@ async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None: async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None: skill = await async_client.beta.skills.retrieve( skill_id="skill_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaSkill, skill, path=["response"]) @@ -288,7 +294,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - limit=1, page="page", source="source", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaSkill], skill, path=["response"]) @@ -323,7 +330,8 @@ async def test_method_delete(self, async_client: AsyncAnthropic) -> None: async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) -> None: skill = await async_client.beta.skills.delete( skill_id="skill_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaDeletedSkill, skill, path=["response"]) diff --git a/tests/api_resources/beta/test_tunnels.py b/tests/api_resources/beta/test_tunnels.py index fe487ddd8..16fe0a3c7 100644 --- a/tests/api_resources/beta/test_tunnels.py +++ b/tests/api_resources/beta/test_tunnels.py @@ -31,6 +31,7 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: tunnel = client.beta.tunnels.create( display_name="x", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnel, tunnel, path=["response"]) @@ -68,6 +69,7 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: tunnel = client.beta.tunnels.retrieve( tunnel_id="tunnel_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnel, tunnel, path=["response"]) @@ -119,6 +121,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: limit=0, page="page", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaTunnel], tunnel, path=["response"]) @@ -156,6 +159,7 @@ def test_method_archive_with_all_params(self, client: Anthropic) -> None: tunnel = client.beta.tunnels.archive( tunnel_id="tunnel_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnel, tunnel, path=["response"]) @@ -202,6 +206,7 @@ def test_method_reveal_token_with_all_params(self, client: Anthropic) -> None: tunnel = client.beta.tunnels.reveal_token( tunnel_id="tunnel_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnelToken, tunnel, path=["response"]) @@ -249,6 +254,7 @@ def test_method_rotate_token_with_all_params(self, client: Anthropic) -> None: tunnel_id="tunnel_id", reason="reason", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnelToken, tunnel, path=["response"]) @@ -299,6 +305,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) tunnel = await async_client.beta.tunnels.create( display_name="x", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnel, tunnel, path=["response"]) @@ -336,6 +343,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi tunnel = await async_client.beta.tunnels.retrieve( tunnel_id="tunnel_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnel, tunnel, path=["response"]) @@ -387,6 +395,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - limit=0, page="page", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaTunnel], tunnel, path=["response"]) @@ -424,6 +433,7 @@ async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic tunnel = await async_client.beta.tunnels.archive( tunnel_id="tunnel_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnel, tunnel, path=["response"]) @@ -470,6 +480,7 @@ async def test_method_reveal_token_with_all_params(self, async_client: AsyncAnth tunnel = await async_client.beta.tunnels.reveal_token( tunnel_id="tunnel_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnelToken, tunnel, path=["response"]) @@ -517,6 +528,7 @@ async def test_method_rotate_token_with_all_params(self, async_client: AsyncAnth tunnel_id="tunnel_id", reason="reason", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnelToken, tunnel, path=["response"]) diff --git a/tests/api_resources/beta/test_vaults.py b/tests/api_resources/beta/test_vaults.py index d6dcaf0b5..fb9115f98 100644 --- a/tests/api_resources/beta/test_vaults.py +++ b/tests/api_resources/beta/test_vaults.py @@ -33,7 +33,8 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: vault = client.beta.vaults.create( display_name="Example vault", metadata={"environment": "production"}, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsVault, vault, path=["response"]) @@ -72,7 +73,8 @@ def test_method_retrieve(self, client: Anthropic) -> None: def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: vault = client.beta.vaults.retrieve( vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsVault, vault, path=["response"]) @@ -120,7 +122,8 @@ def test_method_update_with_all_params(self, client: Anthropic) -> None: vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", display_name="Example vault", metadata={"environment": "production"}, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsVault, vault, path=["response"]) @@ -168,7 +171,8 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: include_archived=True, limit=0, page="page", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsVault], vault, path=["response"]) @@ -205,7 +209,8 @@ def test_method_delete(self, client: Anthropic) -> None: def test_method_delete_with_all_params(self, client: Anthropic) -> None: vault = client.beta.vaults.delete( vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeletedVault, vault, path=["response"]) @@ -251,7 +256,8 @@ def test_method_archive(self, client: Anthropic) -> None: def test_method_archive_with_all_params(self, client: Anthropic) -> None: vault = client.beta.vaults.archive( vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsVault, vault, path=["response"]) @@ -304,7 +310,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) vault = await async_client.beta.vaults.create( display_name="Example vault", metadata={"environment": "production"}, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsVault, vault, path=["response"]) @@ -343,7 +350,8 @@ async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None: async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None: vault = await async_client.beta.vaults.retrieve( vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsVault, vault, path=["response"]) @@ -391,7 +399,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncAnthropic) vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", display_name="Example vault", metadata={"environment": "production"}, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsVault, vault, path=["response"]) @@ -439,7 +448,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - include_archived=True, limit=0, page="page", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsVault], vault, path=["response"]) @@ -476,7 +486,8 @@ async def test_method_delete(self, async_client: AsyncAnthropic) -> None: async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) -> None: vault = await async_client.beta.vaults.delete( vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeletedVault, vault, path=["response"]) @@ -522,7 +533,8 @@ async def test_method_archive(self, async_client: AsyncAnthropic) -> None: async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic) -> None: vault = await async_client.beta.vaults.archive( vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsVault, vault, path=["response"]) diff --git a/tests/api_resources/beta/tunnels/test_certificates.py b/tests/api_resources/beta/tunnels/test_certificates.py index 5b5e582c0..d95055bd5 100644 --- a/tests/api_resources/beta/tunnels/test_certificates.py +++ b/tests/api_resources/beta/tunnels/test_certificates.py @@ -32,6 +32,7 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: tunnel_id="tunnel_id", ca_certificate_pem="ca_certificate_pem", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) @@ -85,6 +86,7 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: certificate_id="certificate_id", tunnel_id="tunnel_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) @@ -148,6 +150,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: limit=0, page="page", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaTunnelCertificate], certificate, path=["response"]) @@ -199,6 +202,7 @@ def test_method_archive_with_all_params(self, client: Anthropic) -> None: certificate_id="certificate_id", tunnel_id="tunnel_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) @@ -262,6 +266,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) tunnel_id="tunnel_id", ca_certificate_pem="ca_certificate_pem", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) @@ -315,6 +320,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi certificate_id="certificate_id", tunnel_id="tunnel_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) @@ -378,6 +384,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - limit=0, page="page", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaTunnelCertificate], certificate, path=["response"]) @@ -429,6 +436,7 @@ async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic certificate_id="certificate_id", tunnel_id="tunnel_id", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) diff --git a/tests/api_resources/beta/vaults/test_credentials.py b/tests/api_resources/beta/vaults/test_credentials.py index 7048cd5cc..5192e8b0c 100644 --- a/tests/api_resources/beta/vaults/test_credentials.py +++ b/tests/api_resources/beta/vaults/test_credentials.py @@ -46,7 +46,8 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: }, display_name="Example credential", metadata={"environment": "production"}, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsCredential, credential, path=["response"]) @@ -109,7 +110,8 @@ def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: credential = client.beta.vaults.credentials.retrieve( credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsCredential, credential, path=["response"]) @@ -181,7 +183,8 @@ def test_method_update_with_all_params(self, client: Anthropic) -> None: }, display_name="Example credential", metadata={"environment": "production"}, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsCredential, credential, path=["response"]) @@ -241,7 +244,8 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: include_archived=True, limit=0, page="page", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[BetaManagedAgentsCredential], credential, path=["response"]) @@ -292,7 +296,8 @@ def test_method_delete_with_all_params(self, client: Anthropic) -> None: credential = client.beta.vaults.credentials.delete( credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeletedCredential, credential, path=["response"]) @@ -349,7 +354,8 @@ def test_method_archive_with_all_params(self, client: Anthropic) -> None: credential = client.beta.vaults.credentials.archive( credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsCredential, credential, path=["response"]) @@ -409,6 +415,7 @@ def test_method_mcp_oauth_validate_with_all_params(self, client: Anthropic) -> N credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsCredentialValidation, credential, path=["response"]) @@ -484,7 +491,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) }, display_name="Example credential", metadata={"environment": "production"}, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsCredential, credential, path=["response"]) @@ -547,7 +555,8 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropi credential = await async_client.beta.vaults.credentials.retrieve( credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsCredential, credential, path=["response"]) @@ -619,7 +628,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncAnthropic) }, display_name="Example credential", metadata={"environment": "production"}, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsCredential, credential, path=["response"]) @@ -679,7 +689,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - include_archived=True, limit=0, page="page", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[BetaManagedAgentsCredential], credential, path=["response"]) @@ -730,7 +741,8 @@ async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) credential = await async_client.beta.vaults.credentials.delete( credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsDeletedCredential, credential, path=["response"]) @@ -787,7 +799,8 @@ async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic credential = await async_client.beta.vaults.credentials.archive( credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsCredential, credential, path=["response"]) @@ -847,6 +860,7 @@ async def test_method_mcp_oauth_validate_with_all_params(self, async_client: Asy credential_id="vcrd_011CZkZEMt8gZan2iYOQfSkw", vault_id="vlt_011CZkZDLs7fYzm1hXNPeRjv", betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(BetaManagedAgentsCredentialValidation, credential, path=["response"]) diff --git a/tests/api_resources/messages/test_batches.py b/tests/api_resources/messages/test_batches.py index 219f09fcf..0292f884e 100644 --- a/tests/api_resources/messages/test_batches.py +++ b/tests/api_resources/messages/test_batches.py @@ -142,6 +142,7 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: } ], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(MessageBatch, batch, path=["response"]) @@ -200,14 +201,22 @@ def test_streaming_response_create(self, client: Anthropic) -> None: @parametrize def test_method_retrieve(self, client: Anthropic) -> None: batch = client.messages.batches.retrieve( - "message_batch_id", + message_batch_id="message_batch_id", + ) + assert_matches_type(MessageBatch, batch, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: + batch = client.messages.batches.retrieve( + message_batch_id="message_batch_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(MessageBatch, batch, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Anthropic) -> None: response = client.messages.batches.with_raw_response.retrieve( - "message_batch_id", + message_batch_id="message_batch_id", ) assert response.is_closed is True @@ -218,7 +227,7 @@ def test_raw_response_retrieve(self, client: Anthropic) -> None: @parametrize def test_streaming_response_retrieve(self, client: Anthropic) -> None: with client.messages.batches.with_streaming_response.retrieve( - "message_batch_id", + message_batch_id="message_batch_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -232,7 +241,7 @@ def test_streaming_response_retrieve(self, client: Anthropic) -> None: def test_path_params_retrieve(self, client: Anthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_batch_id` but received ''"): client.messages.batches.with_raw_response.retrieve( - "", + message_batch_id="", ) @parametrize @@ -246,6 +255,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: after_id="after_id", before_id="before_id", limit=1, + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPage[MessageBatch], batch, path=["response"]) @@ -272,14 +282,22 @@ def test_streaming_response_list(self, client: Anthropic) -> None: @parametrize def test_method_delete(self, client: Anthropic) -> None: batch = client.messages.batches.delete( - "message_batch_id", + message_batch_id="message_batch_id", + ) + assert_matches_type(DeletedMessageBatch, batch, path=["response"]) + + @parametrize + def test_method_delete_with_all_params(self, client: Anthropic) -> None: + batch = client.messages.batches.delete( + message_batch_id="message_batch_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(DeletedMessageBatch, batch, path=["response"]) @parametrize def test_raw_response_delete(self, client: Anthropic) -> None: response = client.messages.batches.with_raw_response.delete( - "message_batch_id", + message_batch_id="message_batch_id", ) assert response.is_closed is True @@ -290,7 +308,7 @@ def test_raw_response_delete(self, client: Anthropic) -> None: @parametrize def test_streaming_response_delete(self, client: Anthropic) -> None: with client.messages.batches.with_streaming_response.delete( - "message_batch_id", + message_batch_id="message_batch_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -304,20 +322,28 @@ def test_streaming_response_delete(self, client: Anthropic) -> None: def test_path_params_delete(self, client: Anthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_batch_id` but received ''"): client.messages.batches.with_raw_response.delete( - "", + message_batch_id="", ) @parametrize def test_method_cancel(self, client: Anthropic) -> None: batch = client.messages.batches.cancel( - "message_batch_id", + message_batch_id="message_batch_id", + ) + assert_matches_type(MessageBatch, batch, path=["response"]) + + @parametrize + def test_method_cancel_with_all_params(self, client: Anthropic) -> None: + batch = client.messages.batches.cancel( + message_batch_id="message_batch_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(MessageBatch, batch, path=["response"]) @parametrize def test_raw_response_cancel(self, client: Anthropic) -> None: response = client.messages.batches.with_raw_response.cancel( - "message_batch_id", + message_batch_id="message_batch_id", ) assert response.is_closed is True @@ -328,7 +354,7 @@ def test_raw_response_cancel(self, client: Anthropic) -> None: @parametrize def test_streaming_response_cancel(self, client: Anthropic) -> None: with client.messages.batches.with_streaming_response.cancel( - "message_batch_id", + message_batch_id="message_batch_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -342,7 +368,7 @@ def test_streaming_response_cancel(self, client: Anthropic) -> None: def test_path_params_cancel(self, client: Anthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_batch_id` but received ''"): client.messages.batches.with_raw_response.cancel( - "", + message_batch_id="", ) @pytest.mark.respx(base_url=base_url) @@ -379,7 +405,7 @@ def test_method_results(self, client: Anthropic, respx_mock: MockRouter) -> None @pytest.mark.skip(reason="somehow hitting prod endpoint") def test_raw_response_results(self, client: Anthropic) -> None: response = client.messages.batches.with_raw_response.results( - "message_batch_id", + message_batch_id="message_batch_id", ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -391,7 +417,7 @@ def test_raw_response_results(self, client: Anthropic) -> None: @pytest.mark.skip(reason="somehow hitting prod endpoint") def test_streaming_response_results(self, client: Anthropic) -> None: with client.messages.batches.with_streaming_response.results( - "message_batch_id", + message_batch_id="message_batch_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -406,7 +432,7 @@ def test_streaming_response_results(self, client: Anthropic) -> None: def test_path_params_results(self, client: Anthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_batch_id` but received ''"): client.messages.batches.with_raw_response.results( - "", + message_batch_id="", ) @@ -533,6 +559,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) } ], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(MessageBatch, batch, path=["response"]) @@ -591,14 +618,22 @@ async def test_streaming_response_create(self, async_client: AsyncAnthropic) -> @parametrize async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None: batch = await async_client.messages.batches.retrieve( - "message_batch_id", + message_batch_id="message_batch_id", + ) + assert_matches_type(MessageBatch, batch, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None: + batch = await async_client.messages.batches.retrieve( + message_batch_id="message_batch_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(MessageBatch, batch, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncAnthropic) -> None: response = await async_client.messages.batches.with_raw_response.retrieve( - "message_batch_id", + message_batch_id="message_batch_id", ) assert response.is_closed is True @@ -609,7 +644,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncAnthropic) -> None @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncAnthropic) -> None: async with async_client.messages.batches.with_streaming_response.retrieve( - "message_batch_id", + message_batch_id="message_batch_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -623,7 +658,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncAnthropic) - async def test_path_params_retrieve(self, async_client: AsyncAnthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_batch_id` but received ''"): await async_client.messages.batches.with_raw_response.retrieve( - "", + message_batch_id="", ) @parametrize @@ -637,6 +672,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - after_id="after_id", before_id="before_id", limit=1, + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPage[MessageBatch], batch, path=["response"]) @@ -663,14 +699,22 @@ async def test_streaming_response_list(self, async_client: AsyncAnthropic) -> No @parametrize async def test_method_delete(self, async_client: AsyncAnthropic) -> None: batch = await async_client.messages.batches.delete( - "message_batch_id", + message_batch_id="message_batch_id", + ) + assert_matches_type(DeletedMessageBatch, batch, path=["response"]) + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) -> None: + batch = await async_client.messages.batches.delete( + message_batch_id="message_batch_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(DeletedMessageBatch, batch, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncAnthropic) -> None: response = await async_client.messages.batches.with_raw_response.delete( - "message_batch_id", + message_batch_id="message_batch_id", ) assert response.is_closed is True @@ -681,7 +725,7 @@ async def test_raw_response_delete(self, async_client: AsyncAnthropic) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncAnthropic) -> None: async with async_client.messages.batches.with_streaming_response.delete( - "message_batch_id", + message_batch_id="message_batch_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -695,20 +739,28 @@ async def test_streaming_response_delete(self, async_client: AsyncAnthropic) -> async def test_path_params_delete(self, async_client: AsyncAnthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_batch_id` but received ''"): await async_client.messages.batches.with_raw_response.delete( - "", + message_batch_id="", ) @parametrize async def test_method_cancel(self, async_client: AsyncAnthropic) -> None: batch = await async_client.messages.batches.cancel( - "message_batch_id", + message_batch_id="message_batch_id", + ) + assert_matches_type(MessageBatch, batch, path=["response"]) + + @parametrize + async def test_method_cancel_with_all_params(self, async_client: AsyncAnthropic) -> None: + batch = await async_client.messages.batches.cancel( + message_batch_id="message_batch_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(MessageBatch, batch, path=["response"]) @parametrize async def test_raw_response_cancel(self, async_client: AsyncAnthropic) -> None: response = await async_client.messages.batches.with_raw_response.cancel( - "message_batch_id", + message_batch_id="message_batch_id", ) assert response.is_closed is True @@ -719,7 +771,7 @@ async def test_raw_response_cancel(self, async_client: AsyncAnthropic) -> None: @parametrize async def test_streaming_response_cancel(self, async_client: AsyncAnthropic) -> None: async with async_client.messages.batches.with_streaming_response.cancel( - "message_batch_id", + message_batch_id="message_batch_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -733,7 +785,7 @@ async def test_streaming_response_cancel(self, async_client: AsyncAnthropic) -> async def test_path_params_cancel(self, async_client: AsyncAnthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_batch_id` but received ''"): await async_client.messages.batches.with_raw_response.cancel( - "", + message_batch_id="", ) @pytest.mark.respx(base_url=base_url) @@ -770,7 +822,7 @@ async def test_method_results(self, async_client: AsyncAnthropic, respx_mock: Mo @pytest.mark.skip(reason="somehow hitting prod endpoint") async def test_raw_response_results(self, async_client: AsyncAnthropic) -> None: response = await async_client.messages.batches.with_raw_response.results( - "message_batch_id", + message_batch_id="message_batch_id", ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -782,7 +834,7 @@ async def test_raw_response_results(self, async_client: AsyncAnthropic) -> None: @pytest.mark.skip(reason="somehow hitting prod endpoint") async def test_streaming_response_results(self, async_client: AsyncAnthropic) -> None: async with async_client.messages.batches.with_streaming_response.results( - "message_batch_id", + message_batch_id="message_batch_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -797,5 +849,5 @@ async def test_streaming_response_results(self, async_client: AsyncAnthropic) -> async def test_path_params_results(self, async_client: AsyncAnthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_batch_id` but received ''"): await async_client.messages.batches.with_raw_response.results( - "", + message_batch_id="", ) diff --git a/tests/api_resources/skills/test_versions.py b/tests/api_resources/skills/test_versions.py index 86d58f3a6..f08f4f43d 100644 --- a/tests/api_resources/skills/test_versions.py +++ b/tests/api_resources/skills/test_versions.py @@ -26,6 +26,15 @@ def test_method_create(self, client: Anthropic) -> None: ) assert_matches_type(SkillVersion, version, path=["response"]) + @parametrize + def test_method_create_with_all_params(self, client: Anthropic) -> None: + version = client.skills.versions.create( + skill_id="skill_id", + files=[b"Example data"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", + ) + assert_matches_type(SkillVersion, version, path=["response"]) + @parametrize def test_raw_response_create(self, client: Anthropic) -> None: response = client.skills.versions.with_raw_response.create( @@ -68,6 +77,15 @@ def test_method_retrieve(self, client: Anthropic) -> None: ) assert_matches_type(SkillVersion, version, path=["response"]) + @parametrize + def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: + version = client.skills.versions.retrieve( + version="version", + skill_id="skill_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", + ) + assert_matches_type(SkillVersion, version, path=["response"]) + @parametrize def test_raw_response_retrieve(self, client: Anthropic) -> None: response = client.skills.versions.with_raw_response.retrieve( @@ -121,6 +139,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: skill_id="skill_id", limit=1, page="page", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[SkillVersion], version, path=["response"]) @@ -163,6 +182,15 @@ def test_method_delete(self, client: Anthropic) -> None: ) assert_matches_type(DeletedSkillVersion, version, path=["response"]) + @parametrize + def test_method_delete_with_all_params(self, client: Anthropic) -> None: + version = client.skills.versions.delete( + version="version", + skill_id="skill_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", + ) + assert_matches_type(DeletedSkillVersion, version, path=["response"]) + @parametrize def test_raw_response_delete(self, client: Anthropic) -> None: response = client.skills.versions.with_raw_response.delete( @@ -217,6 +245,15 @@ async def test_method_create(self, async_client: AsyncAnthropic) -> None: ) assert_matches_type(SkillVersion, version, path=["response"]) + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) -> None: + version = await async_client.skills.versions.create( + skill_id="skill_id", + files=[b"Example data"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", + ) + assert_matches_type(SkillVersion, version, path=["response"]) + @parametrize async def test_raw_response_create(self, async_client: AsyncAnthropic) -> None: response = await async_client.skills.versions.with_raw_response.create( @@ -259,6 +296,15 @@ async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None: ) assert_matches_type(SkillVersion, version, path=["response"]) + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None: + version = await async_client.skills.versions.retrieve( + version="version", + skill_id="skill_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", + ) + assert_matches_type(SkillVersion, version, path=["response"]) + @parametrize async def test_raw_response_retrieve(self, async_client: AsyncAnthropic) -> None: response = await async_client.skills.versions.with_raw_response.retrieve( @@ -312,6 +358,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - skill_id="skill_id", limit=1, page="page", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[SkillVersion], version, path=["response"]) @@ -354,6 +401,15 @@ async def test_method_delete(self, async_client: AsyncAnthropic) -> None: ) assert_matches_type(DeletedSkillVersion, version, path=["response"]) + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) -> None: + version = await async_client.skills.versions.delete( + version="version", + skill_id="skill_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", + ) + assert_matches_type(DeletedSkillVersion, version, path=["response"]) + @parametrize async def test_raw_response_delete(self, async_client: AsyncAnthropic) -> None: response = await async_client.skills.versions.with_raw_response.delete( diff --git a/tests/api_resources/test_files.py b/tests/api_resources/test_files.py index da4eac580..29e916969 100644 --- a/tests/api_resources/test_files.py +++ b/tests/api_resources/test_files.py @@ -37,6 +37,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: ids=["string"], limit=1, page="page", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[FileMetadata], file, path=["response"]) @@ -63,14 +64,22 @@ def test_streaming_response_list(self, client: Anthropic) -> None: @parametrize def test_method_delete(self, client: Anthropic) -> None: file = client.files.delete( - "file_id", + file_id="file_id", + ) + assert_matches_type(DeletedFile, file, path=["response"]) + + @parametrize + def test_method_delete_with_all_params(self, client: Anthropic) -> None: + file = client.files.delete( + file_id="file_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(DeletedFile, file, path=["response"]) @parametrize def test_raw_response_delete(self, client: Anthropic) -> None: response = client.files.with_raw_response.delete( - "file_id", + file_id="file_id", ) assert response.is_closed is True @@ -81,7 +90,7 @@ def test_raw_response_delete(self, client: Anthropic) -> None: @parametrize def test_streaming_response_delete(self, client: Anthropic) -> None: with client.files.with_streaming_response.delete( - "file_id", + file_id="file_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -95,7 +104,7 @@ def test_streaming_response_delete(self, client: Anthropic) -> None: def test_path_params_delete(self, client: Anthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): client.files.with_raw_response.delete( - "", + file_id="", ) @parametrize @@ -103,7 +112,20 @@ def test_path_params_delete(self, client: Anthropic) -> None: def test_method_download(self, client: Anthropic, respx_mock: MockRouter) -> None: respx_mock.get("/v1/files/file_id/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) file = client.files.download( - "file_id", + file_id="file_id", + ) + assert file.is_closed + assert file.json() == {"foo": "bar"} + assert cast(Any, file.is_closed) is True + assert isinstance(file, BinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_method_download_with_all_params(self, client: Anthropic, respx_mock: MockRouter) -> None: + respx_mock.get("/v1/files/file_id/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) + file = client.files.download( + file_id="file_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert file.is_closed assert file.json() == {"foo": "bar"} @@ -116,7 +138,7 @@ def test_raw_response_download(self, client: Anthropic, respx_mock: MockRouter) respx_mock.get("/v1/files/file_id/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) file = client.files.with_raw_response.download( - "file_id", + file_id="file_id", ) assert file.is_closed is True @@ -129,7 +151,7 @@ def test_raw_response_download(self, client: Anthropic, respx_mock: MockRouter) def test_streaming_response_download(self, client: Anthropic, respx_mock: MockRouter) -> None: respx_mock.get("/v1/files/file_id/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) with client.files.with_streaming_response.download( - "file_id", + file_id="file_id", ) as file: assert not file.is_closed assert file.http_request.headers.get("X-Stainless-Lang") == "python" @@ -145,20 +167,28 @@ def test_streaming_response_download(self, client: Anthropic, respx_mock: MockRo def test_path_params_download(self, client: Anthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): client.files.with_raw_response.download( - "", + file_id="", ) @parametrize def test_method_retrieve_metadata(self, client: Anthropic) -> None: file = client.files.retrieve_metadata( - "file_id", + file_id="file_id", + ) + assert_matches_type(FileMetadata, file, path=["response"]) + + @parametrize + def test_method_retrieve_metadata_with_all_params(self, client: Anthropic) -> None: + file = client.files.retrieve_metadata( + file_id="file_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(FileMetadata, file, path=["response"]) @parametrize def test_raw_response_retrieve_metadata(self, client: Anthropic) -> None: response = client.files.with_raw_response.retrieve_metadata( - "file_id", + file_id="file_id", ) assert response.is_closed is True @@ -169,7 +199,7 @@ def test_raw_response_retrieve_metadata(self, client: Anthropic) -> None: @parametrize def test_streaming_response_retrieve_metadata(self, client: Anthropic) -> None: with client.files.with_streaming_response.retrieve_metadata( - "file_id", + file_id="file_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -183,7 +213,7 @@ def test_streaming_response_retrieve_metadata(self, client: Anthropic) -> None: def test_path_params_retrieve_metadata(self, client: Anthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): client.files.with_raw_response.retrieve_metadata( - "", + file_id="", ) @parametrize @@ -198,6 +228,7 @@ def test_method_upload_with_all_params(self, client: Anthropic) -> None: file = client.files.upload( file=b"Example data", expires_in_seconds=3600, + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(FileMetadata, file, path=["response"]) @@ -242,6 +273,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - ids=["string"], limit=1, page="page", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[FileMetadata], file, path=["response"]) @@ -268,14 +300,22 @@ async def test_streaming_response_list(self, async_client: AsyncAnthropic) -> No @parametrize async def test_method_delete(self, async_client: AsyncAnthropic) -> None: file = await async_client.files.delete( - "file_id", + file_id="file_id", + ) + assert_matches_type(DeletedFile, file, path=["response"]) + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) -> None: + file = await async_client.files.delete( + file_id="file_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(DeletedFile, file, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncAnthropic) -> None: response = await async_client.files.with_raw_response.delete( - "file_id", + file_id="file_id", ) assert response.is_closed is True @@ -286,7 +326,7 @@ async def test_raw_response_delete(self, async_client: AsyncAnthropic) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncAnthropic) -> None: async with async_client.files.with_streaming_response.delete( - "file_id", + file_id="file_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -300,7 +340,7 @@ async def test_streaming_response_delete(self, async_client: AsyncAnthropic) -> async def test_path_params_delete(self, async_client: AsyncAnthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): await async_client.files.with_raw_response.delete( - "", + file_id="", ) @parametrize @@ -308,7 +348,20 @@ async def test_path_params_delete(self, async_client: AsyncAnthropic) -> None: async def test_method_download(self, async_client: AsyncAnthropic, respx_mock: MockRouter) -> None: respx_mock.get("/v1/files/file_id/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) file = await async_client.files.download( - "file_id", + file_id="file_id", + ) + assert file.is_closed + assert await file.json() == {"foo": "bar"} + assert cast(Any, file.is_closed) is True + assert isinstance(file, AsyncBinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_method_download_with_all_params(self, async_client: AsyncAnthropic, respx_mock: MockRouter) -> None: + respx_mock.get("/v1/files/file_id/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) + file = await async_client.files.download( + file_id="file_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert file.is_closed assert await file.json() == {"foo": "bar"} @@ -321,7 +374,7 @@ async def test_raw_response_download(self, async_client: AsyncAnthropic, respx_m respx_mock.get("/v1/files/file_id/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) file = await async_client.files.with_raw_response.download( - "file_id", + file_id="file_id", ) assert file.is_closed is True @@ -334,7 +387,7 @@ async def test_raw_response_download(self, async_client: AsyncAnthropic, respx_m async def test_streaming_response_download(self, async_client: AsyncAnthropic, respx_mock: MockRouter) -> None: respx_mock.get("/v1/files/file_id/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) async with async_client.files.with_streaming_response.download( - "file_id", + file_id="file_id", ) as file: assert not file.is_closed assert file.http_request.headers.get("X-Stainless-Lang") == "python" @@ -350,20 +403,28 @@ async def test_streaming_response_download(self, async_client: AsyncAnthropic, r async def test_path_params_download(self, async_client: AsyncAnthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): await async_client.files.with_raw_response.download( - "", + file_id="", ) @parametrize async def test_method_retrieve_metadata(self, async_client: AsyncAnthropic) -> None: file = await async_client.files.retrieve_metadata( - "file_id", + file_id="file_id", + ) + assert_matches_type(FileMetadata, file, path=["response"]) + + @parametrize + async def test_method_retrieve_metadata_with_all_params(self, async_client: AsyncAnthropic) -> None: + file = await async_client.files.retrieve_metadata( + file_id="file_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(FileMetadata, file, path=["response"]) @parametrize async def test_raw_response_retrieve_metadata(self, async_client: AsyncAnthropic) -> None: response = await async_client.files.with_raw_response.retrieve_metadata( - "file_id", + file_id="file_id", ) assert response.is_closed is True @@ -374,7 +435,7 @@ async def test_raw_response_retrieve_metadata(self, async_client: AsyncAnthropic @parametrize async def test_streaming_response_retrieve_metadata(self, async_client: AsyncAnthropic) -> None: async with async_client.files.with_streaming_response.retrieve_metadata( - "file_id", + file_id="file_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -388,7 +449,7 @@ async def test_streaming_response_retrieve_metadata(self, async_client: AsyncAnt async def test_path_params_retrieve_metadata(self, async_client: AsyncAnthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): await async_client.files.with_raw_response.retrieve_metadata( - "", + file_id="", ) @parametrize @@ -403,6 +464,7 @@ async def test_method_upload_with_all_params(self, async_client: AsyncAnthropic) file = await async_client.files.upload( file=b"Example data", expires_in_seconds=3600, + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(FileMetadata, file, path=["response"]) diff --git a/tests/api_resources/test_messages.py b/tests/api_resources/test_messages.py index ff4f542d5..0eede817e 100644 --- a/tests/api_resources/test_messages.py +++ b/tests/api_resources/test_messages.py @@ -125,6 +125,7 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No } ], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(Message, message, path=["response"]) @@ -271,6 +272,7 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No } ], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) message_stream.response.close() @@ -410,6 +412,7 @@ def test_method_count_tokens_with_all_params(self, client: Anthropic) -> None: } ], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(MessageTokensCount, message, path=["response"]) @@ -559,6 +562,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn } ], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(Message, message, path=["response"]) @@ -705,6 +709,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn } ], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) await message_stream.response.aclose() @@ -844,6 +849,7 @@ async def test_method_count_tokens_with_all_params(self, async_client: AsyncAnth } ], user_profile_id="anthropic-user-profile-id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(MessageTokensCount, message, path=["response"]) diff --git a/tests/api_resources/test_models.py b/tests/api_resources/test_models.py index 21c06e6ae..5c3a5c2c5 100644 --- a/tests/api_resources/test_models.py +++ b/tests/api_resources/test_models.py @@ -29,7 +29,8 @@ def test_method_retrieve(self, client: Anthropic) -> None: def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: model = client.models.retrieve( model_id="model_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(ModelInfo, model, path=["response"]) @@ -75,7 +76,8 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: after_id="after_id", before_id="before_id", limit=1, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPage[ModelInfo], model, path=["response"]) @@ -116,7 +118,8 @@ async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None: async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None: model = await async_client.models.retrieve( model_id="model_id", - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(ModelInfo, model, path=["response"]) @@ -162,7 +165,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - after_id="after_id", before_id="before_id", limit=1, - betas=["string"], + betas=["message-batches-2024-09-24"], + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPage[ModelInfo], model, path=["response"]) diff --git a/tests/api_resources/test_skills.py b/tests/api_resources/test_skills.py index edc585ba2..00382e2cb 100644 --- a/tests/api_resources/test_skills.py +++ b/tests/api_resources/test_skills.py @@ -30,6 +30,7 @@ def test_method_create_with_all_params(self, client: Anthropic) -> None: skill = client.skills.create( files=[b"Example data"], display_name="display_name", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(Skill, skill, path=["response"]) @@ -60,14 +61,22 @@ def test_streaming_response_create(self, client: Anthropic) -> None: @parametrize def test_method_retrieve(self, client: Anthropic) -> None: skill = client.skills.retrieve( - "skill_id", + skill_id="skill_id", + ) + assert_matches_type(Skill, skill, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: + skill = client.skills.retrieve( + skill_id="skill_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(Skill, skill, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Anthropic) -> None: response = client.skills.with_raw_response.retrieve( - "skill_id", + skill_id="skill_id", ) assert response.is_closed is True @@ -78,7 +87,7 @@ def test_raw_response_retrieve(self, client: Anthropic) -> None: @parametrize def test_streaming_response_retrieve(self, client: Anthropic) -> None: with client.skills.with_streaming_response.retrieve( - "skill_id", + skill_id="skill_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -92,7 +101,7 @@ def test_streaming_response_retrieve(self, client: Anthropic) -> None: def test_path_params_retrieve(self, client: Anthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `skill_id` but received ''"): client.skills.with_raw_response.retrieve( - "", + skill_id="", ) @parametrize @@ -106,6 +115,7 @@ def test_method_list_with_all_params(self, client: Anthropic) -> None: limit=1, page="page", source="source", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(SyncPageCursor[Skill], skill, path=["response"]) @@ -132,14 +142,22 @@ def test_streaming_response_list(self, client: Anthropic) -> None: @parametrize def test_method_delete(self, client: Anthropic) -> None: skill = client.skills.delete( - "skill_id", + skill_id="skill_id", + ) + assert_matches_type(DeletedSkill, skill, path=["response"]) + + @parametrize + def test_method_delete_with_all_params(self, client: Anthropic) -> None: + skill = client.skills.delete( + skill_id="skill_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(DeletedSkill, skill, path=["response"]) @parametrize def test_raw_response_delete(self, client: Anthropic) -> None: response = client.skills.with_raw_response.delete( - "skill_id", + skill_id="skill_id", ) assert response.is_closed is True @@ -150,7 +168,7 @@ def test_raw_response_delete(self, client: Anthropic) -> None: @parametrize def test_streaming_response_delete(self, client: Anthropic) -> None: with client.skills.with_streaming_response.delete( - "skill_id", + skill_id="skill_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -164,7 +182,7 @@ def test_streaming_response_delete(self, client: Anthropic) -> None: def test_path_params_delete(self, client: Anthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `skill_id` but received ''"): client.skills.with_raw_response.delete( - "", + skill_id="", ) @@ -185,6 +203,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) skill = await async_client.skills.create( files=[b"Example data"], display_name="display_name", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(Skill, skill, path=["response"]) @@ -215,14 +234,22 @@ async def test_streaming_response_create(self, async_client: AsyncAnthropic) -> @parametrize async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None: skill = await async_client.skills.retrieve( - "skill_id", + skill_id="skill_id", + ) + assert_matches_type(Skill, skill, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None: + skill = await async_client.skills.retrieve( + skill_id="skill_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(Skill, skill, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncAnthropic) -> None: response = await async_client.skills.with_raw_response.retrieve( - "skill_id", + skill_id="skill_id", ) assert response.is_closed is True @@ -233,7 +260,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncAnthropic) -> None @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncAnthropic) -> None: async with async_client.skills.with_streaming_response.retrieve( - "skill_id", + skill_id="skill_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -247,7 +274,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncAnthropic) - async def test_path_params_retrieve(self, async_client: AsyncAnthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `skill_id` but received ''"): await async_client.skills.with_raw_response.retrieve( - "", + skill_id="", ) @parametrize @@ -261,6 +288,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) - limit=1, page="page", source="source", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(AsyncPageCursor[Skill], skill, path=["response"]) @@ -287,14 +315,22 @@ async def test_streaming_response_list(self, async_client: AsyncAnthropic) -> No @parametrize async def test_method_delete(self, async_client: AsyncAnthropic) -> None: skill = await async_client.skills.delete( - "skill_id", + skill_id="skill_id", + ) + assert_matches_type(DeletedSkill, skill, path=["response"]) + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) -> None: + skill = await async_client.skills.delete( + skill_id="skill_id", + workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", ) assert_matches_type(DeletedSkill, skill, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncAnthropic) -> None: response = await async_client.skills.with_raw_response.delete( - "skill_id", + skill_id="skill_id", ) assert response.is_closed is True @@ -305,7 +341,7 @@ async def test_raw_response_delete(self, async_client: AsyncAnthropic) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncAnthropic) -> None: async with async_client.skills.with_streaming_response.delete( - "skill_id", + skill_id="skill_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -319,5 +355,5 @@ async def test_streaming_response_delete(self, async_client: AsyncAnthropic) -> async def test_path_params_delete(self, async_client: AsyncAnthropic) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `skill_id` but received ''"): await async_client.skills.with_raw_response.delete( - "", + skill_id="", ) From aa90b81a805202a098839712c8cb66e7d90968b2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 16:09:54 +0000 Subject: [PATCH 04/10] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6f37ca6c4..2d40835db 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 201 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-912199b1ed1eb56d611881c5323eb554b56187aa46d6da7f2a3cb51d12b193fd.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-a7b6dba9511514e58e6450084c9a1c7ed6c1ace0cfdcb0c975cf7f920633963a.yml openapi_spec_hash: 3914347dffe1c12ce191cfa2ed26738e -config_hash: f76dc225c5c58c929490ef8dd6e50111 +config_hash: debaa6e4dc87145b0e8c12c52ae59168 From 85454cab9a323801b76500707b84c1992c1c0ee4 Mon Sep 17 00:00:00 2001 From: dtmeadows-ant Date: Wed, 2 Sep 2026 12:58:27 -0400 Subject: [PATCH 05/10] fix: repair custom-code merge in messages resources (#580) --- src/anthropic/_client.py | 33 +++++++++++- .../resources/beta/messages/batches.py | 4 +- .../resources/beta/messages/messages.py | 18 +++++++ src/anthropic/resources/files.py | 4 +- src/anthropic/resources/messages/messages.py | 28 +++++----- tests/lib/test_aws.py | 53 ++++++++++++++++++- tests/lib/test_credentials.py | 39 +++++++++++++- 7 files changed, 157 insertions(+), 22 deletions(-) diff --git a/src/anthropic/_client.py b/src/anthropic/_client.py index 4c08054dc..d9f87a583 100644 --- a/src/anthropic/_client.py +++ b/src/anthropic/_client.py @@ -16,7 +16,8 @@ is_mapping_t, get_async_library, ) -from ._compat import cached_property +from ._compat import model_copy, cached_property +from ._models import FinalRequestOptions from ._version import __version__ from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import APIStatusError @@ -121,6 +122,28 @@ def _warn_env_shadow(*, api_key: str | None, auth_token: str | None) -> None: __all__ = ["Timeout", "RequestOptions", "Anthropic", "AsyncAnthropic", "Client", "AsyncClient"] +_CLIENT_LEVEL_HEADER_PARAMS = frozenset(("anthropic-workspace-id", "anthropic-user-profile-id")) + + +def _keep_client_header_params(options: FinalRequestOptions) -> FinalRequestOptions: + """Per-request header params arrive as `Omit` when unset, which would strip a value the + client itself sends (e.g. `AnthropicAWS(workspace_id=...)`, a credentials profile's + `workspace_id`, or `default_headers`). Drop those so the client-level header survives.""" + headers = options.headers + if not is_given(headers) or not any( + name.lower() in _CLIENT_LEVEL_HEADER_PARAMS and isinstance(value, Omit) for name, value in headers.items() + ): + return options + + options = model_copy(options) + options.headers = { + name: value + for name, value in headers.items() + if not (name.lower() in _CLIENT_LEVEL_HEADER_PARAMS and isinstance(value, Omit)) + } + return options + + class Anthropic(SyncAPIClient): # client options api_key: str | None @@ -359,6 +382,10 @@ def default_headers(self) -> dict[str, str | Omit]: **self._custom_headers, } + @override + def _prepare_options(self, options: FinalRequestOptions) -> FinalRequestOptions: + return _keep_client_header_params(super()._prepare_options(options)) + @override def _validate_headers(self, headers: httpx2.Headers, omitted: frozenset[str]) -> None: # --- credentials support (hand-written, upstream to Stainless) --- @@ -781,6 +808,10 @@ def default_headers(self) -> dict[str, str | Omit]: **self._custom_headers, } + @override + async def _prepare_options(self, options: FinalRequestOptions) -> FinalRequestOptions: + return _keep_client_header_params(await super()._prepare_options(options)) + @override def _validate_headers(self, headers: httpx2.Headers, omitted: frozenset[str]) -> None: # --- credentials support (hand-written, upstream to Stainless) --- diff --git a/src/anthropic/resources/beta/messages/batches.py b/src/anthropic/resources/beta/messages/batches.py index fe1b466b0..8b3f68980 100644 --- a/src/anthropic/resources/beta/messages/batches.py +++ b/src/anthropic/resources/beta/messages/batches.py @@ -409,7 +409,7 @@ def results( if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") - batch = self.retrieve(message_batch_id=message_batch_id) + batch = self.retrieve(message_batch_id=message_batch_id, workspace_id=workspace_id) if not batch.results_url: raise AnthropicError( f"No `results_url` for the given batch; Has it finished processing? {batch.processing_status}" @@ -817,7 +817,7 @@ async def results( if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") - batch = await self.retrieve(message_batch_id=message_batch_id) + batch = await self.retrieve(message_batch_id=message_batch_id, workspace_id=workspace_id) if not batch.results_url: raise AnthropicError( f"No `results_url` for the given batch; Has it finished processing? {batch.processing_status}" diff --git a/src/anthropic/resources/beta/messages/messages.py b/src/anthropic/resources/beta/messages/messages.py index b7a09c647..425e82915 100644 --- a/src/anthropic/resources/beta/messages/messages.py +++ b/src/anthropic/resources/beta/messages/messages.py @@ -1196,6 +1196,7 @@ def parse( tools: Iterable[BetaToolUnionParam] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1236,6 +1237,7 @@ def parse( { "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, } ), _stainless_helper_header(tools, messages), @@ -1343,6 +1345,7 @@ def tool_runner( tool_choice: BetaToolChoiceParam | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1380,6 +1383,7 @@ def tool_runner( tool_choice: BetaToolChoiceParam | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1417,6 +1421,7 @@ def tool_runner( tool_choice: BetaToolChoiceParam | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1453,6 +1458,7 @@ def tool_runner( tool_choice: BetaToolChoiceParam | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1490,6 +1496,7 @@ def tool_runner( { "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, } ), _stainless_helper_header(tools, messages), @@ -1584,6 +1591,7 @@ def stream( tools: Iterable[BetaToolUnionParam] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1617,6 +1625,7 @@ def stream( { "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, } ), _stainless_helper_header(tools, messages), @@ -3060,6 +3069,7 @@ async def parse( tools: Iterable[BetaToolUnionParam] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -3099,6 +3109,7 @@ async def parse( { "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, } ), _stainless_helper_header(tools, messages), @@ -3206,6 +3217,7 @@ def tool_runner( tool_choice: BetaToolChoiceParam | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -3243,6 +3255,7 @@ def tool_runner( tool_choice: BetaToolChoiceParam | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -3280,6 +3293,7 @@ def tool_runner( tool_choice: BetaToolChoiceParam | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -3316,6 +3330,7 @@ def tool_runner( tool_choice: BetaToolChoiceParam | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -3346,6 +3361,7 @@ def tool_runner( { "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, } ), _stainless_helper_header(tools, messages), @@ -3440,6 +3456,7 @@ def stream( tools: Iterable[BetaToolUnionParam] | Omit = omit, betas: List[AnthropicBetaParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -3472,6 +3489,7 @@ def stream( { "anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given, "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, } ), _stainless_helper_header(tools, messages), diff --git a/src/anthropic/resources/files.py b/src/anthropic/resources/files.py index b8c842f66..33079ed4c 100644 --- a/src/anthropic/resources/files.py +++ b/src/anthropic/resources/files.py @@ -262,6 +262,7 @@ def upload( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} + extra_headers = merge_headers(_stainless_helper_header_from_file(file), extra_headers or {}) body = deepcopy_with_paths( { "file": file, @@ -507,7 +508,8 @@ async def upload( timeout: Override the client-level default timeout for this request, in seconds """ - + extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} + extra_headers = merge_headers(_stainless_helper_header_from_file(file), extra_headers or {}) body = deepcopy_with_paths( { "file": file, diff --git a/src/anthropic/resources/messages/messages.py b/src/anthropic/resources/messages/messages.py index 09324068e..3eceed3b7 100644 --- a/src/anthropic/resources/messages/messages.py +++ b/src/anthropic/resources/messages/messages.py @@ -1028,6 +1028,7 @@ def stream( tool_choice: ToolChoiceParam | Omit = omit, tools: Iterable[ToolUnionParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1051,7 +1052,12 @@ def stream( ) extra_headers = { - **strip_not_given({"anthropic-user-profile-id": user_profile_id}), + **strip_not_given( + { + "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, + } + ), _STAINLESS_HELPER_METHOD_HEADER: _HELPER_METHOD_STREAM, _STAINLESS_STREAM_HELPER_HEADER: "messages", **(extra_headers or {}), @@ -1453,12 +1459,6 @@ def count_tokens( timeout: Override the client-level default timeout for this request, in seconds """ - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ extra_headers = { **strip_not_given( { @@ -2457,6 +2457,7 @@ def stream( tool_choice: ToolChoiceParam | Omit = omit, tools: Iterable[ToolUnionParam] | Omit = omit, user_profile_id: str | Omit = omit, + workspace_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2480,7 +2481,12 @@ def stream( ) extra_headers = { - **strip_not_given({"anthropic-user-profile-id": user_profile_id}), + **strip_not_given( + { + "anthropic-user-profile-id": user_profile_id, + "anthropic-workspace-id": workspace_id, + } + ), _STAINLESS_HELPER_METHOD_HEADER: _HELPER_METHOD_STREAM, _STAINLESS_STREAM_HELPER_HEADER: "messages", **(extra_headers or {}), @@ -2881,12 +2887,6 @@ async def count_tokens( timeout: Override the client-level default timeout for this request, in seconds """ - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ extra_headers = { **strip_not_given( { diff --git a/tests/lib/test_aws.py b/tests/lib/test_aws.py index 84091ce2b..4634f5bdd 100644 --- a/tests/lib/test_aws.py +++ b/tests/lib/test_aws.py @@ -1,13 +1,13 @@ import re import threading -from typing import Dict, List, Type, Union, cast +from typing import Dict, List, Type, Union, Optional, cast from typing_extensions import Protocol import httpx2 import pytest from respx import MockRouter -from anthropic import AnthropicAWS, AsyncAnthropicAWS +from anthropic import AnthropicAWS, AsyncAnthropicAWS, omit from anthropic._exceptions import AnthropicError from anthropic.lib.credentials import StaticToken @@ -443,6 +443,55 @@ async def test_api_key_request_async(respx_mock: MockRouter) -> None: assert calls[0].request.headers["X-Api-Key"] == "test-key" +@pytest.mark.filterwarnings("ignore::DeprecationWarning") +@pytest.mark.respx() +@pytest.mark.parametrize( + "request_workspace_id, expected", + [(None, "ws-client"), ("ws-request", "ws-request")], +) +def test_workspace_id_header(respx_mock: MockRouter, request_workspace_id: Optional[str], expected: str) -> None: + respx_mock.post(re.compile(r"https://aws-external-anthropic\.us-east-1\.api\.aws/.*")).mock( + return_value=httpx2.Response(200, json={"foo": "bar"}) + ) + + client = AnthropicAWS(api_key="test-key", aws_region="us-east-1", workspace_id="ws-client") + client.messages.create( + max_tokens=1024, + messages=[{"role": "user", "content": "Hello"}], + model="claude-sonnet-4-20250514", + workspace_id=request_workspace_id if request_workspace_id is not None else omit, + ) + + calls = cast("list[MockRequestCall]", respx_mock.calls) + assert calls[0].request.headers.get("anthropic-workspace-id") == expected + + +@pytest.mark.filterwarnings("ignore::DeprecationWarning") +@pytest.mark.respx() +@pytest.mark.asyncio() +@pytest.mark.parametrize( + "request_workspace_id, expected", + [(None, "ws-client"), ("ws-request", "ws-request")], +) +async def test_workspace_id_header_async( + respx_mock: MockRouter, request_workspace_id: Optional[str], expected: str +) -> None: + respx_mock.post(re.compile(r"https://aws-external-anthropic\.us-east-1\.api\.aws/.*")).mock( + return_value=httpx2.Response(200, json={"foo": "bar"}) + ) + + client = AsyncAnthropicAWS(api_key="test-key", aws_region="us-east-1", workspace_id="ws-client") + await client.messages.create( + max_tokens=1024, + messages=[{"role": "user", "content": "Hello"}], + model="claude-sonnet-4-20250514", + workspace_id=request_workspace_id if request_workspace_id is not None else omit, + ) + + calls = cast("list[MockRequestCall]", respx_mock.calls) + assert calls[0].request.headers.get("anthropic-workspace-id") == expected + + @pytest.mark.filterwarnings("ignore::DeprecationWarning") @pytest.mark.respx() def test_retries(respx_mock: MockRouter) -> None: diff --git a/tests/lib/test_credentials.py b/tests/lib/test_credentials.py index cf88bab56..ea557cdc3 100644 --- a/tests/lib/test_credentials.py +++ b/tests/lib/test_credentials.py @@ -2279,9 +2279,16 @@ def test_workspace_id_header_from_config( client = Anthropic() _send_message(client) + client.messages.create( + max_tokens=1, + model="claude-opus-4-5", + messages=[{"role": "user", "content": "hi"}], + workspace_id="wrkspc_req", + ) - req = cast("list[MockRequestCall]", respx_mock.calls)[0].request - assert req.headers["anthropic-workspace-id"] == "wrkspc_01abc" + calls = cast("list[MockRequestCall]", respx_mock.calls) + assert calls[0].request.headers["anthropic-workspace-id"] == "wrkspc_01abc" + assert calls[1].request.headers["anthropic-workspace-id"] == "wrkspc_req" @pytest.mark.respx() def test_401_invalidates_cache_and_retries_once(self, respx_mock: MockRouter) -> None: @@ -2818,6 +2825,34 @@ async def _send_message_async(client: AsyncAnthropic) -> None: @pytest.mark.usefixtures("clean_env", "no_default_creds_file") class TestAsyncAnthropicCredentials: + @pytest.mark.respx() + async def test_workspace_id_header_from_config( + self, respx_mock: MockRouter, clean_env: pytest.MonkeyPatch, tmp_path: pathlib.Path + ) -> None: + clean_env.setattr("anthropic.lib.credentials._constants._config_dir", lambda: tmp_path) + clean_env.setenv("ANTHROPIC_CONFIG_DIR", str(tmp_path)) + _write_profile( + tmp_path, + "default", + {"type": "external", "workspace_id": "wrkspc_01abc"}, + {"access_token": "sk-ant-oat01-file"}, + ) + + _mock_messages_endpoint(respx_mock) + + client = AsyncAnthropic() + await _send_message_async(client) + await client.messages.create( + max_tokens=1, + model="claude-opus-4-5", + messages=[{"role": "user", "content": "hi"}], + workspace_id="wrkspc_req", + ) + + calls = cast("list[MockRequestCall]", respx_mock.calls) + assert calls[0].request.headers["anthropic-workspace-id"] == "wrkspc_01abc" + assert calls[1].request.headers["anthropic-workspace-id"] == "wrkspc_req" + @pytest.mark.respx() async def test_async_static_token(self, respx_mock: MockRouter) -> None: _mock_messages_endpoint(respx_mock) From daca8f13032311676ed30a6e0527ee304e1419c9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 19:19:01 +0000 Subject: [PATCH 06/10] chore(internal): narrower codeowners scope --- .github/CODEOWNERS | 2 +- .stats.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1227adaa4..3dffb7b5e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # This file is used to automatically assign reviewers to PRs # For more information see: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners -* @anthropics/sdk +* @anthropics/sdk-team diff --git a/.stats.yml b/.stats.yml index 2d40835db..a677329fd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 201 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-a7b6dba9511514e58e6450084c9a1c7ed6c1ace0cfdcb0c975cf7f920633963a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-6fdd96be495df717d6f43ad02422c85352fa2e942d9a562aa91cf0811f38665a.yml openapi_spec_hash: 3914347dffe1c12ce191cfa2ed26738e -config_hash: debaa6e4dc87145b0e8c12c52ae59168 +config_hash: 341182ff4793db51a18aa3d56b72d2d4 From 26c509d66192f2b40150b481fa89da97e532612c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 20:20:32 +0000 Subject: [PATCH 07/10] docs(api): update a few doc strings --- .stats.yml | 6 +++--- src/anthropic/resources/beta/files.py | 18 ++++++++++++------ src/anthropic/resources/files.py | 18 ++++++++++++------ src/anthropic/types/beta/file_upload_params.py | 7 ++++++- .../beta_managed_agents_memory_version.py | 4 ++-- .../beta_managed_agents_session_actor.py | 2 +- src/anthropic/types/file_upload_params.py | 7 ++++++- 7 files changed, 42 insertions(+), 20 deletions(-) diff --git a/.stats.yml b/.stats.yml index a677329fd..f9a26a869 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 201 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-6fdd96be495df717d6f43ad02422c85352fa2e942d9a562aa91cf0811f38665a.yml -openapi_spec_hash: 3914347dffe1c12ce191cfa2ed26738e -config_hash: 341182ff4793db51a18aa3d56b72d2d4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-c115259c68682e065868d9613a076f47ea20f49890016599c48ca98eb12c9600.yml +openapi_spec_hash: 85ce948f447920c14f37874560000153 +config_hash: 550ac6c21465614905b7b32cf57ac689 diff --git a/src/anthropic/resources/beta/files.py b/src/anthropic/resources/beta/files.py index d69c4bb55..cf2bfa7e2 100644 --- a/src/anthropic/resources/beta/files.py +++ b/src/anthropic/resources/beta/files.py @@ -305,11 +305,14 @@ def upload( extra_body: Body | None = None, timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> BetaFileMetadata: - """ - Upload File + """Upload File Args: - file: The file to upload + file: The file to upload. + + Only the final path component of the part's `filename` is + kept; an absent or empty `filename` is replaced with `unnamed` plus the + extension for the file's stored `mime_type`, when known. expires_in_seconds: Seconds from upload until the file expires and its bytes become permanently unavailable. Must be between 3600 (one hour) and 7776000 (ninety days). @@ -612,11 +615,14 @@ async def upload( extra_body: Body | None = None, timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> BetaFileMetadata: - """ - Upload File + """Upload File Args: - file: The file to upload + file: The file to upload. + + Only the final path component of the part's `filename` is + kept; an absent or empty `filename` is replaced with `unnamed` plus the + extension for the file's stored `mime_type`, when known. expires_in_seconds: Seconds from upload until the file expires and its bytes become permanently unavailable. Must be between 3600 (one hour) and 7776000 (ninety days). diff --git a/src/anthropic/resources/files.py b/src/anthropic/resources/files.py index 33079ed4c..2e22ad121 100644 --- a/src/anthropic/resources/files.py +++ b/src/anthropic/resources/files.py @@ -244,11 +244,14 @@ def upload( extra_body: Body | None = None, timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> FileMetadata: - """ - Upload File + """Upload File Args: - file: The file to upload + file: The file to upload. + + Only the final path component of the part's `filename` is + kept; an absent or empty `filename` is replaced with `unnamed` plus the + extension for the file's stored `mime_type`, when known. expires_in_seconds: Seconds from upload until the file expires and its bytes become permanently unavailable. Must be between 3600 (one hour) and 7776000 (ninety days). @@ -491,11 +494,14 @@ async def upload( extra_body: Body | None = None, timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> FileMetadata: - """ - Upload File + """Upload File Args: - file: The file to upload + file: The file to upload. + + Only the final path component of the part's `filename` is + kept; an absent or empty `filename` is replaced with `unnamed` plus the + extension for the file's stored `mime_type`, when known. expires_in_seconds: Seconds from upload until the file expires and its bytes become permanently unavailable. Must be between 3600 (one hour) and 7776000 (ninety days). diff --git a/src/anthropic/types/beta/file_upload_params.py b/src/anthropic/types/beta/file_upload_params.py index aabc6181b..20ba6b68e 100644 --- a/src/anthropic/types/beta/file_upload_params.py +++ b/src/anthropic/types/beta/file_upload_params.py @@ -13,7 +13,12 @@ class FileUploadParams(TypedDict, total=False): file: Required[FileTypes] - """The file to upload""" + """The file to upload. + + Only the final path component of the part's `filename` is kept; an absent or + empty `filename` is replaced with `unnamed` plus the extension for the file's + stored `mime_type`, when known. + """ expires_in_seconds: int """ diff --git a/src/anthropic/types/beta/memory_stores/beta_managed_agents_memory_version.py b/src/anthropic/types/beta/memory_stores/beta_managed_agents_memory_version.py index 7734f5681..de9fa0331 100644 --- a/src/anthropic/types/beta/memory_stores/beta_managed_agents_memory_version.py +++ b/src/anthropic/types/beta/memory_stores/beta_managed_agents_memory_version.py @@ -70,7 +70,7 @@ class BetaManagedAgentsMemoryVersion(BaseModel): Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the - [Sessions API](/en/api/sessions-retrieve). + [Sessions API](/en/api/beta/sessions/retrieve). """ path: Optional[str] = None @@ -88,5 +88,5 @@ class BetaManagedAgentsMemoryVersion(BaseModel): Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the - [Sessions API](/en/api/sessions-retrieve). + [Sessions API](/en/api/beta/sessions/retrieve). """ diff --git a/src/anthropic/types/beta/memory_stores/beta_managed_agents_session_actor.py b/src/anthropic/types/beta/memory_stores/beta_managed_agents_session_actor.py index cb518f1f3..8d5b03f57 100644 --- a/src/anthropic/types/beta/memory_stores/beta_managed_agents_session_actor.py +++ b/src/anthropic/types/beta/memory_stores/beta_managed_agents_session_actor.py @@ -15,7 +15,7 @@ class BetaManagedAgentsSessionActor(BaseModel): session_id: str """ID of the session that performed the write (a `sesn_...` value). - Look up the session via [Retrieve a session](/en/api/sessions-retrieve) for + Look up the session via [Retrieve a session](/en/api/beta/sessions/retrieve) for further provenance. """ diff --git a/src/anthropic/types/file_upload_params.py b/src/anthropic/types/file_upload_params.py index 9dd29d80b..ac5d9967f 100644 --- a/src/anthropic/types/file_upload_params.py +++ b/src/anthropic/types/file_upload_params.py @@ -11,7 +11,12 @@ class FileUploadParams(TypedDict, total=False): file: Required[FileTypes] - """The file to upload""" + """The file to upload. + + Only the final path component of the part's `filename` is kept; an absent or + empty `filename` is replaced with `unnamed` plus the extension for the file's + stored `mime_type`, when known. + """ expires_in_seconds: int """ From 41aa767464881bb51937f42fe9c426ae3081fd9f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 20:23:46 +0000 Subject: [PATCH 08/10] chore(internal): revert codeowners change --- .github/CODEOWNERS | 2 +- .stats.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3dffb7b5e..1227adaa4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # This file is used to automatically assign reviewers to PRs # For more information see: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners -* @anthropics/sdk-team +* @anthropics/sdk diff --git a/.stats.yml b/.stats.yml index f9a26a869..d307200bb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 201 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-c115259c68682e065868d9613a076f47ea20f49890016599c48ca98eb12c9600.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-465bff21a179090915396565d1ae8f705cf8596e2ec920eb121072f25b8a7d68.yml openapi_spec_hash: 85ce948f447920c14f37874560000153 -config_hash: 550ac6c21465614905b7b32cf57ac689 +config_hash: 4ce7f60a1597d4ae2a6fa00cd8bd15bc From 94470992f0f00ed331f2faa585cfda2cb8412a08 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 02:58:59 +0000 Subject: [PATCH 09/10] fix(client): raise a clear error when an httpx object is passed instead of an httpx2 one --- src/anthropic/_base_client.py | 20 +++++++++++ tests/test_client.py | 62 +++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/src/anthropic/_base_client.py b/src/anthropic/_base_client.py index 940a3d8c2..ab0ec4b62 100644 --- a/src/anthropic/_base_client.py +++ b/src/anthropic/_base_client.py @@ -132,6 +132,16 @@ HTTPX_DEFAULT_TIMEOUT = Timeout(5.0) +def _reject_httpx_object(name: str, value: object) -> None: + """`httpx` objects don't work with `httpx2`, and would otherwise fail deep inside a request.""" + for cls in type(value).__mro__: + module = getattr(cls, "__module__", None) + if isinstance(module, str) and module.partition(".")[0] == "httpx": + raise TypeError( + f"Invalid `{name}` argument; `httpx.{cls.__name__}` is from the `httpx` package, but this SDK uses `httpx2`. Use `httpx2.{cls.__name__}` instead." + ) + + class PageInfo: """Stores the necessary information to build the request to retrieve the next page. @@ -400,6 +410,8 @@ def __init__( custom_query: Mapping[str, object] | None = None, middleware: Sequence[MiddlewareInput] | None = None, ) -> None: + _reject_httpx_object("timeout", timeout) + self._version = version self._base_url = self._enforce_trailing_slash(URL(base_url)) self.max_retries = max_retries @@ -500,6 +512,8 @@ def _build_request( *, retries_taken: int = 0, ) -> httpx2.Request: + _reject_httpx_object("timeout", options.timeout) + if log.isEnabledFor(logging.DEBUG): log.debug( "Request options: %s", @@ -884,6 +898,7 @@ def _idempotency_key(self) -> str: class _DefaultHttpxClient(httpx2.Client): def __init__(self, **kwargs: Any) -> None: + _reject_httpx_object("transport", kwargs.get("transport")) kwargs.setdefault("timeout", DEFAULT_TIMEOUT) kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) kwargs.setdefault("follow_redirects", True) @@ -973,6 +988,8 @@ def __init__( middleware: Sequence[MiddlewareInput] | None = None, _strict_response_validation: bool, ) -> None: + _reject_httpx_object("http_client", http_client) + if not is_given(timeout): # if the user passed in a custom http client with a non-default # timeout set then we use that timeout. @@ -1557,6 +1574,7 @@ def get_api_list( class _DefaultAsyncHttpxClient(httpx2.AsyncClient): def __init__(self, **kwargs: Any) -> None: + _reject_httpx_object("transport", kwargs.get("transport")) kwargs.setdefault("timeout", DEFAULT_TIMEOUT) kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) kwargs.setdefault("follow_redirects", True) @@ -1669,6 +1687,8 @@ def __init__( custom_query: Mapping[str, object] | None = None, middleware: Sequence[MiddlewareInput] | None = None, ) -> None: + _reject_httpx_object("http_client", http_client) + if not is_given(timeout): # if the user passed in a custom http client with a non-default # timeout set then we use that timeout. diff --git a/tests/test_client.py b/tests/test_client.py index ffd9124c2..2daaeaba4 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -391,6 +391,36 @@ async def test_invalid_http_client(self) -> None: http_client=cast(Any, http_client), ) + def test_httpx_objects_rejected(self, client: Anthropic) -> None: + # `import httpx` resolves to `httpx2` in this test suite, so fake the `httpx` classes + class Timeout: + __module__ = "httpx" + + class HTTPTransport: + __module__ = "httpx._transports.default" + + class Client: + __module__ = "httpx" + + class MyClient(Client): + pass + + timeout: Any = Timeout() + transport: Any = HTTPTransport() + http_client: Any = MyClient() + + with pytest.raises(TypeError, match="Use `httpx2.Client` instead"): + Anthropic(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) + + with pytest.raises(TypeError, match="Use `httpx2.Timeout` instead"): + Anthropic(base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=timeout) + + with pytest.raises(TypeError, match="Use `httpx2.Timeout` instead"): + client.post("/foo", cast_to=httpx2.Response, options={"timeout": timeout}) + + with pytest.raises(TypeError, match="Use `httpx2.HTTPTransport` instead"): + DefaultHttpxClient(transport=transport) + def test_default_headers_option(self) -> None: test_client = Anthropic( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} @@ -1562,6 +1592,38 @@ def test_invalid_http_client(self) -> None: http_client=cast(Any, http_client), ) + async def test_httpx_objects_rejected(self, async_client: AsyncAnthropic) -> None: + # `import httpx` resolves to `httpx2` in this test suite, so fake the `httpx` classes + class Timeout: + __module__ = "httpx" + + class HTTPTransport: + __module__ = "httpx._transports.default" + + class Client: + __module__ = "httpx" + + class MyClient(Client): + pass + + timeout: Any = Timeout() + transport: Any = HTTPTransport() + http_client: Any = MyClient() + + with pytest.raises(TypeError, match="Use `httpx2.Client` instead"): + AsyncAnthropic( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) + + with pytest.raises(TypeError, match="Use `httpx2.Timeout` instead"): + AsyncAnthropic(base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=timeout) + + with pytest.raises(TypeError, match="Use `httpx2.Timeout` instead"): + await async_client.post("/foo", cast_to=httpx2.Response, options={"timeout": timeout}) + + with pytest.raises(TypeError, match="Use `httpx2.HTTPTransport` instead"): + DefaultAsyncHttpxClient(transport=transport) + async def test_default_headers_option(self) -> None: test_client = AsyncAnthropic( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} From e52b6dd8ef0dffb244e1aad0656f0e9518aa5973 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 02:59:48 +0000 Subject: [PATCH 10/10] release: 1.4.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 26 ++++++++++++++++++++++++++ pyproject.toml | 2 +- src/anthropic/_version.py | 2 +- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2a8f4ffdd..3e9af1b3a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.3.0" + ".": "1.4.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a1abb15a..d5d287536 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## 1.4.0 (2026-09-03) + +Full Changelog: [v1.3.0...v1.4.0](https://github.com/anthropics/anthropic-sdk-python/compare/v1.3.0...v1.4.0) + +### Features + +* **api:** add support for sending a workspace ID on more endpoints ([d1d2c01](https://github.com/anthropics/anthropic-sdk-python/commit/d1d2c01d8aa128080dea3d711e12cb3df95a2149)) + + +### Bug Fixes + +* **client:** raise a clear error when an httpx object is passed instead of an httpx2 one ([9447099](https://github.com/anthropics/anthropic-sdk-python/commit/94470992f0f00ed331f2faa585cfda2cb8412a08)) +* repair custom-code merge in messages resources ([#580](https://github.com/anthropics/anthropic-sdk-python/issues/580)) ([85454ca](https://github.com/anthropics/anthropic-sdk-python/commit/85454cab9a323801b76500707b84c1992c1c0ee4)) + + +### Chores + +* **internal:** clean up code comments ([#578](https://github.com/anthropics/anthropic-sdk-python/issues/578)) ([d202327](https://github.com/anthropics/anthropic-sdk-python/commit/d2023274f69dd0609ddabbf8f6af08041f868d8b)) +* **internal:** narrower codeowners scope ([daca8f1](https://github.com/anthropics/anthropic-sdk-python/commit/daca8f13032311676ed30a6e0527ee304e1419c9)) +* **internal:** revert codeowners change ([41aa767](https://github.com/anthropics/anthropic-sdk-python/commit/41aa767464881bb51937f42fe9c426ae3081fd9f)) + + +### Documentation + +* **api:** update a few doc strings ([26c509d](https://github.com/anthropics/anthropic-sdk-python/commit/26c509d66192f2b40150b481fa89da97e532612c)) + ## 1.3.0 (2026-09-01) Full Changelog: [v1.2.0...v1.3.0](https://github.com/anthropics/anthropic-sdk-python/compare/v1.2.0...v1.3.0) diff --git a/pyproject.toml b/pyproject.toml index ab02807d0..c37244fd4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "anthropic" -version = "1.3.0" +version = "1.4.0" description = "The official Python library for the anthropic API" dynamic = ["readme"] license = "MIT" diff --git a/src/anthropic/_version.py b/src/anthropic/_version.py index c91131b3b..137a6918b 100644 --- a/src/anthropic/_version.py +++ b/src/anthropic/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "anthropic" -__version__ = "1.3.0" # x-release-please-version +__version__ = "1.4.0" # x-release-please-version