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
Method
_write
Write a memory's content to disk; `False` (and a warning) on failure. A `..` component in the wire path reaches here as `FileStoreErr
src/anthropic/lib/tools/_memories.py:731
↓ 2 callers
Function
_zip_unix_mode
(info: zipfile.ZipInfo)
src/anthropic/lib/tools/_skills.py:98
↓ 2 callers
Method
absorb_refusal
Fold a refused hop's outcome in, readying the next hop.
src/anthropic/lib/middleware/_fallbacks.py:1178
↓ 2 callers
Method
ack
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:297
↓ 2 callers
Method
aclose
(self)
tests/test_open_telemetry.py:649
↓ 2 callers
Function
aclose_runnable_tool
Run a runnable tool's optional cleanup. Drives the legacy `aclose` / `close` attribute (awaited if it returns an awaitable) and, when the too
src/anthropic/lib/tools/_beta_functions.py:318
↓ 2 callers
Method
api_call_start_attributes
The attributes that the span of every API call starts with, so that a sampler sees them.
src/anthropic/lib/_tracing/_config.py:35
↓ 2 callers
Function
ask_for_global_tracer_provider_again
Makes the SDK forget whether OpenTelemetry could load its global tracer provider, which it asks once a process.
tests/test_open_telemetry.py:8214
↓ 2 callers
Function
assert_basic_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:61
↓ 2 callers
Function
assert_basic_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:237
↓ 2 callers
Function
assert_compaction_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:275
↓ 2 callers
Function
assert_context_management_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:384
↓ 2 callers
Function
assert_fallback_credit_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:358
↓ 2 callers
Function
assert_fallback_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:305
↓ 2 callers
Function
assert_input_transformations_response
(message: BetaMessage, expected: List[Dict[str, str]])
tests/lib/streaming/test_beta_messages.py:409
↓ 2 callers
Function
assert_message_delta_fields_response
(message: Message)
tests/lib/streaming/test_messages.py:226
↓ 2 callers
Function
assert_message_delta_fields_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:366
↓ 2 callers
Function
assert_message_delta_omitted_usage_response
(message: Message)
tests/lib/streaming/test_messages.py:244
↓ 2 callers
Function
assert_refusal_response
(message: Message)
tests/lib/streaming/test_messages.py:218
↓ 2 callers
Function
assert_refusal_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:285
↓ 2 callers
Function
assert_server_tool_use_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:168
↓ 2 callers
Function
assert_server_tool_use_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:338
↓ 2 callers
Function
assert_span_has_no_sampling_attributes
(span: ReadableSpan)
tests/test_open_telemetry.py:885
↓ 2 callers
Function
assert_span_has_nothing_that_message_delta_gives
(span: ReadableSpan)
tests/test_open_telemetry.py:870
↓ 2 callers
Function
assert_span_has_what_message_delta_gave
(span: ReadableSpan, *, beta: bool)
tests/test_open_telemetry.py:854
↓ 2 callers
Function
assert_time_to_first_chunk_is_set_at_the_first_delta
`times` has the type of each event that the application read, and the span's time to first chunk then.
tests/test_open_telemetry.py:709
↓ 2 callers
Function
assert_tool_use_caller_unset
(message: Message)
tests/lib/streaming/test_messages.py:208
↓ 2 callers
Function
assert_tool_use_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:116
↓ 2 callers
Function
assert_tool_use_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:265
↓ 2 callers
Function
assert_unknown_events_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:90
↓ 2 callers
Function
assert_unknown_events_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:242
↓ 2 callers
Function
async_collect
Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open.
tests/utils.py:290
↓ 2 callers
Function
async_send_hop
( request: APIRequest, entry: BetaFallbackParam, call_next: AsyncCallNext )
src/anthropic/lib/middleware/_fallbacks.py:1515
↓ 2 callers
Function
attribute_value
`value` as an attribute of `type`, and `None` for a value of another type. So a body that this version of the SDK does not know sets no attribute
src/anthropic/_tracing.py:819
↓ 2 callers
Function
b64encode
(file: Base64FileInput, content: object)
src/anthropic/_utils/_prepare.py:203
↓ 2 callers
Function
backoff
Exponential backoff for `attempt` (1-indexed), capped at `cap`.
src/anthropic/lib/_retry.py:32
↓ 2 callers
Method
begin
(self)
src/anthropic/_tracing.py:522
↓ 2 callers
Method
begin
The chain state after stream A's chainable refusal. `body` is the original request params (pre-pin) — the base every hop patches; `in
src/anthropic/lib/middleware/_fallbacks.py:1096
↓ 2 callers
Function
build_events
( *, event: BetaRawMessageStreamEvent, message_snapshot: ParsedBetaMessage[ResponseFormatT], )
src/anthropic/lib/streaming/_beta_messages.py:383
↓ 2 callers
Function
build_events
( *, event: RawMessageStreamEvent, message_snapshot: ParsedMessage[ResponseFormatT], )
src/anthropic/lib/streaming/_messages.py:366
↓ 2 callers
Method
check_create_only_fields
(self, params: ThreadFields)
src/anthropic/lib/threads/_thread_state.py:507
↓ 2 callers
Function
check_files
`allowed` gives the committed path of each file's name in the archive
scripts/utils/check-dist.py:186
↓ 2 callers
Method
check_next_turn
Raise what the next turn with `overrides` would raise before it is sent.
src/anthropic/lib/threads/_thread_state.py:421
↓ 2 callers
Function
check_sync_hook
Raise when `hook` (`confirm`, or a family's own hook) is async and `cls` is a synchronous toolset. The asynchronous classes take either kind.
src/anthropic/lib/tools/_toolsets/_base.py:466
↓ 2 callers
Method
close
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/_response.py:381
↓ 2 callers
Method
close
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/_streaming.py:143
↓ 2 callers
Method
close
Close the owned `httpx2.Client` if we created one.
src/anthropic/lib/credentials/_providers.py:438
↓ 2 callers
Method
close
Close the underlying `httpx2.Client` if we created it.
src/anthropic/lib/credentials/_workload.py:229
↓ 2 callers
Function
close_stream
Closes `result` when it is a stream, which ends the span of its call.
tests/test_open_telemetry.py:3726
↓ 2 callers
Method
close_tab
(self, context: BetaToolsetCallContext, input: BetaBrowserCloseTabInput)
tests/lib/tools/toolsets/_fakes.py:150
↓ 2 callers
Function
coerce_boolean
(val: str)
src/anthropic/_utils/_utils.py:359
↓ 2 callers
Function
collect
Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open.
tests/utils.py:279
↓ 2 callers
Function
confirm
(context: BetaConfirmContext)
tests/lib/tools/toolsets/test_confirm.py:49
↓ 2 callers
Function
confirm_outcome
Turn what the `confirm` callable did into the gate's decision: return to proceed, or raise the refusal the model reads. A `ToolError` that `c
src/anthropic/lib/tools/_toolsets/_base.py:532
↓ 2 callers
Function
constructor_arguments_error
The error for a tool runner constructor call that has neither of the two sets of `arguments`, or both.
src/anthropic/lib/tools/_beta_runner.py:1739
↓ 2 callers
Method
content_blocks
The accumulated content blocks, in start order.
src/anthropic/lib/middleware/_fallbacks.py:1283
↓ 2 callers
Method
continuation
(self)
src/anthropic/lib/middleware/_fallbacks.py:1153
↓ 2 callers
Method
copy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/bedrock/_mantle.py:463
↓ 2 callers
Function
copy_tree
Returns `[copied data]` and the slots whose file input is still to be read (in a body only).
src/anthropic/_utils/_prepare.py:85
↓ 2 callers
Method
create_arguments
Settle the `thread` field for this turn and build its `create()` keyword arguments except `stream`: request fields, betas, the delta or full h
src/anthropic/lib/threads/_thread_state.py:386
↓ 2 callers
Method
cursor_position
( self, context: BetaToolsetCallContext, input: BetaComputerCursorPositionInput )
tests/lib/tools/toolsets/_computer_fakes.py:60
↓ 2 callers
Function
decompress
`None` unless `data` is one whole stream
scripts/utils/check-dist.py:115
↓ 2 callers
Function
defined_query
The pairs of `query`, as sent, whose parameter is one of `names`, which an endpoint defines. A name is one of them when, percent-decoded, it is i
src/anthropic/_tracing.py:724
↓ 2 callers
Method
delete
Delete File Args: file_id: ID of the File. workspace_id: Optional header to select the Workspace for this reque
src/anthropic/resources/files.py:134
↓ 2 callers
Function
edit
Replace text in a file by exact string match.
src/anthropic/lib/tools/agent_toolset.py:764
↓ 2 callers
Function
empty_message
()
tests/lib/tools/test_runner_eager_tools.py:896
↓ 2 callers
Function
end_api_call_span
Ends the call span with the call's `result`. A span that already ended is left alone.
src/anthropic/_tracing.py:424
↓ 2 callers
Function
end_tool_runner_span
Ends a tool runner's span, if it has one. Never raises.
src/anthropic/lib/_tracing/_tools.py:80
↓ 2 callers
Function
ends_turn
Whether `ev` is a `session.status_idle` whose turn is over. Only `requires_action` leaves the turn open: the session resumes once a client re
src/anthropic/lib/tools/_beta_session_runner.py:1153
↓ 2 callers
Function
error_content
(error: ToolError)
src/anthropic/lib/tools/_toolsets/_base.py:546
↓ 2 callers
Function
error_text_content
The text blocks of a `ToolError`'s content. Deliberate: the API accepts only text on an `is_error` result and answers anything else with a 400 tha
src/anthropic/lib/tools/_toolsets/_sanitize.py:81
↓ 2 callers
Function
event_by_event
(canned: Reply, *, fails_before: str | None = None)
tests/lib/tools/test_runner_eager_tools.py:995
↓ 2 callers
Function
events_before_message_delta
The events of a stream that ends before `message_delta`, whose `message_start` has every placeholder.
tests/test_open_telemetry.py:847
↓ 2 callers
Function
events_with_first_delta
The events of `stream_events` with `delta`, twice, as the deltas of `content_block`, and a `ping` before them.
tests/test_open_telemetry.py:691
↓ 2 callers
Function
events_without_a_delta
The events of `stream_events`, with the text block whole in its `content_block_start`.
tests/test_open_telemetry.py:719
↓ 2 callers
Function
extract_error_code
(body: object)
src/anthropic/_exceptions.py:262
↓ 2 callers
Function
extract_property
Follows `path` through nested mappings. Returns `None` once a value is not a mapping or lacks the next key.
src/anthropic/_utils/_utils.py:426
↓ 2 callers
Function
fallback
The block a refusal starts when it hands the reply to a fallback model.
tests/lib/tools/test_runner_eager_tools.py:825
↓ 2 callers
Function
fallback_reply
The reply of `fallback_response()`.
tests/lib/threads/helpers.py:350
↓ 2 callers
Function
fallback_response
A reply that `FALLBACK_MODEL` wrote after `MODEL` declined, with the block that marks the hand-over.
tests/lib/threads/helpers.py:366
↓ 2 callers
Function
fallback_stream_events
The events of `stream_events`, after a `fallback` block: another model serves the rest of the response.
tests/test_open_telemetry.py:803
↓ 2 callers
Method
feed
Process one event, returning the frames to forward for it.
src/anthropic/lib/middleware/_fallbacks.py:859
↓ 2 callers
Function
field_get_default
(field: FieldInfo)
src/anthropic/_compat.py:88
↓ 2 callers
Function
file_name
(file: FileContent)
src/anthropic/_files.py:80
↓ 2 callers
Function
finish
Await `result` if it is the coroutine of an async thread's `send()` or `parse()`, which runs nothing until then.
tests/lib/threads/test_beta_threads.py:2267
↓ 2 callers
Method
finish
The session's last sync — once, at a clean end. Same reconciliation as the cadence syncs, but server deletes skip the waiting window
src/anthropic/lib/tools/_memories.py:342
↓ 2 callers
Method
finish
The outcome once the hop's stream is fully consumed (or cut early).
src/anthropic/lib/middleware/_fallbacks.py:1020
↓ 2 callers
Method
finish_frames
Frames still owed when the stream ends without a chainable refusal.
src/anthropic/lib/middleware/_fallbacks.py:1014
↓ 2 callers
Function
flatten
(t: Iterable[Iterable[_T]])
src/anthropic/_utils/_utils.py:33
↓ 2 callers
Function
get_architecture
()
src/anthropic/_base_client.py:2708
↓ 2 callers
Function
get_environment_proxies
Gets the proxy mappings based on environment variables. We use our own logic to parse these variables, as HTTPX doesn’t allow full config
src/anthropic/_utils/_httpx.py:32
↓ 2 callers
Method
get_next_page
(self: SyncPageT)
src/anthropic/_base_client.py:321
↓ 2 callers
Method
get_page_text
(self, context: BetaToolsetCallContext, input: BetaBrowserGetPageTextInput)
tests/lib/tools/toolsets/_fakes.py:116
↓ 2 callers
Function
get_platform
()
src/anthropic/_base_client.py:2629
↓ 2 callers
Function
get_tool_use_response_without_caller
()
tests/lib/streaming/test_messages.py:204
↓ 2 callers
Method
handler
(_request: httpx2.Request)
tests/test_open_telemetry.py:2580
↓ 2 callers
Function
has_explicit_credential
Whether one of a client's credential arguments was passed. Raises `ValueError` for more than one.
src/anthropic/_client.py:89
↓ 2 callers
Method
has_next_page
(self)
src/anthropic/_base_client.py:237
↓ 2 callers
Method
held
(self)
src/anthropic/lib/tools/_beta_runner.py:1704
↓ 2 callers
Function
helper_tags
(index: int)
tests/lib/tools/toolsets/test_runner.py:819
← previous
next →
1,001–1,100 of 12,274, ranked by callers