Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
12,274 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
12,274
◇
Types & classes
3,937
↳
Endpoints
46
↓ 3 callers
Function
_request_id
(resp: httpx2.Response)
src/anthropic/lib/credentials/_workload.py:50
↓ 3 callers
Method
_resolve_base_url
base_url precedence: top-level config field → bound (the owning client's base_url, via `bind_base_url`) → default. Validated against t
src/anthropic/lib/credentials/_providers.py:275
↓ 3 callers
Function
_resolve_max_bytes
Resolve a configured cap to an effective size limit. `not_given` selects `default`; `None` disables the size check (uncapped); a positive int
src/anthropic/lib/tools/agent_toolset.py:135
↓ 3 callers
Function
_response_without_a_summary
(content: List[Any], stop_reason: str)
tests/lib/tools/test_runners.py:2507
↓ 3 callers
Function
_run_heartbeat_loop
( monkeypatch: pytest.MonkeyPatch, script: list[tuple[float, Any]] )
tests/lib/environments/test_worker.py:1125
↓ 3 callers
Function
_run_timed
Run the worker to completion and return the wall-clock seconds it took.
tests/lib/tools/memory_sync/test_e2e_memory.py:127
↓ 3 callers
Method
_run_tool
(self, tool: BetaRunnableTool, tool_use: BetaToolUseBlock)
src/anthropic/lib/tools/_beta_runner.py:853
↓ 3 callers
Method
_run_toolset_member
(self, tool_use: BetaToolUseBlock)
src/anthropic/lib/tools/_beta_runner.py:876
↓ 3 callers
Function
_safe_json
(text: str)
src/anthropic/lib/middleware/_fallbacks.py:1592
↓ 3 callers
Method
_scan_marker
(self, store: _AttachedStore)
src/anthropic/lib/tools/_memories.py:360
↓ 3 callers
Function
_seam_block
The synthetic `fallback` content block marking one model boundary.
src/anthropic/lib/middleware/_fallbacks.py:1438
↓ 3 callers
Function
_sent_tools
The `tools` array of the first request the runner sent.
tests/lib/tools/toolsets/test_runner.py:141
↓ 3 callers
Function
_session_with_skills
(*skill_ids: str)
tests/lib/tools/test_skills.py:472
↓ 3 callers
Method
_set_open_telemetry
Sets this client's `open_telemetry` option, and has it get its tracer anew. Nothing else sets the option. The constructor calls this, and so
src/anthropic/_base_client.py:469
↓ 3 callers
Method
_should_retry
(self, response: httpx2.Response)
src/anthropic/_base_client.py:934
↓ 3 callers
Method
_signal
(self)
src/anthropic/lib/tools/_beta_session_runner.py:181
↓ 3 callers
Function
_sse_message
(content_block: Dict[str, Any], stop_reason: str, *deltas: Dict[str, Any])
tests/lib/tools/test_runners.py:3466
↓ 3 callers
Method
_start_new_thread
Stop continuing from the stored reply so the turn re-sends the full history under a new thread.
src/anthropic/lib/threads/_thread_state.py:296
↓ 3 callers
Function
_strip_traceback
Detach the frames chained onto `err` before raising from it. Foreign frames (json decoder, httpx transport) hold raw payloads — request bodie
src/anthropic/lib/credentials/_secrets.py:104
↓ 3 callers
Method
_sync_all
(self, *, final: bool)
src/anthropic/lib/tools/_memories.py:354
↓ 3 callers
Function
_tar_special
(name: str, type: bytes, linkname: str = "")
tests/lib/tools/test_skills.py:109
↓ 3 callers
Function
_targz_bytes
(entries: dict[str, bytes])
tests/lib/tools/test_skills.py:67
↓ 3 callers
Function
_thread_fields
(fields: dict[str, Any])
tests/lib/threads/helpers.py:85
↓ 3 callers
Function
_unwrap_secret
Inverse of `_wrap_secret_fields` for a single value; pass-through for values that were never wrapped (absent or non-string fields).
src/anthropic/lib/credentials/_secrets.py:83
↓ 3 callers
Function
_validate_profile_name
Reject profile names that could escape the config directory. Profile names come from user-controlled sources (`ANTHROPIC_PROFILE`, the `activ
src/anthropic/lib/credentials/_constants.py:131
↓ 3 callers
Function
_vertex_message
(content: List[Dict[str, Any]], stop_reason: str)
tests/lib/test_vertex.py:111
↓ 3 callers
Method
_walk_sync_auth
(client: Anthropic)
tests/lib/test_credentials.py:4226
↓ 3 callers
Function
_wrap_secret_fields
Wrap the secret fields of a parsed JSON object in `SecretStr`. Called at every boundary where credential material enters SDK code. Traceback
src/anthropic/lib/credentials/_secrets.py:51
↓ 3 callers
Function
action_line
The line of text a pure action returned, as written: `render_result` folds it to one line (control, line-separator and bidi characters a space) an
src/anthropic/lib/tools/_toolsets/_render.py:101
↓ 3 callers
Function
add_response_ids
(obj: BaseModel, *, request_id: str | None, workspace_id: str | None)
src/anthropic/_models.py:965
↓ 3 callers
Method
arm
(Re)start the idle countdown from now and wake the watchdog. Deferred while any gated call is held or in flight — stopping then would
src/anthropic/lib/tools/_beta_session_runner.py:204
↓ 3 callers
Function
as_dict
(value: object)
src/anthropic/lib/_tracing/_utils.py:28
↓ 3 callers
Method
bind_base_url
Adopt the owning client's `base_url` as a fallback for the token exchange. Slots between the config file's own `base_url` field and th
src/anthropic/lib/credentials/_providers.py:229
↓ 3 callers
Method
call
(self, input: object)
src/anthropic/lib/tools/_tool_dispatch.py:132
↓ 3 callers
Function
call_messages
Creates a Message from `messages` with a synchronous or an asynchronous client.
tests/test_open_telemetry.py:4354
↓ 3 callers
Method
close
Close the underlying HTTPX client. The client will *not* be usable after this.
src/anthropic/_base_client.py:1143
↓ 3 callers
Method
close
Release what the toolset holds when you are done. The tool runner never calls this, so one instance can serve several runs, and a `with` block
src/anthropic/lib/tools/_toolsets/_base.py:299
↓ 3 callers
Method
close
(self)
src/anthropic/lib/credentials/_close.py:14
↓ 3 callers
Method
close
(self)
src/anthropic/lib/middleware/_fallbacks.py:1703
↓ 3 callers
Function
consume_async_iterator
(iterator: AsyncIterator[Any])
src/anthropic/_utils/_streams.py:10
↓ 3 callers
Function
consume_sync_iterator
(iterator: Iterator[Any])
src/anthropic/_utils/_streams.py:5
↓ 3 callers
Method
copy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/foundry.py:213
↓ 3 callers
Method
copy
( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] — narrows `credentials` to No
src/anthropic/lib/aws/_client.py:406
↓ 3 callers
Method
copy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/vertex/_client.py:164
↓ 3 callers
Method
copy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/vertex/_client.py:330
↓ 3 callers
Function
count_accumulated_events
Wraps the stable or the beta `accumulate_event`, which the stream helpers and the spans share, so that the type of each event it takes is added to
tests/test_open_telemetry.py:820
↓ 3 callers
Function
derived_url
(template: str, /, **values: str)
src/anthropic/lib/google_cloud/_client.py:179
↓ 3 callers
Function
dig
The value at `path` in `data`, whose every level is a dict or a model. `None` where a level lacks its name.
src/anthropic/_tracing.py:807
↓ 3 callers
Method
do
(self, name: str, context: BetaToolsetCallContext, input: Any)
tests/lib/tools/test_runner_eager_tools.py:1050
↓ 3 callers
Function
exchange_federation_assertion
Perform a single RFC 7523 `jwt-bearer` exchange and return the resulting `AccessToken`. This is a one-shot convenience wrapper around `Worklo
src/anthropic/lib/credentials/_workload.py:363
↓ 3 callers
Method
execute
(self, context: BetaToolsetCallContext, name: Any, input: Any)
tests/lib/tools/toolsets/test_computer_interface.py:109
↓ 3 callers
Method
fail
(*_args: object)
tests/test_open_telemetry.py:1166
↓ 3 callers
Function
family_call
A call to a tool of the `family` toolset, and the timeline line for when that tool starts.
tests/lib/tools/test_runner_eager_toolsets.py:438
↓ 3 callers
Method
find_symlinks
Every symlink under `under` — listings skip them and reads refuse them, so a caller that must know they exist asks here.
src/anthropic/lib/tools/_file_store.py:178
↓ 3 callers
Method
get_final_text
Returns all `text` content blocks concatenated together. > [!NOTE] > Currently the API will only respond with a single content block.
src/anthropic/lib/streaming/_messages.py:104
↓ 3 callers
Method
get_max_retries
(self, max_retries: int)
src/anthropic/_models.py:1105
↓ 3 callers
Function
handler
(_: httpx2.Request)
tests/test_exceptions.py:71
↓ 3 callers
Method
has_next_page
(self)
src/anthropic/pagination.py:37
↓ 3 callers
Function
image_block
(data: object)
tests/test_prepare.py:125
↓ 3 callers
Function
index_runnables
Index a runner's tools by `name` and its toolsets by family (`toolset_name`). A toolset's `tools[]` entry has no `name`, so toolsets are indexed
src/anthropic/lib/tools/_tool_dispatch.py:144
↓ 3 callers
Function
is_download_change
(change: StateChange)
src/anthropic/lib/tools/_toolsets/_render.py:203
↓ 3 callers
Method
is_enabled
Whether the member is offered to the model and may be dispatched.
src/anthropic/lib/tools/_toolsets/_base.py:209
↓ 3 callers
Function
is_file_content
(obj: object)
src/anthropic/_files.py:29
↓ 3 callers
Function
is_tuple_t
(obj: _TupleT | object)
src/anthropic/_utils/_utils.py:174
↓ 3 callers
Function
is_type_alias_type
Return whether the provided argument is an instance of `TypeAliasType`. ```python type Int = int is_type_alias_type(Int) # > True
src/anthropic/_utils/_typing.py:59
↓ 3 callers
Function
json_response
(body: Any, status: int)
tests/lib/test_refusal_fallback_streaming.py:101
↓ 3 callers
Function
listing_interrupted_by
Run `interrupt` once while a sync's server listing is being consumed: right after the sync has processed `after_items` listed memories, or onc
tests/lib/tools/memory_sync/conftest.py:43
↓ 3 callers
Function
literal_values
(tp: Any)
tests/test_open_telemetry.py:8251
↓ 3 callers
Function
log_safe
A model- or page-supplied name for a log record or an SDK-written error text: `one_line`, cut short.
src/anthropic/lib/tools/_toolsets/_sanitize.py:64
↓ 3 callers
Function
make_async_bedrock_client
(**kwargs: Any)
tests/test_middleware.py:1920
↓ 3 callers
Function
make_async_mantle_client
(**kwargs: Any)
tests/test_middleware.py:1936
↓ 3 callers
Function
make_bedrock_client
(**kwargs: Any)
tests/test_middleware.py:1916
↓ 3 callers
Function
make_mantle_client
(**kwargs: Any)
tests/test_middleware.py:1932
↓ 3 callers
Function
make_message
(message_cls: type[Union[Message, BetaMessage]])
tests/types/test_to_param.py:47
↓ 3 callers
Function
make_vertex_client
(**kwargs: Any)
tests/test_middleware.py:1924
↓ 3 callers
Function
malformed_stream_events
(message: dict[str, Any])
tests/test_open_telemetry.py:7745
↓ 3 callers
Function
map_aiohttp_exceptions
()
src/anthropic/_vendor/httpx_aiohttp/transport.py:47
↓ 3 callers
Function
mcp_resource_to_file
Convert MCP resource contents to a file tuple for `files.upload()`. Returns a `(filename, content_bytes, mime_type)` tuple compatible with th
src/anthropic/lib/tools/mcp.py:277
↓ 3 callers
Function
message_with
`MESSAGE` with `iterations` in its usage.
tests/test_open_telemetry.py:738
↓ 3 callers
Function
mock_session_routes
(respx_mock: MockRouter)
tests/test_open_telemetry.py:3713
↓ 3 callers
Method
next_page_info
(self)
src/anthropic/_base_client.py:243
↓ 3 callers
Function
not_found
(tool_use_id: str)
tests/lib/tools/test_runner_eager_tools.py:855
↓ 3 callers
Function
open_regular_file
(rel_path: str, dest: Path)
src/anthropic/lib/tools/_file_store.py:333
↓ 3 callers
Function
openapi_model_dump
Dump a model as it is sent in a request body, without the fields named in `__api_exclude__`.
src/anthropic/_utils/_json.py:53
↓ 3 callers
Function
parse_beta_response
( *, output_format: ResponseFormatT | NotGiven, response: BetaMessage, )
src/anthropic/lib/_parse/_response.py:23
↓ 3 callers
Function
parse_input
Parse the model's `tool_use.input` into the member's input model. A mistyped field is the model's mistake, so it comes back as a `ToolError` the
src/anthropic/lib/tools/_toolsets/_base.py:500
↓ 3 callers
Function
platform_client
(platform: str, sync: bool, requests: list[httpx2.Request] | None = None)
tests/lib/test_platform_resources.py:55
↓ 3 callers
Method
read
Read and return the binary response content.
src/anthropic/_response.py:474
↓ 3 callers
Method
read
()
tests/test_open_telemetry.py:1942
↓ 3 callers
Function
read_text_exact
Read a UTF-8 file without newline translation.
src/anthropic/lib/tools/_files.py:13
↓ 3 callers
Function
realpath_lenient
`path` made absolute with every existing symlink resolved and `..` collapsed. Components that do not exist yet (a download directory to be created
src/anthropic/lib/tools/_toolsets/_security.py:36
↓ 3 callers
Function
reject_unrestricted_paths
Raise `TypeError` if the deprecated `unrestricted_paths` was passed at all.
src/anthropic/lib/tools/_deprecations.py:22
↓ 3 callers
Method
release
Drop one hold; the last release applies any deferred arm. Once nothing gated is held or in flight, a deferred countdown starts now (w
src/anthropic/lib/tools/_beta_session_runner.py:234
↓ 3 callers
Function
render_result
The content blocks for a member's result, by the registry's result kind. A pure action renders as its fixed acknowledgment, then, in a text block
src/anthropic/lib/tools/_toolsets/_render.py:110
↓ 3 callers
Function
reply_ending
A reply that ends for another reason.
tests/lib/tools/test_runner_eager_tools.py:845
↓ 3 callers
Function
response_data
What the call's response gave: the parsed body or the stream, or the decoded body of a raw response. A raw response whose body the application ha
src/anthropic/_tracing.py:680
↓ 3 callers
Method
start
Starts the span of `work_item`. Never raises: an item whose span cannot start is handled without one.
src/anthropic/lib/_tracing/_work.py:32
↓ 3 callers
Method
stream
Like `send()`, and returns the reply's stream. The turn is in progress until the stream ends or is closed.
src/anthropic/lib/threads/_beta_threads.py:226
↓ 3 callers
Method
tab
(self, tab_id: str | None)
tests/lib/tools/toolsets/_fakes.py:86
↓ 3 callers
Function
tool_addition
(definition: BetaToolUnionParam)
tests/lib/threads/helpers.py:200
← previous
next →
701–800 of 12,274, ranked by callers