Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
4,447 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
4,447
◇
Types & classes
1,509
↳
Endpoints
24
↓ 13 callers
Function
openapi_dumps
Serialize an object to UTF-8 encoded JSON bytes. Extends the standard json.dumps with support for additional types commonly used in the
src/anthropic/_utils/_json.py:11
↓ 13 callers
Function
resolve_path
Resolve ``p`` against the workdir; reject results that escape it. Absolute and relative inputs go through the same canonicalise-then-contain
src/anthropic/lib/tools/agent_toolset.py:258
↓ 13 callers
Function
to_async_iter
Convert a synchronous iterator to an asynchronous one.
tests/lib/streaming/helpers.py:25
↓ 13 callers
Method
view
View the contents of a memory path.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:134
↓ 12 callers
Function
_get_params
(client: BaseClient[Any, Any])
tests/test_client.py:46
↓ 12 callers
Method
ack
(self, work_id: str, **kwargs: Any)
tests/lib/environments/test_poller_method.py:63
↓ 12 callers
Function
construct_type_unchecked
Loose coercion to the expected type with construction of nested values. Note: the returned value from this function is not guaranteed to match th
src/anthropic/_models.py:569
↓ 12 callers
Function
error_logs
Messages the middleware logged at ERROR — refusals surfaced rather than retried.
tests/lib/test_refusal_fallback_streaming.py:37
↓ 12 callers
Function
get_auth_headers
( *, method: str, url: str, headers: httpx.Headers, aws_access_key: str | None, aws_se
src/anthropic/lib/aws/_auth.py:33
↓ 12 callers
Method
heartbeat
( self, work_id: str, *, environment_id: str, expected_last_heartbeat:
tests/lib/environments/test_worker.py:42
↓ 12 callers
Method
mcp_oauth_validate
Validate Credential Args: betas: Optional header to specify the beta version(s) you want to use. extra_headers:
src/anthropic/resources/beta/vaults/credentials.py:414
↓ 12 callers
Method
redact
Redact a memory version Args: betas: Optional header to specify the beta version(s) you want to use. extra_head
src/anthropic/resources/beta/memory_stores/memory_versions.py:210
↓ 12 callers
Function
resolve_api_key
Resolve the API key. Returns None if using SigV4.
src/anthropic/lib/aws/_credentials.py:65
↓ 11 callers
Function
_emit
(event: str, payload: dict[str, Any])
src/anthropic/lib/middleware/_fallbacks.py:1468
↓ 11 callers
Function
_get_weather
(location: str, units: Literal["c", "f"])
tests/lib/tools/test_runners.py:772
↓ 11 callers
Function
body
()
tests/test_streaming.py:18
↓ 11 callers
Function
extract_response_type
Given a type like `APIResponse[T]`, returns the generic type variable `T`. This also handles the case where a concrete subclass is given, e.g.
src/anthropic/_response.py:860
↓ 11 callers
Function
get_args
(tp: type[Any])
src/anthropic/_utils/_compat.py:15
↓ 11 callers
Method
rename
Rename or move a memory file or directory.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:159
↓ 11 callers
Function
request_body
(call: MockRequestCall)
tests/test_middleware.py:79
↓ 11 callers
Function
resolve_base_url
Resolve the base URL from constructor arg, env var, or region. Returns None if no base URL is resolvable (caller should raise).
src/anthropic/lib/aws/_credentials.py:108
↓ 11 callers
Function
resolve_region
Resolve the AWS region from constructor arg or env var. Does not silently default — returns None if no region is available.
src/anthropic/lib/aws/_credentials.py:82
↓ 11 callers
Method
send
(self, session_id: str, *, events: list[Any], extra_headers: Any = None)
tests/lib/tools/test_session_runner.py:202
↓ 11 callers
Function
tag_helper
Mark an object as created by a named SDK helper.
src/anthropic/lib/_stainless_helpers.py:84
↓ 10 callers
Method
__class__
(self)
src/anthropic/_utils/_proxy.py:48
↓ 10 callers
Function
_mock_client
Return a mock that quacks like ClientSession.call_tool.
tests/lib/tools/test_mcp_tool.py:56
↓ 10 callers
Function
_validate_output_config_conflict
( output_config: BetaOutputConfigParam | Omit, output_format: object, )
src/anthropic/resources/beta/messages/messages.py:4186
↓ 10 callers
Function
_warn_output_format_deprecated
Emit deprecation warning if output_format is provided.
src/anthropic/resources/beta/messages/messages.py:4210
↓ 10 callers
Method
aclose
(self)
src/anthropic/lib/middleware/_fallbacks.py:1563
↓ 10 callers
Function
beta_edit_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:548
↓ 10 callers
Function
beta_read_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:491
↓ 10 callers
Method
close
(self)
src/anthropic/lib/tools/agent_toolset.py:414
↓ 10 callers
Method
create_enrollment_url
Create Enrollment URL Args: betas: Optional header to specify the beta version(s) you want to use. extra_header
src/anthropic/resources/beta/user_profiles.py:306
↓ 10 callers
Method
extra_headers
Return headers derived from the config file (e.g. ``workspace_id``). Eagerly reads the config if not yet loaded. The returned dict is
src/anthropic/lib/credentials/_providers.py:251
↓ 10 callers
Function
get_origin
(t: type[Any])
src/anthropic/_compat.py:36
↓ 10 callers
Function
get_origin
(tp: type[Any])
src/anthropic/_utils/_compat.py:19
↓ 10 callers
Method
is_closed
Whether or not the response body has been closed. If this is False then there is response data that has not been read yet. You must e
src/anthropic/_response.py:114
↓ 10 callers
Function
make_event_iterator
( content: Iterator[bytes], *, sync: bool, client: Anthropic, async_client: AsyncAnthropic
tests/test_streaming.py:266
↓ 10 callers
Method
pause
Pause Deployment Args: betas: Optional header to specify the beta version(s) you want to use. extra_headers: Se
src/anthropic/resources/beta/deployments.py:425
↓ 10 callers
Method
poll
(self, environment_id: str, **kwargs: Any)
tests/lib/environments/test_poller_method.py:54
↓ 10 callers
Function
resolve_workspace_id
Resolve the workspace ID from constructor arg or env var(s). Returns None if no workspace ID is available (caller should raise).
src/anthropic/lib/aws/_credentials.py:93
↓ 10 callers
Method
results
Streams the results of a Message Batch as a `.jsonl` file. Each line in the file is a JSON object containing the result of a single
src/anthropic/resources/messages/batches.py:285
↓ 10 callers
Method
retrieve_metadata
Get File Metadata Args: file_id: ID of the File. betas: Optional header to specify the beta version(s) you want
src/anthropic/resources/beta/files.py:237
↓ 10 callers
Method
stats
Get statistics about the work queue for an environment. Args: betas: Optional header to specify the beta version(s) you wa
src/anthropic/resources/beta/environments/work.py:466
↓ 10 callers
Method
unpause
Unpause Deployment Args: betas: Optional header to specify the beta version(s) you want to use. extra_headers:
src/anthropic/resources/beta/deployments.py:519
↓ 10 callers
Method
until_done
Blocks until the stream has been consumed
src/anthropic/lib/streaming/_messages.py:118
↓ 10 callers
Method
upload
Upload File Args: file: The file to upload betas: Optional header to specify the beta version(s) you want to us
src/anthropic/resources/beta/files.py:286
↓ 9 callers
Function
_fake_client
(work: _FakeWorkResource, sessions: _FakeSessions)
tests/lib/environments/test_worker.py:84
↓ 9 callers
Function
accumulate_managed_agents_event
( accumulated: AccumulatedEvent | None, event: BetaManagedAgentsAgentMessageEvent, )
src/anthropic/lib/sessions/_accumulate.py:22
↓ 9 callers
Function
aiter_work
Async version of :func:`iter_work`. See its docstring for semantics, including how ``extra_headers`` is passed through per request.
src/anthropic/lib/environments/_poller.py:189
↓ 9 callers
Function
assert_different_identities
(obj1: object, obj2: object)
tests/test_files.py:55
↓ 9 callers
Function
assert_empty_iter
(iter: Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent])
tests/test_streaming.py:261
↓ 9 callers
Method
exec
(self, cmd: str, timeout: float = BASH_DEFAULT_TIMEOUT)
src/anthropic/lib/tools/agent_toolset.py:338
↓ 9 callers
Function
message_start
()
tests/lib/test_refusal_fallback_streaming.py:110
↓ 9 callers
Function
middleware_request_body
(request: APIRequest)
tests/test_middleware.py:83
↓ 9 callers
Function
request_bodies
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:97
↓ 9 callers
Function
seed
(event_id: str)
tests/lib/sessions/test_accumulate.py:28
↓ 9 callers
Method
str_replace
Replace text in a memory file.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:144
↓ 9 callers
Method
to_dict
(self)
src/anthropic/lib/tools/_beta_functions.py:183
↓ 8 callers
Method
__anext__
(self)
src/anthropic/_streaming.py:235
↓ 8 callers
Function
_archive_top_dir
Return the single top-level directory shared by every archive entry, or ``""`` if the entries don't all live under one common directory. Skil
src/anthropic/lib/tools/_skills.py:61
↓ 8 callers
Function
_blob_resource
(uri: str = "file:///x.bin", blob: str = "", mime: str | None = None)
tests/lib/tools/test_mcp_tool.py:48
↓ 8 callers
Method
_calculate_nonstreaming_timeout
(self, max_tokens: int, max_nonstreaming_tokens: int | None)
src/anthropic/_base_client.py:769
↓ 8 callers
Function
_merge_output_configs
( output_config: BetaOutputConfigParam | Omit, output_format: Optional[BetaJSONOutputFormatParam] | Om
src/anthropic/resources/beta/messages/messages.py:4198
↓ 8 callers
Function
_middleware_name
(middleware: object)
src/anthropic/_middleware.py:66
↓ 8 callers
Function
_mode
(p: Path)
tests/lib/tools/test_skills.py:119
↓ 8 callers
Method
_validate_path
Validate and resolve memory paths
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:387
↓ 8 callers
Function
accumulate_event
( *, event: BetaRawMessageStreamEvent, current_snapshot: ParsedBetaMessage[ResponseFormatT] | None
src/anthropic/lib/streaming/_beta_messages.py:449
↓ 8 callers
Method
bind_base_url
Set the API ``base_url`` the token exchange POSTs to. Called by :class:`anthropic.Anthropic` when this object is passed as ``credenti
src/anthropic/lib/credentials/_workload.py:193
↓ 8 callers
Method
copy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/vertex/_client.py:184
↓ 8 callers
Method
copy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/vertex/_client.py:348
↓ 8 callers
Function
error_body
(*, type: str, message: str)
tests/test_middleware.py:75
↓ 8 callers
Method
parse
(self, *, to: type[_T])
src/anthropic/_response.py:307
↓ 8 callers
Method
parse
(self, *, to: type[_T])
src/anthropic/_response.py:416
↓ 8 callers
Method
parse
( self, *, max_tokens: int, messages: Iterable[MessageParam], model: M
src/anthropic/resources/messages/messages.py:1202
↓ 8 callers
Function
refusal_delta
(token: str | None = "tok_abc", has_prefill_claim: bool = True)
tests/lib/test_refusal_fallback_streaming.py:128
↓ 7 callers
Method
_auth_block
Return the cached ``authentication`` sub-object from the config file.
src/anthropic/lib/credentials/_providers.py:445
↓ 7 callers
Method
_ensure_memory_root
Ensure the memory root directory exists
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:669
↓ 7 callers
Function
_extract_skill_archive
Extract a skill download (a zip or tar.* archive) from disk into ``dest``. Skill bundles are wrapped in a single directory named after the skill;
src/anthropic/lib/tools/_skills.py:108
↓ 7 callers
Function
_install_scoped_client
Intercept the shared bearer-auth client factory. Returns the list of args the factory was called with so a test can assert on the helper-tele
tests/lib/environments/test_worker.py:90
↓ 7 callers
Function
_jitter
(low: float, high: float)
src/anthropic/lib/environments/_poller.py:34
↓ 7 callers
Method
_make_client
(self)
tests/lib/test_bedrock_mantle.py:120
↓ 7 callers
Function
_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:1472
↓ 7 callers
Function
_read_result
(contents: list[Any])
tests/lib/tools/test_mcp_tool.py:52
↓ 7 callers
Function
_send_message_async
(client: AsyncAnthropic)
tests/lib/test_credentials.py:2565
↓ 7 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:82
↓ 7 callers
Function
_text_resource
(uri: str = "file:///x.txt", text: str = "hello", mime: str | None = None)
tests/lib/tools/test_mcp_tool.py:44
↓ 7 callers
Method
_validate_path
Validate and resolve memory paths
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:673
↓ 7 callers
Function
beta_agent_toolset_20260401
Return the ``agent_toolset_20260401`` implementations bound to ``ctx``. The result is a plain list of :class:`~anthropic.lib.tools.BetaAsyncFunct
src/anthropic/lib/tools/agent_toolset.py:730
↓ 7 callers
Function
beta_headers
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:102
↓ 7 callers
Method
bind_base_url
Adopt the owning client's ``base_url`` as a fallback for the token exchange. Slots between the config file's own ``base_url`` field and
src/anthropic/lib/credentials/_providers.py:220
↓ 7 callers
Function
block_starts
(events: list[BetaRawMessageStreamEvent])
tests/lib/test_refusal_fallback_streaming.py:189
↓ 7 callers
Function
fill
(target: Dict[str, Any], key: str, env_var: str)
src/anthropic/lib/credentials/_providers.py:85
↓ 7 callers
Function
model_dump
( model: pydantic.BaseModel, *, exclude: IncEx | None = None, exclude_unset: bool = False,
src/anthropic/_compat.py:144
↓ 7 callers
Method
parse
(self, *, to: type[_T])
src/anthropic/_legacy_response.py:97
↓ 7 callers
Method
request
( self, cast_to: Type[ResponseT], options: FinalRequestOptions, *, str
src/anthropic/_base_client.py:1083
↓ 7 callers
Function
validate_credentials
Raise if only one of aws_access_key/aws_secret_key is provided.
src/anthropic/lib/aws/_credentials.py:7
↓ 6 callers
Method
__get_proxied__
(self)
src/anthropic/_utils/_proxy.py:57
↓ 6 callers
Function
_api_status_error
(code: int)
tests/lib/environments/test_poller_method.py:36
↓ 6 callers
Function
_api_status_error
(code: int)
tests/lib/tools/test_session_runner.py:108
← previous
next →
101–200 of 4,447, ranked by callers