MCPcopy Create free account

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

Functions6,399 in github.com/anthropics/anthropic-sdk-python

↓ 2 callersMethod_make_pin
Pin requests sharing the state to the entry being tried (or warn that there is none).
src/anthropic/lib/middleware/_fallbacks.py:370
↓ 2 callersMethod_make_sse_decoder
(self)
src/anthropic/_base_client.py:494
↓ 2 callersMethod_make_status_error_from_response
( self, response: httpx2.Response, )
src/anthropic/_base_client.py:424
↓ 2 callersFunction_make_zip
(path: Path, entries: dict[str, bytes])
tests/lib/tools/test_skills.py:37
↓ 2 callersFunction_marker_sha
(memory_store_id: str)
src/anthropic/lib/tools/_memories.py:75
↓ 2 callersFunction_max_tokens_with_tool_use
()
tests/lib/tools/test_runners.py:886
↓ 2 callersMethod_maybe_override_cast_to
(self, cast_to: type[ResponseT], options: FinalRequestOptions)
src/anthropic/_base_client.py:635
↓ 2 callersFunction_maybe_transform_key
Transform the given `data` based on the annotations provided in `type_`. Note: this function only looks at `Annotated` types that contain `Proper
src/anthropic/_utils/_transform.py:131
↓ 2 callersFunction_merged_body
The non-streaming retry body: the fallback entry applied as a patch against the original params, plus the refusal's credit token when it minted on
src/anthropic/lib/middleware/_fallbacks.py:1499
↓ 2 callersFunction_middleware_entry_mode
The raw-response mode the original caller entered the middleware chain with.
src/anthropic/_base_client.py:2494
↓ 2 callersFunction_middleware_name
(middleware: object)
src/anthropic/_middleware.py:66
↓ 2 callersMethod_mutate
(self, request: APIRequest)
tests/test_middleware.py:118
↓ 2 callersFunction_next_poll_result
(script: list[Any])
tests/lib/environments/test_poller_method.py:95
↓ 2 callersFunction_no_transform_needed
(annotation: type)
src/anthropic/_utils/_transform.py:150
↓ 2 callersMethod_open
Open the wire for this hop: its message_start (raw for stream A; suppressed or id-rewritten for a spliced hop), the queued seam frames,
src/anthropic/lib/middleware/_fallbacks.py:962
↓ 2 callersFunction_open_regular_file
(rel_path: str, dest: Path)
src/anthropic/lib/tools/_file_store.py:333
↓ 2 callersMethod_parse
(self, *, to: type[_T] | None = None)
src/anthropic/_response.py:129
↓ 2 callersMethod_parse_message_from_event
(self, event: EventStreamMessage)
src/anthropic/lib/bedrock/_stream_decoder.py:55
↓ 2 callersFunction_passthrough_sse
Forward a decoded event in its original wire bytes, preserving SSE fields beyond `event:`/`data:` (`id:`, `retry:`, comment lines). Falls back to
src/anthropic/lib/middleware/_fallbacks.py:1541
↓ 2 callersFunction_poller_records
(caplog: pytest.LogCaptureFixture, level: int)
tests/lib/environments/test_poller_method.py:361
↓ 2 callersFunction_prepare_middleware_options
Build the options the base middleware handler hands to `_attempt_request()`. Returns a copy so that mutations made by the request pipeline never
src/anthropic/_base_client.py:2504
↓ 2 callersFunction_prepare_options
(input_options: FinalRequestOptions)
src/anthropic/lib/bedrock/_client.py:37
↓ 2 callersMethod_prepare_request
This method is used as a callback for mutating the `Request` object after it has been constructed. This is useful for cases where you
src/anthropic/_base_client.py:1050
↓ 2 callersMethod_prepare_request
(self, request: httpx2.Request)
src/anthropic/lib/bedrock/_mantle.py:263
↓ 2 callersMethod_process_response
( self, *, cast_to: Type[ResponseT], options: FinalRequestOptions, res
src/anthropic/_base_client.py:1312
↓ 2 callersMethod_process_response
( self, *, cast_to: Type[ResponseT], options: FinalRequestOptions, res
src/anthropic/_base_client.py:2018
↓ 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 :class:`WorkloadIdentityError` from a non-200 token-endpoint response. Shared between the jwt-bearer exchange path in this modul
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:357
↓ 2 callersFunction_refusal_category
The policy category that caused the refusal; only the beta surface carries one.
src/anthropic/lib/middleware/_fallbacks.py:1396
↓ 2 callersFunction_refusal_with_tool_use
()
tests/lib/tools/test_runners.py:575
↓ 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
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:779
↓ 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:106
↓ 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
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:179
↓ 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:114
↓ 2 callersMethod_route_tool_event
Enqueue ``ev`` for dispatch, honoring its evaluated permission. A builtin call the server gated behind user confirmation (``evaluated
src/anthropic/lib/tools/_beta_session_runner.py:701
↓ 2 callersMethod_run
Drive the session tool loop, yielding an iterator of :class:`DispatchedToolCall`. :meth:`__aiter__` (and the module-level :func:`_run_
src/anthropic/lib/tools/_beta_session_runner.py:487
↓ 2 callersFunction_run_sync_tool_use
Drive a tool runner over ``messages`` and collect the tool_result messages it generated.
tests/lib/tools/test_runners.py:1023
↓ 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
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:1413
↓ 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:1551
↓ 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:
src/anthropic/lib/environments/_worker.py:259
↓ 2 callersMethod_set_private_attributes
( self, client: SyncAPIClient, model: Type[_T], options: FinalRequestOptions,
src/anthropic/_base_client.py:250
↓ 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:856
↓ 2 callersMethod_should_stop
(self)
src/anthropic/lib/tools/_beta_runner.py:152
↓ 2 callersMethod_should_stream_response_body
(self, request: httpx2.Request)
src/anthropic/_base_client.py:652
↓ 2 callersMethod_shrink
(self, request: APIRequest)
tests/test_middleware.py:160
↓ 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:1590
↓ 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 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:568
↓ 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:354
↓ 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:1344
↓ 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:801
↓ 2 callersFunction_to_iteration_usage
( type: Literal["message", "fallback_message"], model: str, usage: dict[str, Any] | None )
src/anthropic/lib/middleware/_fallbacks.py:1565
↓ 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:1311
↓ 2 callersFunction_tool_runner_responses
()
tests/lib/test_vertex.py:44
↓ 2 callersFunction_tool_runner_responses
()
tests/lib/test_bedrock.py:476
↓ 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) en
src/anthropic/lib/tools/_memories.py:768
↓ 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 (th
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 /
src/anthropic/_client.py:97
↓ 2 callersFunction_warn_explicit_shadow
Warn when an explicit ``api_key=`` / ``auth_token=`` argument shadows an explicit ``credentials=`` provider. Call *after* any copy-inheritance
src/anthropic/_client.py:85
↓ 2 callersFunction_warn_once
Emit a log warning at most once per ``key`` per process.
src/anthropic/lib/credentials/_auth.py:22
↓ 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:1375
↓ 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 :class:`F
src/anthropic/lib/tools/_memories.py:700
↓ 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:1149
↓ 2 callersFunctionaccumulate_event
( *, event: RawMessageStreamEvent, current_snapshot: ParsedMessage[ResponseFormatT] | None, ou
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:259
↓ 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
src/anthropic/lib/tools/_beta_functions.py:317
↓ 2 callersFunctionadd_response_ids
(obj: BaseModel, *, request_id: str | None, workspace_id: str | None)
src/anthropic/_models.py:850
↓ 2 callersFunctionassert_basic_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:35
↓ 2 callersFunctionassert_basic_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:205
↓ 2 callersFunctionassert_compaction_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:220
↓ 2 callersFunctionassert_context_management_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:329
↓ 2 callersFunctionassert_fallback_credit_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:303
↓ 2 callersFunctionassert_fallback_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:250
↓ 2 callersFunctionassert_message_delta_fields_response
(message: Message)
tests/lib/streaming/test_messages.py:174
↓ 2 callersFunctionassert_message_delta_fields_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:311
↓ 2 callersFunctionassert_message_delta_omitted_usage_response
(message: Message)
tests/lib/streaming/test_messages.py:192
↓ 2 callersFunctionassert_refusal_response
(message: Message)
tests/lib/streaming/test_messages.py:166
↓ 2 callersFunctionassert_refusal_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:230
↓ 2 callersFunctionassert_server_tool_use_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:116
↓ 2 callersFunctionassert_server_tool_use_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:283
↓ 2 callersFunctionassert_tool_use_caller_unset
(message: Message)
tests/lib/streaming/test_messages.py:156
↓ 2 callersFunctionassert_tool_use_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:64
↓ 2 callersFunctionassert_tool_use_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:210
↓ 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:1067
↓ 2 callersFunctionbuild_events
( *, event: BetaRawMessageStreamEvent, message_snapshot: ParsedBetaMessage[ResponseFormatT], )
src/anthropic/lib/streaming/_beta_messages.py:344
↓ 2 callersFunctionbuild_events
( *, event: RawMessageStreamEvent, message_snapshot: ParsedMessage[ResponseFormatT], )
src/anthropic/lib/streaming/_messages.py:339
↓ 2 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/_response.py:380
← previousnext →501–600 of 6,399, ranked by callers