Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
14,068 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
14,068
◇
Types & classes
4,501
↳
Endpoints
96
↓ 4 callers
Function
share_message_snapshot
Lets the span of the API call that returned `stream` take its output content from `reader`.
src/anthropic/lib/_tracing/_streaming.py:152
↓ 4 callers
Function
signature_without_evaluating_annotations
Like `inspect.signature()`, for callers that only need parameter names, kinds and defaults. Python 3.14 evaluates annotations lazily and `inspect
src/anthropic/_utils/_reflection.py:9
↓ 4 callers
Function
slow_stream_closes
Makes closing a response stream wait, as closing a connection does, and lists each close as it starts and finishes.
tests/lib/tools/test_open_telemetry.py:232
↓ 4 callers
Method
start_turn
Stage `messages` and start the turn that sends them. The turn goes out even if nothing is staged then.
src/anthropic/lib/threads/_thread_state.py:248
↓ 4 callers
Method
state
(self, context: BetaToolsetCallContext)
tests/lib/tools/toolsets/_fakes.py:64
↓ 4 callers
Method
statuses
(self, kind: str)
tests/lib/tools/_fake_sessions_api.py:179
↓ 4 callers
Function
thread_logs
The (level, message) pairs logged under the `anthropic.lib.threads` logger or its children.
tests/lib/threads/helpers.py:954
↓ 4 callers
Function
timestamp
(at: float | None)
tests/lib/environments/_fake_work_api.py:519
↓ 4 callers
Function
to_custom_raw_response_wrapper
Higher order function that takes one of our bound API methods and an `APIResponse` class and wraps the method to support returning the given respo
src/anthropic/_response.py:828
↓ 4 callers
Function
to_custom_streamed_response_wrapper
Higher order function that takes one of our bound API methods and an `APIResponse` class and wraps the method to support streaming and returning t
src/anthropic/_response.py:744
↓ 4 callers
Function
tool_change_replies
The replies of a run that calls `get_weather`, then `lookup`, then `get_weather` again, and then ends.
tests/lib/threads/helpers.py:372
↓ 4 callers
Function
tool_change_turns
What answers each of the first three `tool_change_replies()` when `lookup` is added while the first one is handled and `get_weather` is removed wh
tests/lib/threads/helpers.py:382
↓ 4 callers
Function
tool_error_content
Render an exception raised by a tool as tool-result content. A `ToolError` has its own structured content, made well formed but never cut. An
src/anthropic/lib/tools/_tool_dispatch.py:263
↓ 4 callers
Function
tool_result_content
(content: None)
src/anthropic/lib/tools/_tool_dispatch.py:278
↓ 4 callers
Function
types
(events: list[Event])
tests/lib/tools/test_fake_sessions_api.py:49
↓ 4 callers
Function
unwrap_partial
(obj: object)
src/anthropic/lib/credentials/_types.py:79
↓ 4 callers
Function
validate_output_config_conflict
Reject a call that passes both `output_format` and `output_config.format`.
src/anthropic/lib/_parse/_transform.py:19
↓ 4 callers
Function
wait_until
(condition: Callable[[Trace], object])
tests/lib/tools/_fake_sessions_api.py:883
↓ 4 callers
Function
withhold_message_snapshot
Keeps the snapshot shared for `stream` out of the output content of the span of its API call. The stream helper could not accumulate an event, so
src/anthropic/lib/_tracing/_streaming.py:158
↓ 4 callers
Function
without_speed
(body: dict[str, Any])
tests/lib/test_refusal_fallback.py:122
↓ 4 callers
Function
without_speed
(body: dict[str, Any])
tests/lib/test_refusal_fallback_streaming.py:175
↓ 4 callers
Function
work_kinds
(trace: Trace)
tests/lib/environments/test_worker.py:72
↓ 3 callers
Method
__init__
(self, *, cache_control: BetaCacheControlEphemeralParam | None = None)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:89
↓ 3 callers
Method
__init__
( self, cls: type[BaseToolset[Any, Any, Any]], *, configs: BetaComputerToolset
src/anthropic/lib/tools/_toolsets/_computer.py:74
↓ 3 callers
Method
__init__
(self, beta: Beta)
src/anthropic/lib/bedrock/_beta.py:81
↓ 3 callers
Method
_accept
(self, thread: str, event: Event)
tests/lib/tools/_fake_sessions_api.py:675
↓ 3 callers
Function
_async_read_file_content
(full_path: AsyncPath, memory_path: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:669
↓ 3 callers
Method
_build_middleware_chain
Build the middleware invocation chain. The chain only depends on the immutable `self._middleware` tuple so it is built once at constr
src/anthropic/_base_client.py:1445
↓ 3 callers
Method
_check_can_compact
(self, params: ParseMessageCreateParamsBase[ResponseFormatT])
src/anthropic/lib/tools/_beta_runner.py:379
↓ 3 callers
Function
_config_dir
Resolve the config directory. `ANTHROPIC_CONFIG_DIR` env var → platform default. Platform defaults: * Linux & macOS: `~/.config/anthro
src/anthropic/lib/credentials/_constants.py:65
↓ 3 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:1587
↓ 3 callers
Method
_copy_open_telemetry
The `open_telemetry` option of a copy of this client: the one given, or else, for `None`, this client's own. The one given replaces this clie
src/anthropic/_base_client.py:494
↓ 3 callers
Function
_determine_next_step_from_stop_reason
Decide how the runner loop treats a finished assistant turn. - `run_tools`: run the turn's client tool calls, append their results and continue;
src/anthropic/lib/tools/_beta_runner.py:121
↓ 3 callers
Method
_end
(self, state: str, *published: Event | None)
tests/lib/tools/_fake_sessions_api.py:779
↓ 3 callers
Function
_fs_error
(op: str, file_path: str, e: OSError)
src/anthropic/lib/tools/agent_toolset.py:198
↓ 3 callers
Method
_get_page_items
(self)
src/anthropic/_base_client.py:247
↓ 3 callers
Method
_handle_ack
(self, item: Item, client: str)
tests/lib/environments/_fake_work_api.py:422
↓ 3 callers
Function
_is_supported_image_type
(mime_type: str)
src/anthropic/lib/tools/mcp.py:102
↓ 3 callers
Function
_json_dumps_secrets
`json.dumps` with `SecretStr` values unwrapped at dump time. Returns bytes so call sites can pass the result inline (request content, `os.wri
src/anthropic/lib/credentials/_secrets.py:95
↓ 3 callers
Function
_keep_client_header_params
Per-request header params arrive as `Omit` when unset, which would strip a value the client itself sends (e.g. `AnthropicAWS(workspace_id=...)`, a
src/anthropic/_base_client.py:2954
↓ 3 callers
Method
_kill
(self)
src/anthropic/lib/tools/agent_toolset.py:672
↓ 3 callers
Method
_list_and_settle
List the store by path, and resolve the uploads whose response never arrived. A memory holding a sha that was sent is that upload, so it ente
src/anthropic/lib/tools/_memories.py:696
↓ 3 callers
Function
_make_tar
(path: Path, members: list[tuple[tarfile.TarInfo, bytes]])
tests/lib/tools/test_skills.py:121
↓ 3 callers
Function
_make_zip_infos
(path: Path, entries: list[tuple[zipfile.ZipInfo, bytes]])
tests/lib/tools/test_skills.py:134
↓ 3 callers
Function
_marker_sha
(memory_store_id: str)
src/anthropic/lib/tools/_memories.py:80
↓ 3 callers
Function
_missing_target_fixture
Workdir with two links to `deep/t`, which doesn't exist. With `..` collapsed by name, both targets read as `t`, whose entries link outside.
tests/lib/tools/test_agent_toolset.py:1755
↓ 3 callers
Function
_move_authorization
(request: httpx2.Request)
tests/lib/test_credentials.py:2511
↓ 3 callers
Method
_move_to_log
(self, *rows: Event)
tests/lib/tools/_fake_sessions_api.py:681
↓ 3 callers
Function
_prepare_options
(input_options: FinalRequestOptions, *, project_id: str | None, region: str)
src/anthropic/lib/vertex/_client.py:386
↓ 3 callers
Function
_read_file_content
(full_path: Path, memory_path: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:356
↓ 3 callers
Function
_redact_body
Truncate a token-endpoint error body for safe inclusion in an exception.
src/anthropic/lib/credentials/_workload.py:55
↓ 3 callers
Function
_reject_read_only
Raise `ToolError` when `target` falls under a read-only root. Roots resolve at check time, exactly like `allowed_roots` in `resolve_path` — a
src/anthropic/lib/tools/agent_toolset.py:458
↓ 3 callers
Method
_request_api_list
( self, model: Type[object], page: Type[SyncPageT], options: FinalRequestOptio
src/anthropic/_base_client.py:1671
↓ 3 callers
Function
_request_id
(resp: httpx2.Response)
src/anthropic/lib/credentials/_workload.py:50
↓ 3 callers
Method
_resolve
(self, id: str)
tests/lib/tools/_fake_sessions_api.py:685
↓ 3 callers
Method
_resolve_base_url
base_url precedence: top-level config field → bound (the owning client's base_url, via `bind_base_url`) → default. Validated against t
src/anthropic/lib/credentials/_providers.py:277
↓ 3 callers
Function
_resolve_max_bytes
Resolve a configured cap to an effective size limit. `not_given` selects `default`; `None` disables the size check (uncapped); a positive int
src/anthropic/lib/tools/agent_toolset.py:146
↓ 3 callers
Function
_response_without_a_summary
(content: List[Any], stop_reason: str)
tests/lib/tools/test_runners.py:2507
↓ 3 callers
Method
_run_tool
(self, tool: BetaRunnableTool, tool_use: BetaToolUseBlock)
src/anthropic/lib/tools/_beta_runner.py:853
↓ 3 callers
Method
_run_toolset_member
(self, tool_use: BetaToolUseBlock)
src/anthropic/lib/tools/_beta_runner.py:876
↓ 3 callers
Function
_safe_json
(text: str)
src/anthropic/lib/middleware/_fallbacks.py:1592
↓ 3 callers
Method
_scan_marker
(self, store: _AttachedStore)
src/anthropic/lib/tools/_memories.py:397
↓ 3 callers
Function
_seam_block
The synthetic `fallback` content block marking one model boundary.
src/anthropic/lib/middleware/_fallbacks.py:1438
↓ 3 callers
Function
_sent_tools
The `tools` array of the first request the runner sent.
tests/lib/tools/toolsets/test_runner.py:141
↓ 3 callers
Method
_session_events
The session's status comes from the statuses of all threads, or only the primary thread's if that failed.
tests/lib/tools/_fake_sessions_api.py:718
↓ 3 callers
Method
_set_open_telemetry
Sets this client's `open_telemetry` option, and has it get its tracer anew. Nothing else sets the option. The constructor calls this, and so
src/anthropic/_base_client.py:471
↓ 3 callers
Method
_should_retry
(self, response: httpx2.Response)
src/anthropic/_base_client.py:1008
↓ 3 callers
Function
_sse_message
(content_block: Dict[str, Any], stop_reason: str, *deltas: Dict[str, Any])
tests/lib/tools/test_runners.py:3466
↓ 3 callers
Method
_start_new_thread
Stop continuing from the stored reply so the turn re-sends the full history under a new thread.
src/anthropic/lib/threads/_thread_state.py:296
↓ 3 callers
Function
_strip_traceback
Detach the frames chained onto `err` before raising from it. Foreign frames (json decoder, httpx transport) hold raw payloads — request bodie
src/anthropic/lib/credentials/_secrets.py:104
↓ 3 callers
Method
_sync_all
(self, *, final: bool)
src/anthropic/lib/tools/_memories.py:391
↓ 3 callers
Function
_tar_special
(name: str, type: bytes, linkname: str = "")
tests/lib/tools/test_skills.py:112
↓ 3 callers
Function
_thread_fields
(fields: dict[str, Any])
tests/lib/threads/helpers.py:85
↓ 3 callers
Function
_unwrap_secret
Inverse of `_wrap_secret_fields` for a single value; pass-through for values that were never wrapped (absent or non-string fields).
src/anthropic/lib/credentials/_secrets.py:83
↓ 3 callers
Function
_validate_profile_name
Reject profile names that could escape the config directory. Profile names come from user-controlled sources (`ANTHROPIC_PROFILE`, the `activ
src/anthropic/lib/credentials/_constants.py:139
↓ 3 callers
Function
_vertex_message
(content: List[Dict[str, Any]], stop_reason: str)
tests/lib/test_vertex.py:111
↓ 3 callers
Method
_walk_sync_auth
(client: Anthropic)
tests/lib/test_credentials.py:4707
↓ 3 callers
Function
_wrap_secret_fields
Wrap the secret fields of a parsed JSON object in `SecretStr`. Called at every boundary where credential material enters SDK code. Traceback
src/anthropic/lib/credentials/_secrets.py:51
↓ 3 callers
Method
_write_result
The server writes the call's result, which the log shows only for the primary thread.
tests/lib/tools/_fake_sessions_api.py:690
↓ 3 callers
Function
action_line
The line of text a pure action returned, as written: `render_result` folds it to one line (control, line-separator and bidi characters a space) an
src/anthropic/lib/tools/_toolsets/_render.py:101
↓ 3 callers
Function
add_response_ids
(obj: BaseModel, *, request_id: str | None, workspace_id: str | None)
src/anthropic/_models.py:969
↓ 3 callers
Method
after_failure
(self)
src/anthropic/lib/environments/_poller.py:63
↓ 3 callers
Function
as_dict
(value: object)
src/anthropic/lib/_tracing/_utils.py:28
↓ 3 callers
Function
beta_bash_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:881
↓ 3 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 th
src/anthropic/lib/credentials/_providers.py:231
↓ 3 callers
Function
block
(awaitable: Any)
tests/lib/environments/_schedules.py:183
↓ 3 callers
Method
blocked_until
(self, now: float)
tests/lib/environments/test_worker_properties.py:139
↓ 3 callers
Function
body
()
tests/test_prepare.py:346
↓ 3 callers
Function
build
`_models.build()` without its walk over the field annotations: stream event fields are already constructed.
src/anthropic/lib/streaming/_messages.py:469
↓ 3 callers
Method
call
(self, input: object)
src/anthropic/lib/tools/_tool_dispatch.py:148
↓ 3 callers
Function
call_messages
Creates a Message from `messages` with a synchronous or an asynchronous client.
tests/test_open_telemetry.py:4355
↓ 3 callers
Function
cancel
(tool: Any, command: str)
tests/lib/tools/test_agent_toolset.py:1066
↓ 3 callers
Method
close
Release what the toolset holds when you are done. The tool runner never calls this, so one instance can serve several runs, and a `with` block
src/anthropic/lib/tools/_toolsets/_base.py:299
↓ 3 callers
Method
close
(self)
src/anthropic/lib/credentials/_close.py:14
↓ 3 callers
Method
close
(self)
src/anthropic/lib/middleware/_fallbacks.py:1703
↓ 3 callers
Function
consume_async_iterator
(iterator: AsyncIterator[Any])
src/anthropic/_utils/_streams.py:10
↓ 3 callers
Function
consume_sync_iterator
(iterator: Iterator[Any])
src/anthropic/_utils/_streams.py:5
↓ 3 callers
Method
copy
( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] — narrows `credentials` to No
src/anthropic/lib/aws/_client.py:406
↓ 3 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:163
↓ 3 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:329
← previous
next →
701–800 of 14,068, ranked by callers