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
↓ 2 callers
Function
history_with_nested_blocks
A history with `marker` in every block, nested ones included. Its free-form data has `cache_control` keys of its own, and so do the `tool_changes`
tests/lib/threads/helpers.py:211
↓ 2 callers
Method
hold
(self, tool_use: BetaToolUseBlock | str)
src/anthropic/lib/tools/_beta_runner.py:1696
↓ 2 callers
Method
hold
Pause the countdown while a gated call is held or in flight.
src/anthropic/lib/tools/_beta_session_runner.py:224
↓ 2 callers
Method
hop_body
The hop's request body: the entry applied as a patch against the ORIGINAL request params (never a previous hop's patched body), extended
src/anthropic/lib/middleware/_fallbacks.py:1156
↓ 2 callers
Function
in_a_cycle
Drops `held` in a way that leaves it to the garbage collector to free it.
tests/utils.py:273
↓ 2 callers
Function
inject_trace_headers
Writes the trace context of `span` into `headers`, in place of any already there.
src/anthropic/_tracing.py:411
↓ 2 callers
Function
instrument
Runs `method` of the runner's class in a span named after it, as instrumentation that the SDK knows nothing about would: a patched library, or a c
tests/lib/tools/test_open_telemetry.py:208
↓ 2 callers
Function
is_async_callable
Whether calling `obj` returns a coroutine: an `async def` function, an object whose `__call__` is one, or a `functools.partial` of either.
src/anthropic/lib/tools/_toolsets/_base.py:445
↓ 2 callers
Function
is_base64_file_input
(obj: object)
src/anthropic/_files.py:25
↓ 2 callers
Function
is_basemodel_type
(type_: type)
src/anthropic/_models.py:622
↓ 2 callers
Function
is_content_query
Whether `query`, as `defined_query` gives it, has one of the `CONTENT_QUERY_PARAMS` or of `content_names`. `content_names` has the parameters tha
src/anthropic/_tracing.py:742
↓ 2 callers
Method
is_held
(self, tool_use: BetaToolUseBlock)
src/anthropic/lib/tools/_beta_runner.py:1701
↓ 2 callers
Function
is_literal_type
(type_: type[Any])
src/anthropic/_compat.py:39
↓ 2 callers
Method
is_path_legal
True for a path usable verbatim as a store location: absolute, no `..`.
src/anthropic/lib/tools/_file_store.py:94
↓ 2 callers
Method
is_path_visible
(self, path: str)
tests/lib/tools/toolsets/test_pipeline.py:281
↓ 2 callers
Function
is_required_type
(typ: type)
src/anthropic/_utils/_typing.py:44
↓ 2 callers
Function
is_sent_as_list
Whether a value that is not a mapping is sent as a JSON array, or as `key[]=` entries in a query. Sequences, sets, dict views and iterators (gene
src/anthropic/_utils/_json.py:35
↓ 2 callers
Function
is_sequence_t
(obj: _SequenceT | object)
src/anthropic/_utils/_utils.py:182
↓ 2 callers
Function
is_union
(tp: type[Any] | None)
src/anthropic/_compat.py:33
↓ 2 callers
Function
is_union_type
(typ: type)
src/anthropic/_utils/_typing.py:40
↓ 2 callers
Method
iter_bytes
Given an iterator that yields raw binary data, iterate over it & yield every event encountered
src/anthropic/_streaming.py:349
↓ 2 callers
Method
iter_lines
Like `iter_text()` but will only yield chunks for each line
src/anthropic/_response.py:405
↓ 2 callers
Function
jitter
Uniform random delay in `[low, high)` — spreads out retry storms.
src/anthropic/lib/_retry.py:37
↓ 2 callers
Method
json
Read and decode the JSON response content.
src/anthropic/_response.py:376
↓ 2 callers
Method
json
(self)
src/anthropic/_streaming.py:327
↓ 2 callers
Function
keep_only_bearer_auth
Drops the API key of `client` and the `Authorization` / `X-Api-Key` entries of its custom headers. What is left is the Bearer of its `auth_token`
src/anthropic/lib/_scoped_client.py:81
↓ 2 callers
Function
label_of
Names a stream event, given as JSON, after the block it belongs to, such as `a: content_block_stop`.
tests/lib/tools/test_runner_eager_tools.py:884
↓ 2 callers
Function
lexically_under
Whether `candidate`, normalised as text, is `directory` (as written or as it resolves) or below it.
src/anthropic/lib/tools/_toolsets/_security.py:135
↓ 2 callers
Method
list_tabs
( self, context: BetaToolsetCallContext, input: BetaBrowserListTabsInput )
tests/lib/tools/toolsets/_fakes.py:133
↓ 2 callers
Function
lookup
Lookup the population of a given city. Args: location: The city, e.g. San Francisco
tests/lib/threads/helpers.py:144
↓ 2 callers
Function
lookup_tool
A `lookup` tool that writes to `timeline` when it starts, and returns `value of <key>` unless `lookup` says otherwise.
tests/lib/tools/test_runner_eager_tools.py:999
↓ 2 callers
Function
make_async_vertex_client
(**kwargs: Any)
tests/test_middleware.py:1928
↓ 2 callers
Function
make_response
()
tests/test_exceptions.py:29
↓ 2 callers
Function
malformed_toolset_call_result
Build the error result for a call that is named after a toolset in the run but has no `toolset_name`. Its input holds actions for that toolset in
src/anthropic/lib/tools/_beta_runner.py:1751
↓ 2 callers
Method
mark_opened
(self)
src/anthropic/lib/middleware/_fallbacks.py:1149
↓ 2 callers
Function
marked_twice
A user message with two blocks, each with a `cache_control` marker.
tests/lib/threads/helpers.py:174
↓ 2 callers
Function
member_error_result
`classify` for the runner: the refusal as an `is_error` result, an unexpected exception logged first.
src/anthropic/lib/tools/_toolsets/_runnable.py:247
↓ 2 callers
Function
members_from_union
One `(name, input model)` per variant of a generated `tool_use` union, in its order. A variant whose `input` is typed as a bare object (a member t
src/anthropic/lib/tools/_toolsets/_base.py:424
↓ 2 callers
Function
model_parse
(model: type[_ModelT], data: Any)
src/anthropic/_compat.py:170
↓ 2 callers
Method
model_rebuild
( cls, *, force: bool = False, raise_errors: b
src/anthropic/_models.py:166
↓ 2 callers
Method
mouse_move
(self, context: BetaToolsetCallContext, input: BetaComputerMouseMoveInput)
tests/lib/tools/toolsets/_computer_fakes.py:66
↓ 2 callers
Method
navigate
(self, context: BetaToolsetCallContext, input: BetaBrowserNavigateInput)
tests/lib/tools/toolsets/_fakes.py:94
↓ 2 callers
Function
navigate_url
The `url` of a `navigate` call exactly as the model wrote it, for the URL policy. `None` for the history words `back` / `forward` / `reload` (the
src/anthropic/lib/tools/_toolsets/_pipeline.py:310
↓ 2 callers
Method
new_tab
(self, context: BetaToolsetCallContext, input: BetaBrowserNewTabInput)
tests/lib/tools/toolsets/_fakes.py:120
↓ 2 callers
Function
not_executed_result
(tool_use: BetaToolUseBlock)
src/anthropic/lib/tools/_toolsets/_runnable.py:212
↓ 2 callers
Method
on_claim
(self)
src/anthropic/lib/environments/_poller.py:73
↓ 2 callers
Method
on_empty_poll
(self)
src/anthropic/lib/environments/_poller.py:62
↓ 2 callers
Function
override_fields
`params` with every field that `overrides` sets replaced.
src/anthropic/lib/threads/_params.py:145
↓ 2 callers
Function
override_request_options
`options` with every request option that `overrides` sets replaced as a whole.
src/anthropic/lib/threads/_params.py:153
↓ 2 callers
Function
parent_id
(span: ReadableSpan)
tests/test_open_telemetry.py:226
↓ 2 callers
Function
parse_computer_input
`parse_input` for a computer member, plus the shape of each coordinate list: the generated models type them as lists of integers of any length, an
src/anthropic/lib/tools/_toolsets/_computer.py:396
↓ 2 callers
Function
parse_response
( *, output_format: ResponseFormatT | NotGiven, response: Message, )
src/anthropic/lib/_parse/_response.py:49
↓ 2 callers
Function
partition_async_tools
The async twin of `partition_sync_tools`: a synchronous runnable raises `wrong_flavour_error`.
src/anthropic/lib/tools/_tool_dispatch.py:105
↓ 2 callers
Function
partition_sync_tools
Split a synchronous `tool_runner`'s `tools` argument into the runnable objects the runner dispatches (function tools and toolsets) and the raw `to
src/anthropic/lib/tools/_tool_dispatch.py:87
↓ 2 callers
Function
paths
(browser: FakeBrowser)
tests/lib/tools/toolsets/test_enforcement.py:293
↓ 2 callers
Method
pending_seam_frames
(self)
src/anthropic/lib/middleware/_fallbacks.py:1146
↓ 2 callers
Function
policy
(ctx: object, url: str)
tests/lib/tools/toolsets/test_interface.py:190
↓ 2 callers
Function
policy_outcome
Turn what the `url_policy` callable did into the pipeline's decision: return to proceed, or raise the refusal the model reads. A `ToolError` it ra
src/anthropic/lib/tools/_toolsets/_pipeline.py:326
↓ 2 callers
Method
poll
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating se
src/anthropic/resources/beta/environments/work.py:445
↓ 2 callers
Method
put
Write `str` (UTF-8) or `bytes` atomically to the file at `rel_path`. Missing directories below the root are created; a missing root is not —
src/anthropic/lib/tools/_file_store.py:135
↓ 2 callers
Method
queue_seam
Queue the reached hop's `fallback` seam block at the next monotonic index. Queued seams are flushed by the hop reader once output reaches the
src/anthropic/lib/middleware/_fallbacks.py:1122
↓ 2 callers
Function
raised_content
The content `call()` raises for a refusal or failure. A string becomes one text block. A list of blocks is kept as raised, images included. `tool_
src/anthropic/lib/tools/_toolsets/_computer.py:418
↓ 2 callers
Method
range_is_collected
(self)
src/anthropic/lib/tools/_files.py:52
↓ 2 callers
Method
raw_events
Iterate the raw Server-Sent Events from `response`, before any JSON parsing or event-name filtering. This reads the response body dir
src/anthropic/_streaming.py:74
↓ 2 callers
Function
readable
The file object to read; any other `os.PathLike` is rejected without touching the filesystem.
src/anthropic/_utils/_prepare.py:195
↓ 2 callers
Function
record_response
Sets what the call's response gives its span. Never raises. That is the `RESPONSE_HEADER_ATTRIBUTES` and, for a call that succeeded, the `respons
src/anthropic/_tracing.py:650
↓ 2 callers
Method
recovers_from
Whether the turn should be sent again because `error` is a thread rejection this state has now adjusted for. With `"continue_unthreaded"` a re
src/anthropic/lib/threads/_thread_state.py:269
↓ 2 callers
Method
refresh
(self, _request: object)
tests/lib/test_vertex.py:666
↓ 2 callers
Function
reject_action_url_request
(options: FinalRequestOptions)
src/anthropic/lib/aws/_client.py:474
↓ 2 callers
Function
reject_thread_param
(thread: object)
src/anthropic/lib/threads/_params.py:123
↓ 2 callers
Function
reject_unexpected_keywords
Raise the `TypeError` of a signature that spells its keywords out, because `**params: Unpack[...]` takes any keyword at runtime and the thread wou
src/anthropic/lib/threads/_params.py:113
↓ 2 callers
Function
remove_trace_headers
Removes what `inject_trace_headers` sets, so that no signature covers a value that is replaced later.
src/anthropic/_tracing.py:417
↓ 2 callers
Function
replace_with_symlink_on_open
(monkeypatch: pytest.MonkeyPatch, path: Path, target: Path)
tests/lib/tools/memory_tools/test_filesystem.py:53
↓ 2 callers
Function
request
(*, extra_headers: Headers | None = None)
tests/utils.py:230
↓ 2 callers
Function
request_options
The given keyword arguments as `RequestOptions`, without the ones left at their "not given" default.
src/anthropic/lib/threads/_params.py:108
↓ 2 callers
Function
requests_with_file
The requests of a Message Batch whose one message has the image in `file`, which the client reads when it prepares the body.
tests/test_open_telemetry.py:264
↓ 2 callers
Function
resend_warnings
(caplog: pytest.LogCaptureFixture)
tests/lib/test_refusal_fallback.py:126
↓ 2 callers
Function
resend_warnings
(caplog: pytest.LogCaptureFixture)
tests/lib/test_refusal_fallback_streaming.py:179
↓ 2 callers
Function
resolve_identity_token_path
ctor arg → `ANTHROPIC_IDENTITY_TOKEN_FILE` → `None`.
src/anthropic/lib/credentials/_constants.py:214
↓ 2 callers
Function
result_blocks
The result blocks of server tools and MCP tools in the unions of content blocks.
tests/test_open_telemetry.py:8289
↓ 2 callers
Function
run
(key: str)
tests/lib/tools/test_runner_eager_tools.py:1005
↓ 2 callers
Function
run_runnable_tool
Call `tool` with `input`, awaiting the result if the tool is async. Sync tools run on a worker thread. If the caller cancels (for example on a
src/anthropic/lib/tools/_tool_dispatch.py:286
↓ 2 callers
Method
screenshot
(self, context: BetaToolsetCallContext, input: BetaBrowserScreenshotInput)
tests/lib/tools/toolsets/_fakes.py:106
↓ 2 callers
Method
screenshot
(self, context: BetaToolsetCallContext, input: BetaComputerScreenshotInput)
tests/lib/tools/toolsets/_computer_fakes.py:54
↓ 2 callers
Function
send_hop
Send a request built from `entry`, resending it once without `speed` when it inherited `fast` and was rejected with a capacity error. Also returns
src/anthropic/lib/middleware/_fallbacks.py:1500
↓ 2 callers
Method
sending
Counts `request`, which the SDK is about to send, and records the URL of the call's first request.
src/anthropic/_tracing.py:326
↓ 2 callers
Function
set_message_content
Sets the content attributes of a Messages create call, within `limit`, the client's `max_content_bytes`. `output` is the response's content, if i
src/anthropic/lib/_tracing/_content.py:393
↓ 2 callers
Method
set_params
Replace the request fields, tools and output format with those of `params`, so that one it leaves out is no longer sent, except the container
src/anthropic/lib/threads/_thread_state.py:173
↓ 2 callers
Function
set_resend_count
(span: Span, result: ApiCallResult)
src/anthropic/_tracing.py:645
↓ 2 callers
Function
set_response_attributes
Sets the `response` attributes that `SPAN_ATTRIBUTES` gives the spans named `span_name`, from `data`. `data` is the body of a response, as a mode
src/anthropic/_tracing.py:669
↓ 2 callers
Function
set_response_status_code
(span: Span, result: ApiCallResult)
src/anthropic/_tracing.py:639
↓ 2 callers
Function
set_tool_runner_status
Sets the status of a tool runner's span, if it has one: `OK`, or what `error` makes it. Never raises.
src/anthropic/lib/_tracing/_tools.py:67
↓ 2 callers
Function
set_usage_sums
Sets the usage attributes that are sums of fields of `message`, a Message as a model or as a decoded body. The compaction sums need `complete`, b
src/anthropic/lib/_tracing/_response.py:45
↓ 2 callers
Function
short_circuit_message
(*, model: str = "claude-opus-4-6")
tests/test_middleware.py:363
↓ 2 callers
Function
sigv4_signature
The SigV4 signature of `request` as it was sent, over the headers that its `Authorization` header lists.
tests/test_open_telemetry.py:239
↓ 2 callers
Function
start
(event_id: str)
tests/lib/sessions/test_accumulate.py:21
↓ 2 callers
Method
start
(cls, workdir: str | os.PathLike[str], *, env: Optional[Mapping[str, str]] = None)
src/anthropic/lib/tools/agent_toolset.py:485
↓ 2 callers
Function
start_api_call_span
Starts the call span of the API call that the prepared `options` describe. `stream` is whether the call streams its response, and `default_header
src/anthropic/_tracing.py:363
↓ 2 callers
Function
static_credential_from_env
The `(api_key, auth_token)` that the environment supplies. At most one of the two is set. With `warn`, logs what that credential shadows: `ANTHRO
src/anthropic/_client.py:98
↓ 2 callers
Method
stop_threading
Drop the `thread` field from this turn and every later one.
src/anthropic/lib/threads/_thread_state.py:305
← previous
next →
1,101–1,200 of 12,274, ranked by callers