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
↓ 1 callers
Function
_basic_config
()
src/anthropic/_utils/_logs.py:8
↓ 1 callers
Function
_bedrock_message
(content: t.List[t.Dict[str, t.Any]], stop_reason: str)
tests/lib/test_bedrock.py:740
↓ 1 callers
Method
_browser_state
The browser after a call: the open tabs (one marked active) and the state changes since the previous report. Every driver implements it. The S
src/anthropic/lib/tools/_toolsets/_browser.py:329
↓ 1 callers
Method
_browser_state
The browser after a call. See the synchronous class's `_browser_state`. Awaited, so a sync method here is a contract error.
src/anthropic/lib/tools/_toolsets/_browser.py:573
↓ 1 callers
Function
_build_discriminated_union_meta
(*, union: type, meta_annotations: tuple[Any, ...])
src/anthropic/_models.py:871
↓ 1 callers
Function
_build_federation_result
Build a `CredentialResult` for the env-var federation path (step 4 in the precedence spec). Returns `None` if the required trio isn't fully se
src/anthropic/lib/credentials/_chain.py:29
↓ 1 callers
Method
_build_headers
(self, options: FinalRequestOptions, *, retries_taken: int = 0)
src/anthropic/_base_client.py:553
↓ 1 callers
Method
_call_oidc_federation
(self, auth: Dict[str, Any], *, force_refresh: bool = False)
src/anthropic/lib/credentials/_providers.py:649
↓ 1 callers
Method
_call_provider
Call the provider, retrying once on a 401 from the token endpoint.
src/anthropic/lib/credentials/_cache.py:159
↓ 1 callers
Method
_call_tool
Also returns the result's content as the tool's span records it.
src/anthropic/lib/tools/_beta_session_runner.py:625
↓ 1 callers
Method
_call_user_oauth
Interactive-login profile. With a `client_id` in the auth block, we run the refresh_token grant on expiry; without one, we treat the c
src/anthropic/lib/credentials/_providers.py:523
↓ 1 callers
Function
_changed_tool_name
The locally runnable tool name a tool-change ``tool`` resolves to. `tool_reference` names one directly and `tool_definition` carries one by v
src/anthropic/lib/tools/_tool_dispatch.py:240
↓ 1 callers
Method
_cleanup_skills
Remove the skill directories `setup_skills` downloaded. Only the directories this context created are removed — a pre-existing `{work
src/anthropic/lib/tools/agent_toolset.py:341
↓ 1 callers
Function
_client_that_changes_authorization
(login: _RevocableLogin, changed_by: str)
tests/lib/test_credentials.py:2508
↓ 1 callers
Method
_close
(self, exit_stack: contextlib.AsyncExitStack[bool | None])
src/anthropic/lib/tools/_beta_session_runner.py:948
↓ 1 callers
Function
_coerce_expires_at
Parse a credentials-file `expires_at` field into Unix seconds.
src/anthropic/lib/credentials/_providers.py:59
↓ 1 callers
Method
_collect
(self, line_bytes: bytes, *, newline_terminated: bool)
src/anthropic/lib/tools/_files.py:67
↓ 1 callers
Function
_collect_files
(directory: Path, relative_to: Path, files: list[FileTypes])
src/anthropic/lib/_files.py:19
↓ 1 callers
Method
_compact_after_final_turn
(self, message: ParsedBetaMessage[ResponseFormatT])
src/anthropic/lib/tools/_beta_runner.py:680
↓ 1 callers
Method
_compact_after_final_turn
( self, message: ParsedBetaMessage[ResponseFormatT] )
src/anthropic/lib/tools/_beta_runner.py:1212
↓ 1 callers
Function
_compaction_tool_changes
The ``tool_changes`` of a ``compaction`` block, whichever shape it has in history. A caller-written block is a dict; one the runner echoed from a
src/anthropic/lib/tools/_tool_dispatch.py:203
↓ 1 callers
Function
_confined
Yield the matches whose canonical path is inside `root`; a match that cannot be canonicalised (symlink loop, unreadable) is dropped, not raised.
src/anthropic/lib/tools/agent_toolset.py:1078
↓ 1 callers
Function
_construct_field
(value: object, field: FieldInfo, key: str)
src/anthropic/_models.py:571
↓ 1 callers
Function
_convert_tool_result
Convert MCP `CallToolResult` to a value suitable for returning from `call()`.
src/anthropic/lib/tools/mcp.py:304
↓ 1 callers
Method
_copy_and_prepare
A copy of `options` with `extra_body` merged into the body, and the body and query prepared. The data is walked once per request, before the
src/anthropic/_base_client.py:2278
↓ 1 callers
Method
_corroborated_delete
Send the server delete only after the file's absence is confirmed. Records the miss on the first sync; deletes on a later one after t
src/anthropic/lib/tools/_memories.py:886
↓ 1 callers
Function
_create_pydantic_model
(type_: _T)
src/anthropic/_models.py:1033
↓ 1 callers
Method
_create_schema_from_function
Create JSON schema from function signature using pydantic.
src/anthropic/lib/tools/_beta_functions.py:224
↓ 1 callers
Function
_credentials_file_path
Path to `<config_dir>/credentials/<profile>.json` (secret, 0600).
src/anthropic/lib/credentials/_constants.py:182
↓ 1 callers
Method
_current_snapshot_or_none
(self)
src/anthropic/lib/streaming/_messages.py:136
↓ 1 callers
Function
_dec
(*_: Any, **__: Any)
src/anthropic/_models.py:1048
↓ 1 callers
Method
_declared_tools
The names of the tools in the `tools` param, and the families of its toolsets, which have no name.
src/anthropic/lib/tools/_beta_runner.py:541
↓ 1 callers
Function
_deepcopy_with_paths
(item: _T, paths: Sequence[Sequence[str]], index: int)
src/anthropic/_files.py:164
↓ 1 callers
Method
_delete_remote
( self, store: _AttachedStore, rel: str, remote: BetaManagedAgentsMemory, base_sha: str )
src/anthropic/lib/tools/_memories.py:932
↓ 1 callers
Function
_discriminator_cache_key
(union: type)
src/anthropic/_models.py:822
↓ 1 callers
Function
_download_and_extract
Download and extract the skill archive in an owner-only directory beside `dest`, then replace `dest`.
src/anthropic/lib/tools/_skills.py:301
↓ 1 callers
Method
_download_memory
(self, session: BetaManagedAgentsSession)
src/anthropic/lib/environments/_worker.py:531
↓ 1 callers
Function
_drive_hop
Feed one hop's SSE events through `reader`, yielding the frames to forward.
src/anthropic/lib/middleware/_fallbacks.py:1035
↓ 1 callers
Function
_drive_hop_async
Feed one hop's SSE events through `reader`, yielding the frames to forward. The outcome is read from `reader.finish()` afterwards — async generat
src/anthropic/lib/middleware/_fallbacks.py:1047
↓ 1 callers
Method
_end_turn_after
( self, events: Iterator[ParsedBetaMessageStreamEvent[ResponseFormatT]] )
src/anthropic/lib/threads/_stream_managers.py:58
↓ 1 callers
Method
_end_turn_after
( self, events: AsyncIterator[ParsedBetaMessageStreamEvent[ResponseFormatT]] )
src/anthropic/lib/threads/_stream_managers.py:103
↓ 1 callers
Method
_ensure_access_token
(self)
src/anthropic/lib/vertex/_client.py:146
↓ 1 callers
Method
_ensure_access_token
(self)
src/anthropic/lib/vertex/_client.py:312
↓ 1 callers
Function
_entered
()
src/anthropic/lib/tools/_beta_functions.py:572
↓ 1 callers
Method
_events_for
The events resource that sends the result of a tool call whose span has `conversation_id`. The spans of its requests have the conversation ID
src/anthropic/lib/tools/_beta_session_runner.py:393
↓ 1 callers
Method
_execute
( self, call: DispatchedToolUseEvent, tool: BetaAnyRunnableTool, conversation_
src/anthropic/lib/tools/_beta_session_runner.py:598
↓ 1 callers
Method
_extend
(self)
src/anthropic/lib/environments/_lease.py:102
↓ 1 callers
Function
_extract_field_schema_pv2
(model: type[BaseModel], field_name: str)
src/anthropic/_models.py:932
↓ 1 callers
Function
_extract_items
( obj: object, path: Sequence[str], *, index: int, flattened_key: str | None, array_fo
src/anthropic/_utils/_utils.py:75
↓ 1 callers
Function
_file_tools_may_reach
True when `path` resolves to somewhere inside `workdir` or `allowed_roots`, and when it or one of those directories cannot be resolved.
src/anthropic/lib/tools/agent_toolset.py:466
↓ 1 callers
Function
_fill_missing_from_env
Fill empty profile fields from corresponding ANTHROPIC_* env vars. The profile file is authoritative — this only fills fields the file left u
src/anthropic/lib/credentials/_providers.py:87
↓ 1 callers
Method
_finalize_middleware_result
Convert the `APIResponse` returned by the middleware chain into the value the original caller expects. The middleware chain operates on `APIR
src/anthropic/_base_client.py:1398
↓ 1 callers
Method
_finalize_middleware_result
Convert the `AsyncAPIResponse` returned by the middleware chain into the value the original caller expects. The middleware chain operates on
src/anthropic/_base_client.py:2188
↓ 1 callers
Method
_finish
(self, output: _BashOutput, exit_code: int, *, stderr_end: str = "")
src/anthropic/lib/tools/agent_toolset.py:634
↓ 1 callers
Method
_generate_tool_call_response
(self)
src/anthropic/lib/tools/_beta_runner.py:786
↓ 1 callers
Method
_generate_tool_call_response
(self)
src/anthropic/lib/tools/_beta_runner.py:1350
↓ 1 callers
Method
_get_description_from_docstring
Extract description from parsed docstring.
src/anthropic/lib/tools/_beta_functions.py:215
↓ 1 callers
Function
_get_extra_fields_type
(cls: type[pydantic.BaseModel])
src/anthropic/_models.py:586
↓ 1 callers
Method
_get_last_assistant_message
(self)
src/anthropic/lib/tools/_beta_runner.py:889
↓ 1 callers
Method
_get_last_assistant_message
(self)
src/anthropic/lib/tools/_beta_runner.py:1336
↓ 1 callers
Method
_get_last_assistant_message_content
(self)
src/anthropic/lib/tools/_beta_runner.py:896
↓ 1 callers
Method
_get_last_assistant_message_content
(self)
src/anthropic/lib/tools/_beta_runner.py:1343
↓ 1 callers
Method
_get_page
(self)
src/anthropic/_base_client.py:348
↓ 1 callers
Function
_get_parameters_info
(fn: BaseFunctionTool[Any])
tests/lib/tools/test_functions.py:441
↓ 1 callers
Function
_get_session
( *, aws_access_key: str | None, aws_secret_key: str | None, aws_session_token: str | None,
src/anthropic/lib/aws/_auth.py:14
↓ 1 callers
Method
_get_token
(self)
src/anthropic/lib/google_cloud/_client.py:586
↓ 1 callers
Method
_handle_memory
(self, http: httpx2.Request)
tests/lib/environments/_fake_work_api.py:491
↓ 1 callers
Method
_handle_polled
(self, work_item: BetaSelfHostedWork, work_span: WorkSpan)
src/anthropic/lib/environments/_worker.py:350
↓ 1 callers
Method
_handle_work
(self, request: Request, token: Token | None)
tests/lib/environments/_fake_work_api.py:386
↓ 1 callers
Function
_has_active_profile_config
Tighter auto-discover check for the active-profile step of the credential chain. Returns `True` only if the *active* profile's config file exists
src/anthropic/lib/credentials/_constants.py:189
↓ 1 callers
Function
_has_auto_discoverable_credentials
True if the environment / filesystem contains signals that would normally drive the profile or env federation paths of `default_credentials`.
src/anthropic/lib/credentials/_constants.py:224
↓ 1 callers
Function
_has_memory_store
True when the session has at least one memory store attached.
src/anthropic/lib/environments/_worker.py:87
↓ 1 callers
Function
_hash_file
(path: Path)
src/anthropic/lib/tools/_file_store.py:351
↓ 1 callers
Function
_interpolate
Replace {name} placeholders in `template`, quoting each value with `quoter`. Placeholder names are looked up in `values`. Raises: Ke
src/anthropic/_utils/_path.py:47
↓ 1 callers
Method
_invoke_provider
Invoke `provider`, leaving out `force_refresh` for a legacy provider that doesn't take it.
src/anthropic/lib/credentials/_cache.py:147
↓ 1 callers
Function
_is_among
Asks the file system, because different names can refer to the same entry.
src/anthropic/lib/tools/_skills.py:292
↓ 1 callers
Function
_is_async_cm_factory
True when `fn` is a function produced by `contextlib.asynccontextmanager`.
src/anthropic/lib/tools/_beta_functions.py:312
↓ 1 callers
Function
_is_supported_resource_mime_type
(mime_type: str | None)
src/anthropic/lib/tools/mcp.py:106
↓ 1 callers
Function
_is_sync_cm_factory
True when `fn` is a function produced by `contextlib.contextmanager`. `contextmanager` wraps the generator function with `functools.wraps`, so
src/anthropic/lib/tools/_beta_functions.py:300
↓ 1 callers
Method
_issue_secret
(self, item: Item)
tests/lib/environments/_fake_work_api.py:417
↓ 1 callers
Method
_iter_chunks
Given an iterator that yields raw binary data, iterate over it and yield individual SSE chunks
src/anthropic/_streaming.py:359
↓ 1 callers
Method
_iter_events
(self)
src/anthropic/_streaming.py:198
↓ 1 callers
Function
_iteration
(type: str, model: str)
tests/lib/threads/helpers.py:331
↓ 1 callers
Method
_kill_unless_ended
(self, output: _BashOutput)
src/anthropic/lib/tools/agent_toolset.py:647
↓ 1 callers
Method
_lease_json
(self, item: Item, *, extended: bool)
tests/lib/environments/_fake_work_api.py:483
↓ 1 callers
Function
_make_async_iterator
(iterable: Iterable[T], counter: Optional[Counter] = None)
tests/test_client.py:102
↓ 1 callers
Function
_make_sync_iterator
(iterable: Iterable[T], counter: Optional[Counter] = None)
tests/test_client.py:95
↓ 1 callers
Function
_make_targz
(path: Path, entries: dict[str, bytes])
tests/lib/tools/test_skills.py:80
↓ 1 callers
Function
_make_targz_modes
(path: Path, entries: dict[str, tuple[bytes, int]])
tests/lib/tools/test_skills.py:93
↓ 1 callers
Function
_make_zip_modes
(path: Path, entries: dict[str, tuple[bytes, int]])
tests/lib/tools/test_skills.py:84
↓ 1 callers
Function
_media_type_literal_values
Extract the values of a `Required[Literal[...]]` TypedDict field.
tests/lib/tools/test_agent_toolset.py:472
↓ 1 callers
Function
_migrate_legacy_config
Adapter: convert a flat legacy config dict into the new nested shape. Many tests in this file predate the schema migration and pass legacy fl
tests/lib/test_credentials.py:114
↓ 1 callers
Function
_new_system
(params: dict[str, Any])
tests/lib/threads/helpers.py:867
↓ 1 callers
Function
_old_enough_to_cache
(st: os.stat_result, walk_start_ns: int)
src/anthropic/lib/tools/_file_store.py:423
↓ 1 callers
Method
_over_limit_error
(self)
src/anthropic/lib/tools/_files.py:74
↓ 1 callers
Method
_params_from_url
(self, url: URL)
src/anthropic/_base_client.py:248
↓ 1 callers
Method
_parse_retry_after_header
Returns a float of the number of seconds (not milliseconds) to wait after retrying, or None if unspecified. About the Retry-After header: htt
src/anthropic/_base_client.py:882
↓ 1 callers
Function
_parse_timezone
(value: Optional[str])
src/anthropic/_utils/_datetime_parse.py:56
↓ 1 callers
Function
_partial_reply
The part of a streamed reply worth keeping when the stream ended early, or `None` if nothing is. An unfinished block stays only if it is `text`, b
src/anthropic/lib/threads/_thread_state.py:617
↓ 1 callers
Function
_paths_to_skills
(type_: Any, path: str = "")
tests/lib/tools/test_skills.py:456
← previous
next →
1,401–1,500 of 13,873, ranked by callers