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
Method
retrieve
This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a re
src/anthropic/resources/beta/messages/batches.py:647
↓ 1 callers
Method
retrieve
This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a re
src/anthropic/resources/messages/batches.py:135
↓ 1 callers
Method
retrieve
This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a re
src/anthropic/resources/messages/batches.py:576
↓ 1 callers
Function
rich_print_str
Like `rich.print()` but returns the string instead
tests/lib/utils.py:66
↓ 1 callers
Function
rows
()
tests/test_prepare.py:779
↓ 1 callers
Method
run
Poll the environment and service each claimed session until cancelled. Loops forever; cancel the task (or wrap it in `asyncio.wait_for`)
src/anthropic/lib/environments/_worker.py:306
↓ 1 callers
Function
run_runnable_tool
Call `tool` with `input`, awaiting the result if the tool is async. Sync tools run on a worker thread. If the caller cancels (for example on a
src/anthropic/lib/tools/_tool_dispatch.py:302
↓ 1 callers
Function
runner
(*args: Any, **options: Any)
tests/lib/tools/test_session_runner_properties.py:598
↓ 1 callers
Function
same_messages
(a: Sequence[BetaMessageParam], b: Sequence[BetaMessageParam])
src/anthropic/lib/threads/_thread_state.py:631
↓ 1 callers
Function
scan
(full: Path)
src/anthropic/lib/tools/agent_toolset.py:1210
↓ 1 callers
Function
scoped_and_copy
(parent: ClientT)
tests/lib/test_scoped_client.py:326
↓ 1 callers
Method
select
(self, timeout: float | None = None)
tests/lib/tools/_fake_sessions_api.py:1025
↓ 1 callers
Function
serialize_data
The JSON text that `data` is sent as once prepared.
src/anthropic/_utils/_prepare.py:75
↓ 1 callers
Function
serve
(self: Any, context: Any, input: Any)
tests/lib/tools/toolsets/test_computer_interface.py:244
↓ 1 callers
Function
serve_stream
Serves the `stream_events` to each request on a local port, and gives the base URL.
tests/test_open_telemetry.py:654
↓ 1 callers
Function
server_attributes
(base_url: httpx2.URL)
src/anthropic/_tracing.py:874
↓ 1 callers
Function
set_created_id_attribute
Sets the ID of the object that the call created, from the response field that `span_created_id` names.
src/anthropic/_tracing.py:459
↓ 1 callers
Method
set_current
(self, thread: str | None)
src/anthropic/lib/tools/_beta_session_runner.py:936
↓ 1 callers
Function
set_time_to_first_chunk
(span: AnthropicSpan, start_time: int)
src/anthropic/lib/_tracing/_response.py:18
↓ 1 callers
Function
set_url_attributes
Sets the `url.*` attributes for a request to `url`. Of its query, they have only the `query_params`. A query that is content, and the full URL th
src/anthropic/_tracing.py:703
↓ 1 callers
Method
setup_skills
Download the skills of the session's agent and its subagents into `{workdir}/skills/<name>/`. No-op unless `client` is set together with `ses
src/anthropic/lib/tools/agent_toolset.py:328
↓ 1 callers
Method
share_snapshot
(self, reader: SnapshotReader)
src/anthropic/lib/_tracing/_streaming.py:123
↓ 1 callers
Method
should_sample
(self, *args: Any, **kwargs: Any)
tests/test_open_telemetry.py:7907
↓ 1 callers
Function
skeleton
Compact structural skeleton of a spliced stream — no text content.
tests/lib/test_refusal_fallback_streaming.py:184
↓ 1 callers
Function
skill_response
(request: Request)
tests/lib/environments/_fake_work_api.py:556
↓ 1 callers
Function
skills_with_subagents
The first version of a skill wins.
src/anthropic/lib/tools/_skills.py:275
↓ 1 callers
Function
sleep_in_thread
Blocks a worker thread while the virtual clock advances.
tests/lib/environments/_schedules.py:306
↓ 1 callers
Function
sleeping
(seconds: float)
tests/lib/environments/test_worker_properties.py:341
↓ 1 callers
Function
span_ending_stream
The wrapper of the same kind as `body`, so that the checks of `httpx2.Response` on the kind still hold.
src/anthropic/_tracing.py:628
↓ 1 callers
Function
span_request_attributes
What `SPAN_ATTRIBUTES` gives the span of the call from its request, for the span to start with. Never raises. A header has the value that the cal
src/anthropic/_tracing.py:780
↓ 1 callers
Function
sse
(event: dict[str, Any])
tests/lib/tools/test_runner_eager_tools.py:960
↓ 1 callers
Function
stainless_helper_header
Build x-stainless-helper header dict from tools and messages. Returns an empty dict if no helpers are found.
src/anthropic/lib/_stainless_helpers.py:148
↓ 1 callers
Method
start
Track a content_block_start, shifting `event["index"]`.
src/anthropic/lib/middleware/_fallbacks.py:1287
↓ 1 callers
Function
start_tool_runner_span
Starts the span of one loop of the Messages tool runner. The runner sets its status and ends it. Never raises: a loop whose span cannot start run
src/anthropic/lib/_tracing/_tools.py:34
↓ 1 callers
Method
start_turn
(self, thread: str = PRIMARY)
tests/lib/tools/_fake_sessions_api.py:309
↓ 1 callers
Method
stop
(self)
examples/memory/basic.py:55
↓ 1 callers
Method
str_replace
Replace text in a memory file.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:259
↓ 1 callers
Method
stream_closed
(self, session: FakeSession, stream: Connection)
tests/lib/tools/_fake_sessions_api.py:892
↓ 1 callers
Method
stream_to_file
Streams the output to the given file. Accepts a filename or any path-like object, e.g. pathlib.Path
src/anthropic/_response.py:576
↓ 1 callers
Method
stringify
( self, params: Params, *, array_format: ArrayFormat | NotGiven = not_given,
src/anthropic/_qs.py:37
↓ 1 callers
Function
strip_annotated_type
(typ: type)
src/anthropic/_utils/_typing.py:76
↓ 1 callers
Function
strip_omit
(obj: None)
src/anthropic/_utils/_utils.py:329
↓ 1 callers
Method
sync_auth_flow
(self, request: httpx2.Request)
src/anthropic/lib/credentials/_auth.py:96
↓ 1 callers
Function
sync_client
()
tests/lib/test_google_cloud_live.py:33
↓ 1 callers
Function
sync_client
()
examples/vertex.py:11
↓ 1 callers
Method
sync_if_due
Run one sync when `sync_interval` has elapsed since the last. Stores sync in parallel; a store's own paths reconcile in a determinist
src/anthropic/lib/tools/_memories.py:463
↓ 1 callers
Function
sync_main
(loop: asyncio.AbstractEventLoop)
tests/lib/environments/_schedules.py:177
↓ 1 callers
Method
take_slot
(self)
src/anthropic/lib/tools/_memories.py:159
↓ 1 callers
Function
takes_pydantic
(model: pydantic.BaseModel)
tests/test_models.py:670
↓ 1 callers
Function
target_tab
Which tab a call targets: the tab it names by `tab_id`, else the active tab. `None` when the named tab is not in the report (or nothing is active)
src/anthropic/lib/tools/_toolsets/_pipeline.py:137
↓ 1 callers
Method
text
Read and decode the response content into a string.
src/anthropic/_response.py:371
↓ 1 callers
Method
text
(self)
src/anthropic/lib/tools/_files.py:85
↓ 1 callers
Method
texts
(self)
src/anthropic/lib/tools/agent_toolset.py:798
↓ 1 callers
Method
to_dict
Recursively generate a dictionary representation of the model, optionally specifying which fields to include or exclude. By default, fields t
src/anthropic/_models.py:215
↓ 1 callers
Method
to_dict
(self)
src/anthropic/lib/tools/_beta_functions.py:75
↓ 1 callers
Method
to_dict
(self)
src/anthropic/lib/tools/_beta_functions.py:93
↓ 1 callers
Method
to_dict
(self)
src/anthropic/lib/tools/_toolsets/_computer.py:118
↓ 1 callers
Method
to_dict
(self)
src/anthropic/lib/tools/_toolsets/_browser.py:182
↓ 1 callers
Function
to_message
The reply as the message the API sends for it when not streaming.
tests/lib/tools/test_runner_eager_tools.py:943
↓ 1 callers
Function
to_thread
( func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs )
src/anthropic/_utils/_sync.py:16
↓ 1 callers
Function
to_tool_params
Replace every `to_dict()`-bearing object in `tools` with its entry, keeping order and helper tags.
src/anthropic/lib/tools/_tool_params.py:31
↓ 1 callers
Function
tokens
(usage: object, field: str)
src/anthropic/lib/_tracing/_response.py:84
↓ 1 callers
Function
tool_description
(tool: object)
src/anthropic/lib/_tracing/_tools.py:157
↓ 1 callers
Method
tool_ended
(self, session: FakeSession, id: str)
tests/lib/tools/_fake_sessions_api.py:890
↓ 1 callers
Method
tool_started
(self, session: FakeSession, id: str)
tests/lib/tools/_fake_sessions_api.py:889
↓ 1 callers
Function
trace_context_injector
`opentelemetry.propagate.inject`, or `None` when the propagators that the environment names cannot be loaded.
src/anthropic/_tracing.py:896
↓ 1 callers
Function
traces_of
A copy of the `traces` of `options` as a dict. `True` and `False` are short for `enabled`.
src/anthropic/_tracing.py:232
↓ 1 callers
Function
truncate_tool_result_content
Serializes `blocks` to JSON within `limit` bytes of UTF-8, dropping the last blocks first. `size` gives the bytes of a string, and never fewer th
src/anthropic/lib/_tracing/_content.py:270
↓ 1 callers
Method
try_start
(self, call: DispatchedToolUseEvent, run: Callable[[RunningCall], Awaitable[None]])
src/anthropic/lib/tools/_beta_session_runner.py:897
↓ 1 callers
Function
two_tool_uses_response
(id: str)
tests/lib/threads/helpers.py:669
↓ 1 callers
Method
type
(self, context: BetaToolsetCallContext, input: BetaBrowserTypeInput)
src/anthropic/lib/tools/_toolsets/_browser.py:381
↓ 1 callers
Function
type_names_under
The `type` of each member of a union and of everything in their fields, except inside a `stop_at` type.
tests/test_open_telemetry.py:8262
↓ 1 callers
Method
unconfirmed_calls
(self)
src/anthropic/lib/tools/_beta_session_runner.py:745
↓ 1 callers
Function
under
(path: tuple[str, ...], parent: tuple[str, ...])
tests/test_open_telemetry.py:8362
↓ 1 callers
Function
unfinished
(api: FakeApi, workers: tuple[str, ...])
tests/lib/environments/test_worker_properties.py:237
↓ 1 callers
Method
unposted
(self, session: FakeSession)
tests/lib/tools/test_session_runner_properties.py:304
↓ 1 callers
Method
until_done
Blocks until the stream has been consumed
src/anthropic/lib/streaming/_beta_messages.py:131
↓ 1 callers
Method
until_done
Waits until the stream has been consumed
src/anthropic/lib/streaming/_beta_messages.py:303
↓ 1 callers
Method
until_done
Waits until the stream has been consumed
src/anthropic/lib/streaming/_messages.py:292
↓ 1 callers
Method
user_input
One soon after another does nothing.
tests/lib/environments/_fake_work_api.py:244
↓ 1 callers
Function
validate_async_middleware
(middleware: Iterable[MiddlewareInput])
src/anthropic/_middleware.py:107
↓ 1 callers
Function
validate_sync_middleware
(middleware: Iterable[MiddlewareInput])
src/anthropic/_middleware.py:85
↓ 1 callers
Function
vetted_upload_entries
One `file_upload` field run through the file policy's `hook`: the entries the driver receives, read once (a generator is spent after one pass).
src/anthropic/lib/tools/_toolsets/_pipeline.py:365
↓ 1 callers
Method
view
View the contents of a memory path.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:249
↓ 1 callers
Method
violations
(self)
tests/lib/environments/test_worker_properties.py:142
↓ 1 callers
Method
wait_for_all
Returns once no call is running. It never returns after a call raised.
src/anthropic/lib/tools/_beta_session_runner.py:918
↓ 1 callers
Function
walk
(e: Optional[BaseException])
tests/lib/test_credentials.py:5169
↓ 1 callers
Function
warn_env_api_key_shadows_env_auth_token
Warn that `ANTHROPIC_AUTH_TOKEN` is ignored because `ANTHROPIC_API_KEY` is set as well.
src/anthropic/lib/credentials/_auth.py:48
↓ 1 callers
Function
warn_env_static_shadows_auto_discovery
Warn that an `ANTHROPIC_API_KEY` / `ANTHROPIC_AUTH_TOKEN` from the environment is shadowing the SDK's profile / federation auto-discovery. Pe
src/anthropic/lib/credentials/_auth.py:30
↓ 1 callers
Method
withhold_snapshot
(self)
src/anthropic/lib/_tracing/_streaming.py:126
↓ 1 callers
Function
without
`fields` without the value at `path`, as a copy that shares what the path does not go through.
src/anthropic/lib/_tracing/_response.py:89
↓ 1 callers
Function
without_cache_control
A copy of `value`, which `as_sent()` returned, without the `cache_control` of any block in it, however deep. Only the keys that hold blocks are fo
src/anthropic/lib/threads/_thread_state.py:652
↓ 1 callers
Method
without_events
(self)
src/anthropic/lib/tools/_beta_session_runner.py:706
↓ 1 callers
Function
without_message_delta_fields
The fields of the streamed `message` without what is under `FINAL_FROM_MESSAGE_DELTA`. Until that event the snapshot has what `message_start` put
src/anthropic/lib/_tracing/_response.py:34
↓ 1 callers
Function
without_omit
`hints` with the `| Omit` that every optional field of a thread params type adds to the type `create()` gives it.
tests/lib/threads/test_beta_threads.py:2250
↓ 1 callers
Method
work_without_lease
(self)
tests/lib/environments/test_worker_properties.py:165
↓ 1 callers
Function
write
Write a file, creating parent directories as needed.
src/anthropic/lib/tools/agent_toolset.py:1009
↓ 1 callers
Function
write_package
(repo: Path, files: dict[str, str])
tests/test_detect_breaking_changes.py:53
↓ 1 callers
Method
wrong_credentials
(self)
tests/lib/environments/test_worker_properties.py:158
↓ 1 callers
Method
wrong_heartbeats
(self)
tests/lib/environments/test_worker_properties.py:178
← previous
next →
1,901–2,000 of 13,873, ranked by callers