MCPcopy Create free account

hub / github.com/anthropics/anthropic-sdk-python / functions

Functions9,455 in github.com/anthropics/anthropic-sdk-python

↓ 2 callersMethod_prepare_request
(self, request: httpx2.Request)
src/anthropic/lib/bedrock/_mantle.py:251
↓ 2 callersMethod_process_response
( self, *, cast_to: Type[ResponseT], options: FinalRequestOptions, res
src/anthropic/_base_client.py:1376
↓ 2 callersMethod_process_response
( self, *, cast_to: Type[ResponseT], options: FinalRequestOptions, res
src/anthropic/_base_client.py:2109
↓ 2 callersFunction_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:176
↓ 2 callersFunction_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:76
↓ 2 callersFunction_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:88
↓ 2 callersMethod_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:366
↓ 2 callersFunction_refusal_category
The policy category that caused the refusal; only the beta surface carries one.
src/anthropic/lib/middleware/_fallbacks.py:1417
↓ 2 callersFunction_refusal_with_tool_use
()
tests/lib/tools/test_runners.py:594
↓ 2 callersMethod_register_compaction_response
(self, message: ParsedBetaMessage[ResponseFormatT])
src/anthropic/lib/tools/_beta_runner.py:296
↓ 2 callersFunction_reject_compaction_param
(params: ParseMessageCreateParamsBase[Any])
src/anthropic/lib/tools/_beta_runner.py:120
↓ 2 callersFunction_reject_skip_auth_conflict
( *, skip_auth: bool, token_provider: object | None, credentials: object | None, )
src/anthropic/lib/google_cloud/_client.py:163
↓ 2 callersFunction_request
(*, extra: str = "vertex")
src/anthropic/lib/_extras/_google_auth.py:38
↓ 2 callersFunction_require_env
(name: str)
examples/managed-agents-observe-tool-calls.py:45
↓ 2 callersMethod_require_utf8
(self, rel_path: str, data: bytes)
src/anthropic/lib/tools/_file_store.py:258
↓ 2 callersFunction_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:133
↓ 2 callersMethod_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:111
↓ 2 callersMethod_resolve_denied
Resolve a denied call without executing it. The denial itself resolves the call server-side — no result event will ever be posted for
src/anthropic/lib/tools/_beta_session_runner.py:780
↓ 2 callersFunction_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:97
↓ 2 callersFunction_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:161
↓ 2 callersFunction_resource_contents_to_block
Convert MCP resource contents to an Anthropic content block.
src/anthropic/lib/tools/mcp.py:163
↓ 2 callersFunction_result_content
The content blocks the runner computed and posted back, as carried in `result` (the flat `content` convenience field was removed).
tests/lib/tools/test_session_runner.py:118
↓ 2 callersMethod_route_tool_event
Enqueue `ev` for dispatch, honoring its evaluated permission. A builtin call the server gated behind user confirmation (`evaluated_pe
src/anthropic/lib/tools/_beta_session_runner.py:702
↓ 2 callersMethod_run
Drive the session tool loop, yielding an iterator of `DispatchedToolCall`. `__aiter__` (and the module-level `_run_session_tools` shim
src/anthropic/lib/tools/_beta_session_runner.py:487
↓ 2 callersFunction_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:47
↓ 2 callersFunction_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:1434
↓ 2 callersMethod_send
(self)
tests/lib/tools/test_runner_eager_tools.py:975
↓ 2 callersMethod_send_pending_tool_changes
(self, hold: bool)
src/anthropic/lib/tools/_beta_runner.py:370
↓ 2 callersFunction_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:1578
↓ 2 callersFunction_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 callersFunction_sessions_token_from_secret
Extract the per-item sessions token from a work item's `secret` payload. The `secret` the poll response populates is not itself a credential: it
src/anthropic/lib/environments/_worker.py:263
↓ 2 callersMethod_set_private_attributes
( self, client: SyncAPIClient, model: Type[_T], options: FinalRequestOptions,
src/anthropic/_base_client.py:270
↓ 2 callersMethod_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:584
↓ 2 callersMethod_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:898
↓ 2 callersMethod_should_stop
(self)
src/anthropic/lib/tools/_beta_runner.py:381
↓ 2 callersMethod_should_stream_response_body
(self, request: httpx2.Request)
src/anthropic/_base_client.py:683
↓ 2 callersMethod_shrink
(self, request: APIRequest)
tests/test_middleware.py:161
↓ 2 callersFunction_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:1617
↓ 2 callersFunction_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:364
↓ 2 callersFunction_sse_message
(content_block: Dict[str, Any], stop_reason: str, *deltas: Dict[str, Any])
tests/lib/tools/test_runners.py:3428
↓ 2 callersMethod_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:598
↓ 2 callersMethod_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:356
↓ 2 callersFunction_streamed_responses
()
tests/lib/tools/test_runners.py:3457
↓ 2 callersFunction_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:1365
↓ 2 callersFunction_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:115
↓ 2 callersMethod_surface_call
Yield `call` to the consumer, tolerating a consumer that left early. `BrokenResourceError` — the consumer broke out of the iterator;
src/anthropic/lib/tools/_beta_session_runner.py:802
↓ 2 callersFunction_to_iteration_usage
( type: Literal["message", "fallback_message"], model: str, usage: dict[str, Any] | None )
src/anthropic/lib/middleware/_fallbacks.py:1592
↓ 2 callersFunction_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:1335
↓ 2 callersFunction_tool_runner_responses
()
tests/lib/test_vertex.py:44
↓ 2 callersFunction_tool_runner_responses
()
tests/lib/test_bedrock.py:527
↓ 2 callersMethod_toolset_check_tool_use
(self, tool_use: BetaToolUseBlock)
src/anthropic/lib/tools/_toolsets/_runnable.py:100
↓ 2 callersMethod_toolset_for
(self, tool_use: BetaToolUseBlock)
src/anthropic/lib/tools/_beta_runner.py:402
↓ 2 callersMethod_toolset_not_found_result
(tool_use: BetaToolUseBlock)
src/anthropic/lib/tools/_beta_runner.py:418
↓ 2 callersMethod_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:799
↓ 2 callersFunction_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:56
↓ 2 callersFunction_warn_env_shadow
Warn when an `ANTHROPIC_API_KEY` / `ANTHROPIC_AUTH_TOKEN` from the environment is set alongside signals that would normally drive profile / fe
src/anthropic/_client.py:98
↓ 2 callersFunction_warn_explicit_shadow
Warn when an explicit `api_key=` / `auth_token=` argument shadows an explicit `credentials=` provider. Call *after* any copy-inheritance mergi
src/anthropic/_client.py:86
↓ 2 callersFunction_warn_once
Emit a log warning at most once per `key` per process.
src/anthropic/lib/credentials/_auth.py:21
↓ 2 callersFunction_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:1396
↓ 2 callersMethod_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 callersFunction_zip_unix_mode
(info: zipfile.ZipInfo)
src/anthropic/lib/tools/_skills.py:99
↓ 2 callersMethodabsorb_refusal
Fold a refused hop's outcome in, readying the next hop.
src/anthropic/lib/middleware/_fallbacks.py:1164
↓ 2 callersFunctionaccumulate_event
( *, event: RawMessageStreamEvent, current_snapshot: ParsedMessage[ResponseFormatT] | None, js
src/anthropic/lib/streaming/_messages.py:441
↓ 2 callersMethodack
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:271
↓ 2 callersFunctionaclose_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 callersFunctionadd_response_ids
(obj: BaseModel, *, request_id: str | None, workspace_id: str | None)
src/anthropic/_models.py:881
↓ 2 callersFunctionassert_basic_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:58
↓ 2 callersFunctionassert_basic_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:234
↓ 2 callersFunctionassert_compaction_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:249
↓ 2 callersFunctionassert_context_management_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:358
↓ 2 callersFunctionassert_fallback_credit_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:332
↓ 2 callersFunctionassert_fallback_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:279
↓ 2 callersFunctionassert_input_transformations_response
(message: BetaMessage, expected: List[Dict[str, str]])
tests/lib/streaming/test_beta_messages.py:383
↓ 2 callersFunctionassert_message_delta_fields_response
(message: Message)
tests/lib/streaming/test_messages.py:197
↓ 2 callersFunctionassert_message_delta_fields_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:340
↓ 2 callersFunctionassert_message_delta_omitted_usage_response
(message: Message)
tests/lib/streaming/test_messages.py:215
↓ 2 callersFunctionassert_refusal_response
(message: Message)
tests/lib/streaming/test_messages.py:189
↓ 2 callersFunctionassert_refusal_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:259
↓ 2 callersFunctionassert_server_tool_use_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:139
↓ 2 callersFunctionassert_server_tool_use_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:312
↓ 2 callersFunctionassert_tool_use_caller_unset
(message: Message)
tests/lib/streaming/test_messages.py:179
↓ 2 callersFunctionassert_tool_use_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:87
↓ 2 callersFunctionassert_tool_use_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:239
↓ 2 callersFunctionb64encode
(file: Base64FileInput, content: object)
src/anthropic/_utils/_prepare.py:203
↓ 2 callersFunctionbackoff
Exponential backoff for `attempt` (1-indexed), capped at `cap`.
src/anthropic/lib/_retry.py:32
↓ 2 callersMethodbegin
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:1082
↓ 2 callersFunctionbuild_events
( *, event: BetaRawMessageStreamEvent, message_snapshot: ParsedBetaMessage[ResponseFormatT], )
src/anthropic/lib/streaming/_beta_messages.py:346
↓ 2 callersFunctionbuild_events
( *, event: RawMessageStreamEvent, message_snapshot: ParsedMessage[ResponseFormatT], )
src/anthropic/lib/streaming/_messages.py:341
↓ 2 callersFunctioncheck_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 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/_response.py:381
↓ 2 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/_streaming.py:172
↓ 2 callersMethodclose
Close the owned `httpx2.Client` if we created one.
src/anthropic/lib/credentials/_providers.py:438
↓ 2 callersMethodclose
Close the underlying `httpx2.Client` if we created it.
src/anthropic/lib/credentials/_workload.py:233
↓ 2 callersMethodclose_tab
(self, context: BetaToolsetCallContext, input: BetaBrowserCloseTabInput)
tests/lib/tools/toolsets/_fakes.py:150
↓ 2 callersFunctioncoerce_boolean
(val: str)
src/anthropic/_utils/_utils.py:359
↓ 2 callersFunctionconfirm
(context: BetaConfirmContext)
tests/lib/tools/toolsets/test_confirm.py:49
↓ 2 callersFunctionconfirm_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 callersMethodcontent_blocks
The accumulated content blocks, in start order.
src/anthropic/lib/middleware/_fallbacks.py:1269
↓ 2 callersMethodcontinuation
(self)
src/anthropic/lib/middleware/_fallbacks.py:1139
↓ 2 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/foundry.py:205
← previousnext →701–800 of 9,455, ranked by callers