Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
6,399 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
6,399
◇
Types & classes
2,012
↳
Endpoints
17
↓ 7 callers
Function
_api_status_error
(code: int)
tests/lib/tools/test_session_runner.py:125
↓ 7 callers
Function
_downloaded
A ``SessionMemoryStores`` with one store already downloaded to disk.
tests/lib/tools/memory_sync/test_keep_only_copy.py:21
↓ 7 callers
Method
_ensure_memory_root
Ensure the memory root directory exists
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:678
↓ 7 callers
Method
_make_client
(self)
tests/lib/test_bedrock_mantle.py:130
↓ 7 callers
Function
_mcp_field_v1_or_v2
(obj: Any, name: str)
src/anthropic/lib/tools/mcp.py:82
↓ 7 callers
Function
_mock_client
(result: CallToolResult | None = None)
tests/lib/tools/test_mcp_tool.py:67
↓ 7 callers
Function
_read_result
(contents: list[Any])
tests/lib/tools/test_mcp_tool.py:51
↓ 7 callers
Function
_text_resource
(uri: str = "file:///x.txt", text: str = "hello", mime: str | None = None)
tests/lib/tools/test_mcp_tool.py:43
↓ 7 callers
Function
_tool_reference_block
(kind: Literal["tool_removal", "tool_addition"], name: str)
tests/lib/tools/test_runners.py:1016
↓ 7 callers
Function
_tool_use_response
(tool_name: str, tool_use_id: str, input: Union[Dict[str, Any], None] = None)
tests/lib/tools/test_runners.py:977
↓ 7 callers
Method
_validate_path
Validate and resolve memory paths
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:396
↓ 7 callers
Function
async_to_httpx_files
(files: None)
src/anthropic/_files.py:84
↓ 7 callers
Function
beta_agent_toolset_20260401
Return the ``agent_toolset_20260401`` implementations bound to ``ctx``. The result is a plain list of :class:`~anthropic.lib.tools.BetaAsyncFunct
src/anthropic/lib/tools/agent_toolset.py:930
↓ 7 callers
Function
beta_glob_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:807
↓ 7 callers
Function
beta_headers
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:104
↓ 7 callers
Function
block_starts
(events: list[BetaRawMessageStreamEvent])
tests/lib/test_refusal_fallback_streaming.py:194
↓ 7 callers
Function
created
(path: str, content: str)
tests/lib/tools/memory_sync/_fake_anthropic.py:73
↓ 7 callers
Method
dispose
Remove the root iff ``open`` created it; pre-existing roots are kept.
src/anthropic/lib/tools/_file_store.py:122
↓ 7 callers
Method
exec
(self, cmd: str, timeout: float = BASH_DEFAULT_TIMEOUT)
src/anthropic/lib/tools/agent_toolset.py:488
↓ 7 callers
Method
extra_headers
Return headers derived from the config file (e.g. ``workspace_id``). Eagerly reads the config if not yet loaded. The returned dict is
src/anthropic/lib/credentials/_providers.py:287
↓ 7 callers
Function
extract_type_var_from_base
Given a type like `Foo[T]`, returns the generic type variable `T`. This also handles the case where a concrete subclass is given, e.g. ```py
src/anthropic/_utils/_typing.py:91
↓ 7 callers
Method
finish
(self, reason: _LeaseEndReason)
src/anthropic/lib/environments/_worker.py:138
↓ 7 callers
Function
get_args
(tp: type[Any])
src/anthropic/_utils/_compat.py:15
↓ 7 callers
Method
handle_item
Service a single, already-claimed work item without the poll loop. Builds the per-session :class:`AgentToolContext` (workdir from this
src/anthropic/lib/environments/_worker.py:531
↓ 7 callers
Function
marker_stamp
(local: Path)
tests/lib/tools/memory_sync/test_folder_trust.py:28
↓ 7 callers
Function
model_dump
( model: pydantic.BaseModel, *, exclude: IncEx | None = None, exclude_unset: bool = False,
src/anthropic/_compat.py:144
↓ 7 callers
Function
request_body
(call: MockRequestCall)
tests/test_middleware.py:78
↓ 7 callers
Function
to_httpx_files
(files: None)
src/anthropic/_files.py:42
↓ 7 callers
Function
update_env
(**new_env: str | Omit)
tests/utils.py:151
↓ 7 callers
Function
validate_credentials
Raise if only one of aws_access_key/aws_secret_key is provided.
src/anthropic/lib/aws/_credentials.py:7
↓ 6 callers
Method
_build_workload_delegate
(self, auth: Dict[str, Any])
src/anthropic/lib/credentials/_providers.py:698
↓ 6 callers
Function
_custom_tool_use
A CUSTOM (user-defined) tool call — the agent emits ``agent.custom_tool_use`` rather than ``agent.tool_use`` for these.
tests/lib/tools/test_session_runner.py:96
↓ 6 callers
Function
_is_status
(err: Exception, code: int)
src/anthropic/lib/environments/_poller.py:44
↓ 6 callers
Function
_mock_deployment
Mock one deployment: its token endpoint mints ``token`` and its messages endpoint accepts anything. Pair with :func:`_requests_to` to check th
tests/lib/test_credentials.py:1982
↓ 6 callers
Function
_mock_token_endpoint
(respx_mock: MockRouter)
tests/lib/test_credentials.py:1947
↓ 6 callers
Function
_mode
(p: Path)
tests/lib/tools/test_skills.py:172
↓ 6 callers
Function
_requests_to
(respx_mock: MockRouter, base_url: str)
tests/lib/test_credentials.py:1991
↓ 6 callers
Function
_sha
(content: str | bytes)
tests/lib/tools/test_file_store.py:27
↓ 6 callers
Function
_sha
(content: str)
tests/lib/tools/memory_sync/_fake_anthropic.py:23
↓ 6 callers
Function
_status_error
(code: int)
tests/lib/tools/memory_sync/_fake_anthropic.py:27
↓ 6 callers
Function
_symlink_fixture
Workdir with two symlink cycles, a link that escapes, and a link whose target spells its way through a cycle to the escaping link.
tests/lib/tools/test_agent_toolset.py:85
↓ 6 callers
Function
_validate_output_config_conflict
( output_config: BetaOutputConfigParam | Omit, output_format: object, )
src/anthropic/resources/beta/messages/messages.py:3873
↓ 6 callers
Method
_validate_path
Validate and resolve memory paths
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:682
↓ 6 callers
Method
_walk_sync_auth
(client: Anthropic)
tests/lib/test_credentials.py:3213
↓ 6 callers
Method
_workload_provider
(self, handler: Callable[[httpx2.Request], httpx2.Response])
tests/lib/test_credentials.py:3556
↓ 6 callers
Method
append_messages
Add one or more messages to the conversation history. This invalidates the cached tool response, i.e. if tools were already called, then they
src/anthropic/lib/tools/_beta_runner.py:138
↓ 6 callers
Function
beta_async_tool
(func: AsyncFunctionT)
src/anthropic/lib/tools/_beta_functions.py:479
↓ 6 callers
Method
copy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/_client.py:834
↓ 6 callers
Function
extract_response_type
Given a type like `APIResponse[T]`, returns the generic type variable `T`. This also handles the case where a concrete subclass is given, e.g.
src/anthropic/_response.py:864
↓ 6 callers
Function
extract_type_arg
(typ: type, index: int)
src/anthropic/_utils/_typing.py:83
↓ 6 callers
Function
foo
(a: str | None = None)
tests/test_required_args.py:10
↓ 6 callers
Method
invalidate
Clear the cached token so the next :meth:`get_token` re-invokes the provider. Also sets a one-shot ``force_refresh`` flag so on-disk provider
src/anthropic/lib/credentials/_cache.py:177
↓ 6 callers
Function
mcp_resource_to_content
Convert MCP resource contents to an Anthropic content block. Finds the first resource with a supported MIME type from the result's ``contents
src/anthropic/lib/tools/mcp.py:275
↓ 6 callers
Method
parse
( self, *, max_tokens: int, messages: Iterable[MessageParam], model: M
src/anthropic/resources/messages/messages.py:1113
↓ 6 callers
Function
redeemed_token
The request-body form of a redeemed credit token — the object shape, best-effort mode.
tests/lib/test_refusal_fallback_streaming.py:148
↓ 6 callers
Method
stop
Track a content_block_stop, shifting `event["index"]`.
src/anthropic/lib/middleware/_fallbacks.py:1268
↓ 6 callers
Method
to_dict
(self)
src/anthropic/lib/tools/_beta_functions.py:189
↓ 6 callers
Method
with_middleware
A new client with the given middleware appended after this client's middleware. Convenience for applying extra middleware to a single request
src/anthropic/_client.py:495
↓ 5 callers
Method
__get_proxied__
(self)
src/anthropic/_utils/_proxy.py:57
↓ 5 callers
Method
__init__
( self, *, url: URL, )
src/anthropic/_base_client.py:146
↓ 5 callers
Function
_api_status_error
(code: int)
tests/lib/environments/test_poller_method.py:38
↓ 5 callers
Function
_api_status_error
(code: int, body: object = None)
tests/lib/environments/test_worker.py:58
↓ 5 callers
Function
_chunk_bytes_to_sse
(raw: bytes)
src/anthropic/lib/bedrock/_stream_decoder.py:68
↓ 5 callers
Function
_created_store
(root: Path, *, utf8_only: bool = False)
tests/lib/tools/test_file_store.py:31
↓ 5 callers
Function
_downloaded
A ``SessionMemoryStores`` with one store already downloaded to disk.
tests/lib/tools/memory_sync/test_two_pass.py:24
↓ 5 callers
Function
_drain_one
Pull a single item from a sync iterator; assert there was one.
tests/lib/environments/test_poller_method.py:120
↓ 5 callers
Function
_emit
(event: str, payload: dict[str, Any])
src/anthropic/lib/middleware/_fallbacks.py:1537
↓ 5 callers
Function
_encode_secret
Build a work-item ``secret`` the way the control plane does: URL-safe base64 of a JSON payload, without padding.
tests/lib/environments/test_worker.py:52
↓ 5 callers
Method
_get_http_client
Return an ``httpx2.Client``, lazily creating (and tracking) one we own.
src/anthropic/lib/credentials/_providers.py:429
↓ 5 callers
Function
_is_base_client
True only for the base ``Anthropic`` / ``AsyncAnthropic`` classes, not subclasses. Subclasses (``AnthropicAWS``, ``AnthropicFoundry``) have their
src/anthropic/_client.py:48
↓ 5 callers
Method
_load_config
Read and cache the config file, resolving ``base_url`` and ``credentials_path``.
src/anthropic/lib/credentials/_providers.py:306
↓ 5 callers
Function
_to_session_content
(content: Any)
tests/lib/tools/test_session_runner.py:1679
↓ 5 callers
Function
_within
True if ``child`` is ``root`` or a path inside it (both already resolved).
src/anthropic/lib/tools/_skills.py:38
↓ 5 callers
Method
_write_refresh_profile
(self, clean_env: pytest.MonkeyPatch, tmp_path: pathlib.Path)
tests/lib/test_credentials.py:3635
↓ 5 callers
Function
accumulate_event
( *, event: BetaRawMessageStreamEvent, current_snapshot: ParsedBetaMessage[ResponseFormatT] | None
src/anthropic/lib/streaming/_beta_messages.py:457
↓ 5 callers
Function
assert_different_identities
(obj1: object, obj2: object)
tests/test_files.py:74
↓ 5 callers
Function
beta_grep_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:842
↓ 5 callers
Function
build
Construct a BaseModel class without validation. This is useful for cases where you need to instantiate a `BaseModel` from an API response as
src/anthropic/_models.py:552
↓ 5 callers
Method
copy
( self, *, method: str | NotGiven = not_given, url: str | NotGiven = not_given
src/anthropic/_request.py:69
↓ 5 callers
Method
create_root
Create the root directory and any missing ancestors; already existing is fine.
src/anthropic/lib/tools/_file_store.py:115
↓ 5 callers
Method
dispose
Remove every store directory that :meth:`download` created. Pre-existing directories are left alone — that is :meth:`FileStore.dispos
src/anthropic/lib/tools/_memories.py:524
↓ 5 callers
Function
drive
()
tests/lib/tools/test_session_runner.py:572
↓ 5 callers
Method
for_base_url
Return the provider a client with ``base_url`` should exchange through. Binds in place, unless another client already bound this instance to
src/anthropic/lib/credentials/_providers.py:246
↓ 5 callers
Function
hop_refusal
A fallback hop that contributes one text block, then refuses with a fresh token.
tests/lib/test_refusal_fallback_streaming.py:674
↓ 5 callers
Function
is_annotated_type
(typ: type)
src/anthropic/_utils/_typing.py:21
↓ 5 callers
Function
is_fatal_status_error
True for a 4xx that retrying will not fix (bad key, missing resource). Aligns with the core client's ``_should_retry`` policy: 408 / 409 / 429 ar
src/anthropic/lib/_retry.py:42
↓ 5 callers
Function
is_mapping_t
(obj: _MappingT | object)
src/anthropic/_utils/_utils.py:190
↓ 5 callers
Method
iter_bytes
A byte-iterator over the decoded response content. This automatically handles gzip, deflate and brotli encoded responses.
src/anthropic/_response.py:387
↓ 5 callers
Method
list
List Files Args: ids: Restrict the result set to Files whose `id` is in this list. At most 100 entries (afte
src/anthropic/resources/files.py:62
↓ 5 callers
Function
make_lenient_client
A client with the default (non-strict) response validation. The fixture wire's terminal refusal delta self-reports a `{type: "message"}` iter
tests/lib/test_refusal_fallback_streaming.py:81
↓ 5 callers
Function
mcp_tool
Convert an MCP tool to a sync runnable tool for ``tool_runner()``. Example:: from anthropic.lib.tools.mcp import mcp_tool tools
src/anthropic/lib/tools/mcp.py:354
↓ 5 callers
Function
print_obj
Pretty print an object to a string
tests/lib/utils.py:18
↓ 5 callers
Method
provider
(*, force_refresh: bool = False)
tests/lib/test_credentials.py:1647
↓ 5 callers
Method
request
( self, cast_to: Type[ResponseT], options: FinalRequestOptions, *, str
src/anthropic/_base_client.py:1755
↓ 5 callers
Function
serving_stream
(model: str = FALLBACK_MODEL, message_id: str = "msg_b")
tests/lib/test_refusal_fallback_streaming.py:928
↓ 5 callers
Function
set_pydantic_config
Add a pydantic config for the given type. Note: this is a no-op on Pydantic v1.
src/anthropic/_models.py:842
↓ 5 callers
Method
walk
()
src/anthropic/lib/tools/_file_store.py:173
↓ 5 callers
Method
worker
()
tests/lib/test_credentials.py:1621
↓ 4 callers
Method
__init__
(self, message: str, request: httpx2.Request, *, body: object | None)
src/anthropic/_exceptions.py:49
↓ 4 callers
Function
_adrain_one
(ait: AsyncIterator[Any])
tests/lib/environments/test_poller_method.py:128
← previous
next →
201–300 of 6,399, ranked by callers