Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
13,873 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
13,873
◇
Types & classes
4,472
↳
Endpoints
93
↓ 2 callers
Function
_project_from_credentials
Best-effort project from an explicit credentials object — service-account / impersonated credentials usually know theirs.
src/anthropic/lib/google_cloud/_client.py:230
↓ 2 callers
Function
_raise_token_endpoint_error
Raise a redacted `WorkloadIdentityError` from a non-200 token-endpoint response. Shared between the jwt-bearer exchange path in this module and t
src/anthropic/lib/credentials/_workload.py:73
↓ 2 callers
Function
_read_active_config_pointer
Return the stripped contents of `<config_dir>/active_config`, or `None` if the pointer file is missing or empty.
src/anthropic/lib/credentials/_constants.py:84
↓ 2 callers
Method
_read_credentials
Read the credentials file. Re-reads on every call — daemons rotate it. Secret values in the returned dict (every string field not in
src/anthropic/lib/credentials/_providers.py:368
↓ 2 callers
Method
_read_tools
Take the runnable tools and the request definitions from the tools. A list is kept as given and read again for each turn, like any other field
src/anthropic/lib/threads/_thread_state.py:150
↓ 2 callers
Function
_redact_authorization
(response: httpx2.Response)
tests/lib/test_credentials.py:2487
↓ 2 callers
Function
_refusal_category
The policy category that caused the refusal; only the beta surface carries one.
src/anthropic/lib/middleware/_fallbacks.py:1431
↓ 2 callers
Function
_refusal_with_tool_use
()
tests/lib/tools/test_runners.py:556
↓ 2 callers
Method
_register_compaction_response
( self, thread: ThreadT, message: ParsedBetaMessage[ResponseFormatT], compacted_count: int )
src/anthropic/lib/tools/_beta_runner.py:427
↓ 2 callers
Function
_reject_compaction_param
(params: ParseMessageCreateParamsBase[Any])
src/anthropic/lib/tools/_beta_runner.py:134
↓ 2 callers
Function
_reject_skip_auth_conflict
( *, skip_auth: bool, token_provider: object | None, credentials: object | None, )
src/anthropic/lib/google_cloud/_client.py:217
↓ 2 callers
Method
_remove_saved_output
(self)
src/anthropic/lib/tools/agent_toolset.py:681
↓ 2 callers
Method
_repeats_last_reply
Whether `message` is the reply last recorded, as returned, or a copy of it appended right after it.
src/anthropic/lib/threads/_thread_state.py:118
↓ 2 callers
Function
_request
(*, extra: str = "vertex")
src/anthropic/lib/_extras/_google_auth.py:38
↓ 2 callers
Method
_requeue
(self, item: Item)
tests/lib/environments/_fake_work_api.py:480
↓ 2 callers
Function
_require_env
(name: str)
examples/managed-agents-observe-tool-calls.py:45
↓ 2 callers
Method
_require_utf8
(self, rel_path: str, data: bytes)
src/anthropic/lib/tools/_file_store.py:258
↓ 2 callers
Function
_resolve_base_url
base_url (arg or `ANTHROPIC_GOOGLE_CLOUD_BASE_URL`, resolved by the caller) > derived template. Returns `None` when derivation must wait for
src/anthropic/lib/google_cloud/_client.py:187
↓ 2 callers
Method
_resolve_deferred_base_url
Derive and set the real base URL once the project is known. Called on every request (after the project back-fill from ADC, if any); a
src/anthropic/lib/google_cloud/_client.py:155
↓ 2 callers
Function
_resolve_mantle_config
Resolve and validate all Mantle client configuration. Returns (resolved_api_key, resolved_base_url, use_sigv4, merged_headers).
src/anthropic/lib/bedrock/_mantle.py:93
↓ 2 callers
Function
_resolve_readable_path
(ctx: AgentToolContext, p: str)
src/anthropic/lib/tools/agent_toolset.py:443
↓ 2 callers
Function
_resolve_under
Assert `candidate` resolves to a descendant of `base`, return it verbatim. The containment check uses `resolve(strict=False)` on both sides so
src/anthropic/lib/credentials/_constants.py:157
↓ 2 callers
Function
_resource_contents_to_block
Convert MCP resource contents to an Anthropic content block.
src/anthropic/lib/tools/mcp.py:163
↓ 2 callers
Method
_respond
(self, request: Request)
tests/lib/environments/_fake_work_api.py:363
↓ 2 callers
Method
_run
(self)
src/anthropic/lib/tools/_beta_session_runner.py:369
↓ 2 callers
Function
_runner_fields
(tool: object, fields: dict[str, Any])
tests/lib/threads/helpers.py:122
↓ 2 callers
Function
_safe_member_name
Return `name` as a confined relative path, or raise on path-traversal. Strips `.` components; rejects absolute paths and any `..` component o
src/anthropic/lib/tools/_skills.py:48
↓ 2 callers
Method
_saved_output_dirs
(self)
src/anthropic/lib/tools/agent_toolset.py:320
↓ 2 callers
Function
_seamed_http_response
A copy of the served hop's response with `seams` prepended to its `content`, or `None` when the body isn't the expected message shape. The ca
src/anthropic/lib/middleware/_fallbacks.py:1448
↓ 2 callers
Method
_send
(self, messages: Iterable[BetaMessageParam | BetaMessage], overrides: TurnOverrides)
src/anthropic/lib/threads/_beta_threads.py:309
↓ 2 callers
Method
_send
(self, messages: Iterable[BetaMessageParam | BetaMessage], overrides: TurnOverrides)
src/anthropic/lib/threads/_beta_threads.py:522
↓ 2 callers
Method
_send
(self, event: Event)
tests/lib/tools/_fake_sessions_api.py:619
↓ 2 callers
Method
_send
(self)
tests/lib/tools/test_runner_eager_tools.py:975
↓ 2 callers
Method
_send_pending_tool_changes
(self, hold: bool)
src/anthropic/lib/tools/_beta_runner.py:545
↓ 2 callers
Function
_serialize_sse
Serialize an event back to its SSE wire form (`event: ...\\ndata: ...\\n\\n`). Multi-line `data` is emitted as one `data:` line per line, matchin
src/anthropic/lib/middleware/_fallbacks.py:1635
↓ 2 callers
Function
_serving
A toolset class that serves `members` and nothing else, on the synchronous class or (`twin`) the async one.
tests/lib/tools/toolsets/test_computer_interface.py:241
↓ 2 callers
Method
_set_private_attributes
( self, client: SyncAPIClient, model: Type[_T], options: FinalRequestOptions,
src/anthropic/_base_client.py:286
↓ 2 callers
Method
_settle_sent
Resolve the uploads whose response never arrived, against a fresh listing. A memory holding exactly the sha that was sent is that upload, sav
src/anthropic/lib/tools/_memories.py:606
↓ 2 callers
Method
_should_retry_exception
Whether an exception raised by a request attempt should be retried. Also returns the HTTP response behind the failure, when there is one, so
src/anthropic/_base_client.py:977
↓ 2 callers
Method
_should_stop
(self)
src/anthropic/lib/tools/_beta_runner.py:553
↓ 2 callers
Method
_should_stream_response_body
(self, request: httpx2.Request)
src/anthropic/_base_client.py:762
↓ 2 callers
Method
_shrink
(self, request: APIRequest)
tests/test_middleware.py:162
↓ 2 callers
Function
_spliced_http_response
A synthetic response standing in for `original`, with `stream` as its body. The spliced frames are emitted post-decode, so the original's con
src/anthropic/lib/middleware/_fallbacks.py:1674
↓ 2 callers
Function
_split_lines_keeping_cr
Split on LF only (keeping any CR), without the empty tail a trailing newline leaves.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:368
↓ 2 callers
Method
_stamp_and_pull
Write the trust marker, then pull every remote memory; pushes nothing. The baseline is cleared and rebuilt from successful writes only, so a
src/anthropic/lib/tools/_memories.py:620
↓ 2 callers
Method
_start_index
The chain entry this request starts at (-1 = the original params). Only an explicit `BetaFallbackState` pin moves the start; without one
src/anthropic/lib/middleware/_fallbacks.py:370
↓ 2 callers
Method
_start_shell
(self)
src/anthropic/lib/tools/agent_toolset.py:315
↓ 2 callers
Method
_start_tool_runner_span
Starts the `anthropic.messages.tool_runner` span of one run, or returns `None` when tracing is off.
src/anthropic/lib/tools/_beta_runner.py:259
↓ 2 callers
Method
_stop
(self, item: Item)
tests/lib/environments/_fake_work_api.py:474
↓ 2 callers
Method
_store_turn
Move what was staged into the stored history, followed by `reply` if there is one.
src/anthropic/lib/threads/_thread_state.py:379
↓ 2 callers
Function
_streamed_responses
()
tests/lib/tools/test_runners.py:3495
↓ 2 callers
Function
_strip_seam_blocks
A copy of `body` with `{type: "fallback"}` seam blocks filtered out of the replayed message history; `body` itself when there are none. An as
src/anthropic/lib/middleware/_fallbacks.py:1379
↓ 2 callers
Function
_strip_top
Drop the leading `top` component from `safe` (an already-confined relative path). Returns `""` for the bare top-dir entry itself.
src/anthropic/lib/tools/_skills.py:116
↓ 2 callers
Method
_take_compaction_thread
A fork of the thread that sends the compaction request: the whole history and the thread's fields plus `compaction`, minus what `_without_comp
src/anthropic/lib/tools/_beta_runner.py:391
↓ 2 callers
Function
_to_iteration_usage
( type: Literal["message", "fallback_message"], model: str, usage: dict[str, Any] | None )
src/anthropic/lib/middleware/_fallbacks.py:1649
↓ 2 callers
Function
_to_message_param
(message: BetaMessageParam | BetaMessage)
src/anthropic/lib/threads/_thread_state.py:686
↓ 2 callers
Function
_to_prefill_blocks
Convert a hop's accumulated response blocks to the appended assistant turn. A `fallback_has_prefill_claim` refusal guarantees the partial output
src/anthropic/lib/middleware/_fallbacks.py:1349
↓ 2 callers
Function
_tool_runner_responses
()
tests/lib/test_vertex.py:127
↓ 2 callers
Function
_tool_runner_responses
()
tests/lib/test_bedrock.py:756
↓ 2 callers
Method
_toolset_check_tool_use
(self, tool_use: BetaToolUseBlock)
src/anthropic/lib/tools/_toolsets/_runnable.py:100
↓ 2 callers
Method
_toolset_for
(self, tool_use: BetaToolUseBlock)
src/anthropic/lib/tools/_beta_runner.py:577
↓ 2 callers
Method
_toolset_not_found_result
(tool_use: BetaToolUseBlock)
src/anthropic/lib/tools/_beta_runner.py:593
↓ 2 callers
Method
_turn_params
The thread's request fields with this turn's overrides, and the output format as `output_config`.
src/anthropic/lib/threads/_thread_state.py:444
↓ 2 callers
Method
_unwrapping
(self)
tests/lib/environments/_schedules.py:250
↓ 2 callers
Method
_upload
Push one local file; `None` keeps the old baseline so the next pass retries. A refusal the server would repeat (400/413, the utf-8 gate) ente
src/anthropic/lib/tools/_memories.py:824
↓ 2 callers
Function
_user_agent
`User-Agent` value sent on token-endpoint POSTs. Computed lazily so this module doesn't need to import `_version` at module load time (the cr
src/anthropic/lib/credentials/_constants.py:52
↓ 2 callers
Function
_validate_no_symlink_escape
(target_path: Path, memory_root: Path)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:339
↓ 2 callers
Function
_warn_once
Emit a log warning at most once per `key` per process.
src/anthropic/lib/credentials/_auth.py:21
↓ 2 callers
Function
_weather_then_browser_replies
(stream: bool)
tests/lib/tools/test_runners.py:3579
↓ 2 callers
Function
_with_middleware_headers
A copy of `request` with `betas` appended to its `anthropic-beta` header (skipping values already present) and the middleware's helper-telemetry t
src/anthropic/lib/middleware/_fallbacks.py:1410
↓ 2 callers
Function
_with_tools
(*tools: Any)
tests/lib/tools/toolsets/test_browser_runner.py:576
↓ 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:755
↓ 2 callers
Method
_yield
( self, call: DispatchedToolUseEvent, confirmation: Literal["allow", "deny"] | None,
src/anthropic/lib/tools/_beta_session_runner.py:661
↓ 2 callers
Function
_zip_unix_mode
(info: zipfile.ZipInfo)
src/anthropic/lib/tools/_skills.py:100
↓ 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
Method
after_empty_poll
(self)
src/anthropic/lib/environments/_poller.py:67
↓ 2 callers
Method
after_failed_poll
(self, error: Exception)
src/anthropic/lib/environments/_poller.py:54
↓ 2 callers
Function
agent_with_skills
(*ids: str, version: str = "latest")
tests/lib/environments/_fake_work_api.py:552
↓ 2 callers
Function
aiter_work
Async version of `iter_work`. See its docstring for semantics, including how `extra_headers` is passed through per request.
src/anthropic/lib/environments/_poller.py:236
↓ 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
apply
(at: float, *step: Any)
tests/lib/tools/_fake_sessions_api.py:938
↓ 2 callers
Method
apply
(self, ev: BetaManagedAgentsSessionEvent | BetaManagedAgentsStreamSessionEvents)
src/anthropic/lib/tools/_beta_session_runner.py:748
↓ 2 callers
Method
apply_first_steps
(self)
tests/lib/environments/_schedules.py:48
↓ 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_citations_response
(events: list[ParsedMessageStreamEvent[None]])
tests/lib/streaming/test_messages.py:204
↓ 2 callers
Function
assert_citations_response
(events: list[ParsedBetaMessageStreamEvent])
tests/lib/streaming/test_beta_messages.py:358
↓ 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:392
↓ 2 callers
Function
assert_fallback_credit_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:366
↓ 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:417
↓ 2 callers
Function
assert_message_delta_fields_response
(message: Message)
tests/lib/streaming/test_messages.py:234
↓ 2 callers
Function
assert_message_delta_fields_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:374
↓ 2 callers
Function
assert_message_delta_omitted_usage_response
(message: Message)
tests/lib/streaming/test_messages.py:252
↓ 2 callers
Function
assert_refusal_response
(message: Message)
tests/lib/streaming/test_messages.py:226
↓ 2 callers
Function
assert_refusal_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:285
← previous
next →
1,001–1,100 of 13,873, ranked by callers