Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ types & classes
Types & classes
3,937 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
12,274
◇
Types & classes
3,937
↳
Endpoints
46
↓ 197 callers
Class
UnionDiscriminator
Annotated metadata naming the field that tells the variants of a union apart, e.g. ```py Pet: TypeAlias = Annotated[Union[Cat, Dog], UnionDis
src/anthropic/_models.py:789
↓ 181 callers
Class
Anthropic
src/anthropic/_client.py:151
↓ 122 callers
Class
AsyncAnthropic
src/anthropic/_client.py:566
↓ 111 callers
Class
BetaRefusalFallbackMiddleware
Middleware that retries refused beta `/v1/messages` requests down a fallback chain, reproducing the server-side `fallbacks` wire shape client-
src/anthropic/lib/middleware/_fallbacks.py:106
↓ 97 callers
Class
UnavailableMemberError
The refusal the model reads for a member the driver does not implement.
src/anthropic/lib/tools/_toolsets/_errors.py:97
↓ 84 callers
Class
AgentToolContext
Workdir + path-policy for the agent toolset. Trust model — two tiers: - The file tools (`beta_read_tool`, `beta_write_tool`, `beta_edi
src/anthropic/lib/tools/agent_toolset.py:196
↓ 79 callers
Class
FakeBrowser
tests/lib/tools/toolsets/_fakes.py:158
↓ 77 callers
Class
AnthropicGoogleCloud
Synchronous client for Claude Models on Google Cloud (Anthropic managed): the first-party Anthropic API served through Google's gateway. The
src/anthropic/lib/google_cloud/_client.py:240
↓ 75 callers
Class
ToolError
Error that can be raised from a tool to return structured content with `is_error: True`. When the tool runner catches this error, it will use the
src/anthropic/lib/tools/_beta_functions.py:30
↓ 74 callers
Class
CredentialsFile
An `AccessTokenProvider` backed by a named profile. A profile is a pair of files under the config directory (`~/.config/anthropic/` by defaul
src/anthropic/lib/credentials/_providers.py:146
↓ 68 callers
Class
FinalRequestOptions
src/anthropic/_models.py:1069
↓ 67 callers
Class
FakeAsyncEvents
tests/lib/tools/test_session_runner.py:190
↓ 48 callers
Class
BetaMemoryTool20250818CreateCommand
src/anthropic/types/beta/beta_memory_tool_20250818_create_command.py:8
↓ 48 callers
Class
_FakeTool
tests/lib/tools/test_session_runner.py:253
↓ 47 callers
Class
TokenCache
Thread-safe cache wrapping an `AccessTokenProvider` or an `AsyncAccessTokenProvider` with two-tier proactive refresh and single-flight semanti
src/anthropic/lib/credentials/_cache.py:75
↓ 46 callers
Class
AccessToken
An Anthropic API access token with optional expiry. `expires_at` is unix seconds; `None` means no expiry information (the token will be treat
src/anthropic/lib/credentials/_types.py:25
↓ 43 callers
Class
AsyncFakeBrowser
tests/lib/tools/toolsets/_fakes.py:228
↓ 41 callers
Class
AnthropicAWS
src/anthropic/lib/aws/_client.py:24
↓ 40 callers
Class
AsyncAnthropicGoogleCloud
Asynchronous client for Claude Models on Google Cloud (Anthropic managed): the first-party Anthropic API served through Google's gateway. See
src/anthropic/lib/google_cloud/_client.py:488
↓ 34 callers
Class
RecordingMiddleware
tests/test_middleware.py:90
↓ 34 callers
Class
WorkloadIdentityCredentials
Exchanges an external OIDC JWT for an Anthropic access token via the RFC 7523 `jwt-bearer` grant. This is an `AccessTokenProvider`: calling i
src/anthropic/lib/credentials/_workload.py:135
↓ 29 callers
Class
AnthropicBedrockMantle
src/anthropic/lib/bedrock/_mantle.py:144
↓ 28 callers
Class
AnthropicError
src/anthropic/_exceptions.py:43
↓ 25 callers
Class
EchoBrowserToolset
tests/lib/tools/toolsets/_stubs.py:43
↓ 25 callers
Class
EnvironmentWorker
Run a self-hosted environment worker. Composed from the work poller (`client.beta.environments.work.poller`) and the per-session `SessionTool
src/anthropic/lib/environments/_worker.py:314
↓ 24 callers
Class
FakeDesktop
tests/lib/tools/toolsets/_computer_fakes.py:78
↓ 23 callers
Class
_FakeSessions
tests/lib/environments/test_worker.py:142
↓ 22 callers
Class
AsyncAnthropicAWS
src/anthropic/lib/aws/_client.py:249
↓ 22 callers
Class
_StubWork
Minimal stand-in for `BetaSelfHostedWork` — only fields the poller reads.
tests/lib/environments/test_poller_method.py:42
↓ 21 callers
Class
AnthropicFoundry
src/anthropic/lib/foundry.py:93
↓ 20 callers
Class
AnthropicVertex
src/anthropic/lib/vertex/_client.py:55
↓ 20 callers
Class
BetaMemoryTool20250818ViewCommand
src/anthropic/types/beta/beta_memory_tool_20250818_view_command.py:9
↓ 20 callers
Class
SessionMemoryStores
The memory stores attached to one session, materialised on disk. `download` opens a `._file_store.LocalFileStore` at each attached store's di
src/anthropic/lib/tools/_memories.py:163
↓ 20 callers
Class
_FakeWorkResource
tests/lib/environments/test_worker.py:95
↓ 19 callers
Class
AsyncEchoBrowserToolset
tests/lib/tools/toolsets/_stubs.py:67
↓ 19 callers
Class
BetaFallbackState
Tracks which fallback a sequence of requests is pinned to. Create one and enter it (`with state:` — the same context manager works for both c
src/anthropic/lib/middleware/_fallbacks.py:64
↓ 19 callers
Class
Omit
To explicitly omit something from being sent in a request, use `omit`. ```py # as the default `Content-Type` header is `application/json
src/anthropic/_types.py:266
↓ 18 callers
Class
FakeWork
Sync resource fake. `poll_script` is consumed in order; values are either `BetaSelfHostedWork`-shaped stubs, `None` (no work available), `Exce
tests/lib/environments/test_poller_method.py:56
↓ 17 callers
Class
AnthropicBedrock
src/anthropic/lib/bedrock/_client.py:108
↓ 17 callers
Class
_FakeCredentials
Duck-typed stand-in for a `google.auth` Credentials object.
tests/lib/test_google_cloud.py:49
↓ 16 callers
Class
AsyncAnthropicVertex
src/anthropic/lib/vertex/_client.py:221
↓ 16 callers
Class
StaticToken
An `AccessTokenProvider` that always returns a fixed token with no expiry.
src/anthropic/lib/credentials/_providers.py:118
↓ 15 callers
Class
AsyncAnthropicFoundry
src/anthropic/lib/foundry.py:305
↓ 15 callers
Class
FakeClock
tests/lib/test_credentials.py:1581
↓ 14 callers
Class
APIResponse
src/anthropic/_response.py:298
↓ 13 callers
Class
APIRequest
A view over the request that the client is about to execute. Treat instances as immutable; use `copy()` to derive a modified request.
src/anthropic/_request.py:15
↓ 13 callers
Class
AsyncAPIResponse
src/anthropic/_response.py:411
↓ 13 callers
Class
BetaBrowserNavigateResult
Where a navigation ended up. Rendered as `Navigated to {url} — {title} (HTTP {status})`, each value made safe for one line of text (control, line-
src/anthropic/lib/tools/_toolsets/_results.py:32
↓ 13 callers
Class
BetaMemoryTool20250818InsertCommand
src/anthropic/types/beta/beta_memory_tool_20250818_insert_command.py:8
↓ 13 callers
Class
BetaToolUseBlock
src/anthropic/types/beta/beta_tool_use_block.py:16
↓ 13 callers
Class
CredentialsError
Raised when credentials cannot be loaded from local files, config, or the environment.
src/anthropic/_exceptions.py:164
↓ 12 callers
Class
BetaLocalFilePolicy
The file policy the SDK ships: `file_upload` may read paths under `upload_roots` (symlinks resolved, whole components compared, a `..` component r
src/anthropic/lib/tools/_toolsets/_security.py:165
↓ 12 callers
Class
Body
A response body that counts how often it is closed. It holds more than a test reads.
tests/utils.py:188
↓ 12 callers
Class
IdentityTokenFile
An `IdentityTokenProvider` that reads a JWT from a file on every call. Kubernetes projected service-account tokens (and similar) are rotated in p
src/anthropic/lib/credentials/_providers.py:746
↓ 12 callers
Class
InMemoryConfig
An `AccessTokenProvider` driven by an in-memory config dict (same shape as `configs/<profile>.json`) rather than files on disk. Intended for
src/anthropic/lib/credentials/_providers.py:797
↓ 12 callers
Class
Spans
tests/lib/tools/test_open_telemetry.py:116
↓ 11 callers
Class
BetaMemoryTool20250818StrReplaceCommand
src/anthropic/types/beta/beta_memory_tool_20250818_str_replace_command.py:8
↓ 11 callers
Class
TwoMembers
tests/lib/tools/toolsets/test_interface.py:48
↓ 11 callers
Class
WorkloadIdentityError
Raised when the OIDC token exchange (`POST /v1/oauth/token`) fails.
src/anthropic/lib/credentials/_workload.py:107
↓ 10 callers
Class
AsyncFakeDesktop
tests/lib/tools/toolsets/_computer_fakes.py:133
↓ 10 callers
Class
BetaMemoryTool20250818RenameCommand
src/anthropic/types/beta/beta_memory_tool_20250818_rename_command.py:8
↓ 10 callers
Class
BetaScreenshotResult
A screenshot or zoom image from a browser or computer toolset, rendered as one image block. The image must already fit the model's image limits: t
src/anthropic/lib/tools/_toolsets/_base.py:86
↓ 10 callers
Class
PageInfo
Stores the necessary information to build the request to retrieve the next page. Either `url` or `params` must be set.
src/anthropic/_base_client.py:171
↓ 10 callers
Class
SessionToolRunner
Attach to a managed-agents session and dispatch its tool calls locally. The sessions-side counterpart to `client.beta.messages.tool_runner`: an
src/anthropic/lib/tools/_beta_session_runner.py:387
↓ 10 callers
Class
ToolsetContractError
Misuse of the SDK's own interface detected at call time (for example a `url_policy` that returns a value).
src/anthropic/lib/tools/_toolsets/_errors.py:54
↓ 9 callers
Class
AsyncAnthropicBedrockMantle
src/anthropic/lib/bedrock/_mantle.py:334
↓ 9 callers
Class
BetaBrowserState
The browser after a call: what `_browser_state` returns. Forwarded to the API with download paths the file policy does not expose removed and each
src/anthropic/lib/tools/_toolsets/_results.py:79
↓ 9 callers
Class
BetaManagedAgentsTextBlock
Regular text content.
src/anthropic/types/beta/sessions/beta_managed_agents_text_block.py:8
↓ 9 callers
Class
FakeAsyncWork
tests/lib/environments/test_poller_method.py:82
↓ 9 callers
Class
Querystring
src/anthropic/_qs.py:20
↓ 9 callers
Class
TwoMembers
tests/lib/tools/toolsets/test_computer_interface.py:37
↓ 9 callers
Class
_FakeStream
Stand-in for the AsyncStream returned by `events.stream()`. Yields scripted events in order; once exhausted, blocks forever (the real stream
tests/lib/tools/test_session_runner.py:148
↓ 9 callers
Class
_StubEvent
Stand-in for the various session event types — only the fields the runner reads are populated.
tests/lib/tools/test_session_runner.py:65
↓ 8 callers
Class
AsyncAnthropicBedrock
src/anthropic/lib/bedrock/_client.py:289
↓ 8 callers
Class
BetaMemoryTool20250818DeleteCommand
src/anthropic/types/beta/beta_memory_tool_20250818_delete_command.py:8
↓ 8 callers
Class
BetaToolsetCallContext
What a member receives alongside its input: the `tool_use` block the call answers (`context.tool_use.id`). `None` only when a member is invoked ou
src/anthropic/lib/tools/_toolsets/_runnable.py:76
↓ 8 callers
Class
FileStoreError
A refused operation — input the store will not act on. OS errors propagate as `OSError`.
src/anthropic/lib/tools/_file_store.py:36
↓ 8 callers
Class
Server
Answers a call, after one retry if `retried`. Records each request, and the context of the span that was current while the HTTP client sent it.
tests/test_tracing.py:99
↓ 8 callers
Class
_FakeClient
Minimal stand-in for `AsyncAnthropic` — only exposes the resource path the runner reads.
tests/lib/tools/test_session_runner.py:287
↓ 7 callers
Class
BetaBrowserNavigateInput
Navigate to a URL, or go back/forward/reload in history. The protocol may be omitted (defaults to https://).
src/anthropic/types/beta/beta_browser_navigate_input.py:8
↓ 7 callers
Class
CountingProvider
tests/lib/test_credentials.py:1589
↓ 7 callers
Class
OpenTelemetryConfig
What a client's `open_telemetry` option says about its spans, once `resolve_open_telemetry` has resolved it.
src/anthropic/lib/_tracing/_config.py:12
↓ 7 callers
Class
Provider
tests/lib/test_credentials.py:3602
↓ 7 callers
Class
StartAttributes
Keeps the name and the attributes that each span starts with, which is all that a sampler is given.
tests/test_open_telemetry.py:193
↓ 7 callers
Class
User
tests/test_utils/test_json.py:49
↓ 6 callers
Class
BetaComputerCursorPositionResult
Where the cursor is, in screenshot pixels; rendered as `X={x},Y={y}`.
src/anthropic/lib/tools/_toolsets/_computer_results.py:26
↓ 6 callers
Class
InspectResponse
Records the response wrapper returned by `call_next` and passes it through.
tests/test_middleware.py:255
↓ 6 callers
Class
JSONOutputFormatParam
src/anthropic/types/json_output_format_param.py:9
↓ 6 callers
Class
ToolsetConfigError
A construction-time mistake: an option combination the toolset cannot honour.
src/anthropic/lib/tools/_toolsets/_errors.py:50
↓ 6 callers
Class
_PolledWorkResource
The work resource of a client that has spans, which answers the worker's polls with `items`.
tests/lib/environments/test_worker.py:1235
↓ 6 callers
Class
_Tool
Stands in for a `@beta_tool` / toolset object: `tools=` takes anything with a `to_dict()`.
tests/lib/test_stainless_helpers.py:21
↓ 5 callers
Class
APIStatusError
Raised when an API response has a status code of 4xx or 5xx.
src/anthropic/_exceptions.py:85
↓ 5 callers
Class
AttemptRecorder
Records the `retries_taken` and response status of every attempt the chain runs for.
tests/test_middleware.py:198
↓ 5 callers
Class
Desktop
The desktop both fakes drive: the cursor, a call log, and what each member hands back.
tests/lib/tools/toolsets/_computer_fakes.py:33
↓ 5 callers
Class
Forecast
tests/lib/threads/helpers.py:50
↓ 5 callers
Class
Model
tests/test_models.py:176
↓ 5 callers
Class
RecordingProvider
tests/test_tracing.py:68
↓ 5 callers
Class
_Lease
This worker's view of one work-item lease: whether it has ended, and why. Shared by `_heartbeat_loop` and the code serving the item. The first
src/anthropic/lib/environments/_worker.py:129
↓ 4 callers
Class
AWSEventStreamDecoder
src/anthropic/lib/bedrock/_stream_decoder.py:25
↓ 4 callers
Class
AsyncStream
Provides the core interface to iterate over an asynchronous stream response.
src/anthropic/_streaming.py:154
next →
1–100 of 3,937, ranked by callers