MCPcopy Create free account

hub / github.com/anthropics/anthropic-sdk-python / types & classes

Types & classes1,509 in github.com/anthropics/anthropic-sdk-python

↓ 224 callersClassPropertyInfo
Metadata class to be used in Annotated types to provide information about a given type. For example: class MyParams(TypedDict): acco
src/anthropic/_utils/_transform.py:44
↓ 99 callersClassAnthropic
src/anthropic/_client.py:134
↓ 81 callersClassFinalRequestOptions
src/anthropic/_models.py:936
↓ 66 callersClassBetaRefusalFallbackMiddleware
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:94
↓ 62 callersClassToolError
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 t
src/anthropic/lib/tools/_beta_functions.py:30
↓ 59 callersClassAnthropicError
src/anthropic/_exceptions.py:25
↓ 58 callersClassCredentialsFile
An :class:`AccessTokenProvider` backed by a named profile. A profile is a pair of files under the config directory (``~/.config/anthropic/``
src/anthropic/lib/credentials/_providers.py:137
↓ 57 callersClassAsyncAnthropic
src/anthropic/_client.py:551
↓ 52 callersClassBetaMemoryTool20250818CreateCommand
src/anthropic/types/beta/beta_memory_tool_20250818_create_command.py:10
↓ 45 callersClassRecordingMiddleware
tests/test_middleware.py:89
↓ 40 callersClassAccessToken
An Anthropic API access token with optional expiry. ``expires_at`` is unix seconds; ``None`` means no expiry information (the token will be t
src/anthropic/lib/credentials/_types.py:15
↓ 34 callersClassWorkloadIdentityCredentials
Exchanges an external OIDC JWT for an Anthropic access token via the RFC 7523 ``jwt-bearer`` grant. This is an :class:`AccessTokenProvider`:
src/anthropic/lib/credentials/_workload.py:126
↓ 31 callersClassAgentToolContext
Workdir + path-policy for the agent toolset. Trust model — two tiers: - The file tools (:func:`beta_read_tool`, :func:`beta_write_tool`,
src/anthropic/lib/tools/agent_toolset.py:152
↓ 29 callersClassAnthropicAWS
src/anthropic/lib/aws/_client.py:23
↓ 26 callersClassFakeAsyncEvents
tests/lib/tools/test_session_runner.py:156
↓ 24 callersClassAnthropicBedrockMantle
src/anthropic/lib/bedrock/_mantle.py:164
↓ 22 callersClass_StubWork
Minimal stand-in for ``BetaSelfHostedWork`` — only fields the poller reads.
tests/lib/environments/test_poller_method.py:28
↓ 21 callersClassTokenCache
Thread-safe cache wrapping an :class:`AccessTokenProvider` with two-tier proactive refresh and single-flight semantics. Refresh policy on eac
src/anthropic/lib/credentials/_cache.py:25
↓ 21 callersClass_FakeTool
tests/lib/tools/test_session_runner.py:211
↓ 20 callersClassWorkloadIdentityError
Raised when the OIDC token exchange (``POST /v1/oauth/token``) fails.
src/anthropic/lib/credentials/_workload.py:98
↓ 19 callersClassStaticToken
An :class:`AccessTokenProvider` that always returns a fixed token with no expiry.
src/anthropic/lib/credentials/_providers.py:109
↓ 17 callersClassBetaFallbackState
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:52
↓ 16 callersClassFakeWork
Sync resource fake. ``poll_script`` is consumed in order; values are either ``BetaSelfHostedWork``-shaped stubs, ``None`` (no work available),
tests/lib/environments/test_poller_method.py:42
↓ 14 callersClassAPIRequest
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
↓ 14 callersClassAnthropicFoundry
src/anthropic/lib/foundry.py:95
↓ 13 callersClassBetaMemoryTool20250818ViewCommand
src/anthropic/types/beta/beta_memory_tool_20250818_view_command.py:11
↓ 13 callersClassIdentityTokenFile
An :class:`IdentityTokenProvider` that reads a JWT from a file on every call. Kubernetes projected service-account tokens (and similar) are rotat
src/anthropic/lib/credentials/_providers.py:670
↓ 13 callersClassModel
tests/test_models.py:162
↓ 12 callersClassInMemoryConfig
An :class:`AccessTokenProvider` driven by an in-memory config dict (same shape as ``configs/<profile>.json``) rather than files on disk. Inte
src/anthropic/lib/credentials/_providers.py:716
↓ 11 callersClassAPIResponse
src/anthropic/_response.py:301
↓ 10 callersClassAnthropicVertex
src/anthropic/lib/vertex/_client.py:92
↓ 10 callersClassAsyncAPIResponse
src/anthropic/_response.py:410
↓ 10 callersClassAsyncAnthropicVertex
src/anthropic/lib/vertex/_client.py:256
↓ 10 callersClassBetaManagedAgentsTextBlock
Regular text content.
src/anthropic/types/beta/sessions/beta_managed_agents_text_block.py:10
↓ 10 callersClassBetaMemoryTool20250818InsertCommand
src/anthropic/types/beta/beta_memory_tool_20250818_insert_command.py:10
↓ 10 callersClassEnvironmentWorker
Run a self-hosted environment worker. Composed from the control-plane poller (``client.beta.environments.work.poller``) and the per-session :
src/anthropic/lib/environments/_worker.py:166
↓ 10 callersClassLegacyAPIResponse
This is a legacy class as it will be replaced by `APIResponse` and `AsyncAPIResponse` in the `_response.py` file in the next major release.
src/anthropic/_legacy_response.py:47
↓ 10 callersClassPageInfo
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:137
↓ 10 callersClassUser
tests/test_utils/test_json.py:25
↓ 10 callersClass_FakeSessions
tests/lib/environments/test_worker.py:75
↓ 9 callersClassAnthropicBedrock
src/anthropic/lib/bedrock/_client.py:133
↓ 9 callersClassAsyncAnthropicFoundry
src/anthropic/lib/foundry.py:320
↓ 9 callersClassFakeClock
tests/lib/test_credentials.py:1346
↓ 9 callersClassOmit
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:164
↓ 9 callersClassQuerystring
src/anthropic/_qs.py:19
↓ 8 callersClassAsyncAnthropicAWS
src/anthropic/lib/aws/_client.py:222
↓ 8 callersClassBetaMemoryTool20250818DeleteCommand
src/anthropic/types/beta/beta_memory_tool_20250818_delete_command.py:10
↓ 8 callersClassBetaMemoryTool20250818RenameCommand
src/anthropic/types/beta/beta_memory_tool_20250818_rename_command.py:10
↓ 8 callersClassBetaMemoryTool20250818StrReplaceCommand
src/anthropic/types/beta/beta_memory_tool_20250818_str_replace_command.py:10
↓ 8 callersClassUnsupportedMCPValueError
Raised when an MCP value cannot be converted to a format supported by the Claude API.
src/anthropic/lib/tools/mcp.py:104
↓ 8 callersClass_FakeWorkResource
tests/lib/environments/test_worker.py:36
↓ 7 callersClassAPIStatusError
Raised when an API response has a status code of 4xx or 5xx.
src/anthropic/_exceptions.py:65
↓ 7 callersClassFakeAsyncWork
tests/lib/environments/test_poller_method.py:70
↓ 7 callersClass_StubEvent
Stand-in for the various session event types — only the fields the runner reads are populated.
tests/lib/tools/test_session_runner.py:61
↓ 6 callersClassCountingProvider
tests/lib/test_credentials.py:1354
↓ 6 callersClassInspectResponse
Records the response wrapper returned by `call_next` and passes it through.
tests/test_middleware.py:254
↓ 6 callersClassJSONOutputFormatParam
src/anthropic/types/json_output_format_param.py:11
↓ 6 callersClassNotGiven
For parameters with a meaningful None value, we need to distinguish between the user explicitly passing None, and the user not passing the pa
src/anthropic/_types.py:131
↓ 6 callersClass_TaggedDict
A dict subclass that can carry a ``_stainless_helper`` attribute. Behaves identically to a regular dict for serialization and isinstance checks,
src/anthropic/lib/tools/mcp.py:74
↓ 5 callersClassAttemptRecorder
Records the `retries_taken` and response status of every attempt the chain runs for.
tests/test_middleware.py:197
↓ 4 callersClassAWSEventStreamDecoder
src/anthropic/lib/bedrock/_stream_decoder.py:25
↓ 4 callersClassAsyncAnthropicBedrock
src/anthropic/lib/bedrock/_client.py:313
↓ 4 callersClassAsyncAnthropicBedrockMantle
src/anthropic/lib/bedrock/_mantle.py:360
↓ 4 callersClassBetaJSONOutputFormatParam
src/anthropic/types/beta/beta_json_output_format_param.py:11
↓ 4 callersClassCredentialResult
Bundles an :class:`AccessTokenProvider` with config-level metadata. Returned by :func:`default_credentials`. The ``extra_headers`` dict carri
src/anthropic/lib/credentials/_types.py:49
↓ 4 callersClassExploding
tests/test_middleware.py:232
↓ 4 callersClassModelFallback
tests/test_middleware.py:133
↓ 4 callersClassSessionToolRunner
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:277
↓ 4 callersClass_HopFailure
A fallback hop whose request failed; stamps `recommended_model` when it ends the chain.
src/anthropic/lib/middleware/_fallbacks.py:720
↓ 4 callersClass_HopReader
Consumes one hop's SSE events, producing the frames to forward to the client while accumulating its content blocks. Events are held until the
src/anthropic/lib/middleware/_fallbacks.py:755
↓ 3 callersClassAPIResponseValidationError
src/anthropic/_exceptions.py:51
↓ 3 callersClassAsyncCallableMiddleware
A middleware object that is a class instance with an async `__call__` method.
tests/test_middleware.py:292
↓ 3 callersClassAsyncMessages
src/anthropic/lib/bedrock/_beta_messages.py:37
↓ 3 callersClassAsyncMessages
src/anthropic/lib/vertex/_beta_messages.py:39
↓ 3 callersClassAsyncMessagesWithRawResponse
src/anthropic/lib/vertex/_beta_messages.py:73
↓ 3 callersClassAsyncMessagesWithStreamingResponse
src/anthropic/lib/vertex/_beta_messages.py:91
↓ 3 callersClassAsyncStream
Provides the core interface to iterate over an asynchronous stream response.
src/anthropic/_streaming.py:213
↓ 3 callersClassBetaInputJSONDelta
src/anthropic/types/beta/beta_input_json_delta.py:10
↓ 3 callersClassBetaLocalFilesystemMemoryTool
File-based memory storage implementation for Claude conversations
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:378
↓ 3 callersClassBetaMessageParam
src/anthropic/types/beta/beta_message_param.py:13
↓ 3 callersClassBetaRawContentBlockDeltaEvent
src/anthropic/types/beta/beta_raw_content_block_delta_event.py:11
↓ 3 callersClassBetaUsage
src/anthropic/types/beta/beta_usage.py:15
↓ 3 callersClassBoom
tests/test_middleware.py:228
↓ 3 callersClassMessages
src/anthropic/lib/bedrock/_beta_messages.py:14
↓ 3 callersClassMessages
src/anthropic/lib/vertex/_beta_messages.py:14
↓ 3 callersClassMessagesWithRawResponse
src/anthropic/lib/vertex/_beta_messages.py:64
↓ 3 callersClassMessagesWithStreamingResponse
src/anthropic/lib/vertex/_beta_messages.py:82
↓ 3 callersClassP
tests/lib/test_credentials.py:1403
↓ 3 callersClassParsedBetaMessage
src/anthropic/types/beta/parsed_beta_message.py:67
↓ 3 callersClassSSEDecoder
src/anthropic/_streaming.py:413
↓ 3 callersClassServerSentEvent
src/anthropic/_streaming.py:361
↓ 3 callersClassStream
Provides the core interface to iterate over a synchronous stream response.
src/anthropic/_streaming.py:45
↓ 3 callersClassSyncCallableMiddleware
A middleware object that is a class instance with a sync `__call__` method.
tests/test_middleware.py:303
↓ 3 callersClass_FakeStream
Stand-in for the AsyncStream returned by ``events.stream()``. Yields scripted events in order; once exhausted, blocks forever (the real strea
tests/lib/tools/test_session_runner.py:114
↓ 2 callersClassAPIConnectionError
src/anthropic/_exceptions.py:86
↓ 2 callersClassAPITimeoutError
src/anthropic/_exceptions.py:91
↓ 2 callersClassAccessTokenAuth
Adapts a :class:`TokenCache` to httpx's :class:`~httpx.Auth` protocol. Used by :meth:`anthropic.Anthropic.custom_auth` to inject ``Authorization:
src/anthropic/lib/credentials/_auth.py:65
↓ 2 callersClassAddress
tests/test_utils/test_json.py:85
↓ 2 callersClassAgentsWithRawResponse
src/anthropic/resources/beta/agents/agents.py:847
↓ 2 callersClassAgentsWithStreamingResponse
src/anthropic/resources/beta/agents/agents.py:897
next →1–100 of 1,509, ranked by callers