MCPcopy Create free account

hub / github.com/anthropics/anthropic-sdk-python / functions

Functions9,455 in github.com/anthropics/anthropic-sdk-python

↓ 21 callersMethodupload
Upload File Args: file: The file to upload. Only the final path component of the part's `filename` is kept;
src/anthropic/resources/files.py:265
↓ 20 callersFunction_fake_client
(work: _FakeWorkResource, sessions: _FakeSessions)
tests/lib/environments/test_worker.py:146
↓ 20 callersMethoddefer_tool_call
Hold a tool call of the current reply until you are done with the reply, which is when it runs without `run_tools_eagerly`: at the end of the
src/anthropic/lib/tools/_beta_runner.py:691
↓ 20 callersMethoddownload
Download every attached store's memories to disk. `session` arrives already fetched — one snapshot shared with the skills download.
src/anthropic/lib/tools/_memories.py:282
↓ 20 callersMethodgenerate_tool_call_response
Generate a MessageParam by calling tool functions with any tool use blocks from the last message. Note the tool call response is cached, repe
src/anthropic/lib/tools/_beta_runner.py:536
↓ 20 callersFunctionget_directory_snapshot
Get a snapshot of directory contents with relative paths.
tests/lib/tools/memory_tools/test_filesystem.py:42
↓ 20 callersMethodretrieve_metadata
Get File Metadata Args: file_id: ID of the File. workspace_id: Optional header to select the Workspace for this
src/anthropic/resources/files.py:218
↓ 20 callersMethodwrite
(self, path: str, content: str)
tests/lib/tools/memory_sync/_fake_anthropic.py:61
↓ 19 callersFunction_assert_not_in_sdk_frame_locals
(exc: BaseException, *secrets: str)
tests/lib/test_credentials.py:4424
↓ 19 callersFunction_mock_messages_endpoint
(respx_mock: MockRouter)
tests/lib/test_credentials.py:2278
↓ 19 callersFunction_send_message
(client: Anthropic)
tests/lib/test_credentials.py:2319
↓ 19 callersMethodadd
Add Session Resource Args: file_id: ID of a previously uploaded file. mount_path: Mount path in the container.
src/anthropic/resources/beta/sessions/resources.py:337
↓ 19 callersMethodadd_tools
Give the model more tools without changing the `tools` param, which would miss the prompt cache. The definitions are sent in `tool_addition`
src/anthropic/lib/tools/_beta_runner.py:308
↓ 19 callersFunctionfake_anthropic
An `AsyncAnthropic`-shaped client with one memory store named `notes`. The store lands at `{workdir}/memory/notes`. Returns the client to han
tests/lib/tools/memory_sync/_fake_anthropic.py:187
↓ 19 callersMethodmodel_dump
Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump Generate a dictionary representation of the model, opti
src/anthropic/_models.py:300
↓ 19 callersFunctionrefusal
(browser: FakeBrowser, context: BetaToolsetCallContext, name: str, input: Any)
tests/lib/tools/toolsets/_fakes.py:324
↓ 19 callersFunctionrequest_bodies
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback_streaming.py:161
↓ 18 callersFunction_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:152
↓ 18 callersMethodcreate
Start an asynchronous job that uses past sessions to produce a reorganized version of a memory store and get back the dream to poll f
src/anthropic/resources/beta/dreams.py:51
↓ 18 callersFunctionget_args
(t: type[Any])
src/anthropic/_compat.py:30
↓ 18 callersMethodinvalidate
Clear the cached token so the next `get_token` re-invokes the provider. Also sets a one-shot `force_refresh` flag so on-disk providers skip
src/anthropic/lib/credentials/_cache.py:324
↓ 18 callersFunctioniter_work
Iterate work items claimed from a self-hosted environment. Each yielded `BetaSelfHostedWork` has already been ack'd. The `work` resource must
src/anthropic/lib/environments/_poller.py:83
↓ 18 callersFunctionmcp_content
Convert a single MCP content block to an Anthropic content block. Handles text, image, and embedded resource content types. Raises `Unsupport
src/anthropic/lib/tools/mcp.py:119
↓ 18 callersFunctionresults_sent
The tool results the runner sent back for the first reply.
tests/lib/tools/test_runner_eager_tools.py:879
↓ 18 callersFunctionsettled
The result of a call on either runner: awaited on the async one.
tests/lib/tools/test_runner_eager_tools.py:1183
↓ 17 callersFunction_end_turn
()
tests/lib/tools/toolsets/test_runner.py:55
↓ 17 callersFunction_send_message_async
(client: AsyncAnthropic)
tests/lib/test_credentials.py:3195
↓ 17 callersMethodappend_messages
Add one or more messages to the conversation history. This invalidates the cached tool response, i.e. if tools were already called, then they
src/anthropic/lib/tools/_beta_runner.py:223
↓ 17 callersFunctionfake_session
An `EnvironmentWorker` pointed at a fake client; one work item queued.
tests/lib/tools/memory_sync/test_e2e_memory.py:41
↓ 17 callersFunctionresolve_auth_mode
Determine whether to use SigV4 auth. Returns True for SigV4, False for API key. Auth precedence: 1. api_key constructor arg → API key mode
src/anthropic/lib/aws/_credentials.py:31
↓ 17 callersMethodresults
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:348
↓ 17 callersMethodretrieve
(self, memory_id: str, *, memory_store_id: str, **kwargs: Any)
tests/lib/tools/memory_sync/test_memory_sync.py:682
↓ 17 callersMethodsee
Adds a stream event to the timeline, as the caller saw it.
tests/lib/tools/test_runner_eager_tools.py:1084
↓ 17 callersMethodvalidate
Validate an external key config against the customer's KMS. Anthropic performs an encrypt/decrypt roundtrip against the configured K
src/anthropic/resources/organization/external_keys.py:277
↓ 16 callersFunction_compacted_response
()
tests/lib/tools/test_runners.py:2461
↓ 16 callersFunction_copy_client_with_bearer_auth
Return a copy of `client` authenticated with `auth_token` as Bearer. The returned sub-client inherits the parent's full configuration via `cl
src/anthropic/lib/_scoped_client.py:30
↓ 16 callersFunction_requests
(respx_mock: MockRouter)
tests/lib/tools/toolsets/test_browser_runner.py:58
↓ 16 callersFunction_tool_confirmation
The user's allow/deny verdict for an ask-gated (`always_ask`) tool call.
tests/lib/tools/test_session_runner.py:91
↓ 16 callersMethodinsert
Insert text at a specific line number in a memory file.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:150
↓ 16 callersFunctionis_dict
(obj: object)
src/anthropic/_utils/_utils.py:194
↓ 15 callersFunction_clear_aws_url_env
(monkeypatch: pytest.MonkeyPatch)
tests/lib/test_aws.py:126
↓ 15 callersFunction_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; t
src/anthropic/lib/tools/_skills.py:141
↓ 15 callersFunction_tool_reference_block
(kind: Literal["tool_removal", "tool_addition"], name: str)
tests/lib/tools/test_runners.py:1035
↓ 15 callersMethodaction
(self, name: str, context: BetaToolsetCallContext, input: Any)
tests/lib/tools/toolsets/_fakes.py:112
↓ 15 callersMethodget
( self, path: str, *, cast_to: Type[ResponseT], options: RequestOption
src/anthropic/_base_client.py:1452
↓ 15 callersFunctionmodel_copy
(model: _ModelT, *, deep: bool = False)
src/anthropic/_compat.py:117
↓ 15 callersMethodupdate
Update a member's organization role. Args: user_id: ID of the User. role: New role for the User.
src/anthropic/resources/organization/users.py:83
↓ 15 callersMethodview
View the contents of a memory path.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:135
↓ 14 callersFunction_downloaded
A `SessionMemoryStores` with one store already downloaded to disk.
tests/lib/tools/memory_sync/test_folder_trust.py:32
↓ 14 callersFunction_install_run_session_tools
( monkeypatch: pytest.MonkeyPatch, record: dict[str, Any], *, serve: Callable[[], Awaitable[No
tests/lib/environments/test_worker.py:189
↓ 14 callersFunction_recording_tool
A tool taking no input that appends `label` (its name by default) to `calls` when it runs.
tests/lib/tools/test_runners.py:1634
↓ 14 callersFunction_response
(*blocks: dict[str, Any])
tests/lib/tools/toolsets/test_runner.py:39
↓ 14 callersFunction_run_with_tool_changes
Drive a tool runner to the end, running `script[message.id]` while each message is being handled.
tests/lib/tools/test_runners.py:1666
↓ 14 callersFunction_sync_compact_runner
( client: Anthropic, *, betas: Union[List[AnthropicBetaParam], Omit] = omit, context_managemen
tests/lib/tools/test_runners.py:2521
↓ 14 callersFunction_tool_use
(name: str, id: str, input: dict[str, Any], *, toolset_name: str | None = None)
tests/lib/tools/toolsets/test_runner.py:32
↓ 14 callersMethodaction
(self, name: str, context: BetaToolsetCallContext, input: Any)
tests/lib/tools/toolsets/_computer_fakes.py:70
↓ 14 callersMethodasync_get_token
Async version of `get_token`. An async provider is awaited on the event loop. A sync provider runs `get_token` in a worker thread.
src/anthropic/lib/credentials/_cache.py:210
↓ 14 callersFunctionbeta_async_tool
(func: AsyncFunctionT)
src/anthropic/lib/tools/_beta_functions.py:480
↓ 14 callersFunctionbeta_edit_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:741
↓ 14 callersFunctionev
Serialize one event payload as an SSE frame (its `type` is the event name).
tests/lib/test_refusal_fallback_streaming.py:105
↓ 14 callersFunctionresolve_path
Resolve `p` against the workdir; reject results outside the permitted roots. The permitted roots are `workdir` plus each entry of `allowed_roots`
src/anthropic/lib/tools/agent_toolset.py:388
↓ 14 callersMethodstream
Create a Message stream
src/anthropic/resources/messages/messages.py:1060
↓ 14 callersFunctiontoolset_call
The model calls the tool `name` of a toolset with the id `toolu_<key>`. By default it is the computer toolset's `key` tool. Without a `toolset_nam
tests/lib/tools/test_runner_eager_tools.py:807
↓ 14 callersMethodwrite
(profile: str, *, with_base_url: Optional[str])
tests/lib/test_credentials.py:396
↓ 13 callersFunctionTypeAdapter
(*_args: Any, **_kwargs: Any)
src/anthropic/_models.py:943
↓ 13 callersFunction_as_dict
(value: object)
src/anthropic/lib/middleware/_fallbacks.py:1546
↓ 13 callersFunction_calls_tool
(name: str, tool_use_id: str)
tests/lib/tools/test_runners.py:1650
↓ 13 callersFunctionbeta_check_upload_path
Return the resolved path of `path` if it lies under one of `roots` (symlinks resolved on both sides, whole-component comparison), else raise `Uplo
src/anthropic/lib/tools/_toolsets/_security.py:57
↓ 13 callersFunctionerror_logs
Messages the middleware logged at ERROR — refusals surfaced rather than retried.
tests/lib/test_refusal_fallback_streaming.py:37
↓ 13 callersMethodflush_writes
Upload new and changed files; send no deletes and pull nothing. The push-only rescue pass for a session ending on an error or cancel —
src/anthropic/lib/tools/_memories.py:452
↓ 13 callersFunctionis_mapping
(obj: object)
src/anthropic/_utils/_utils.py:186
↓ 13 callersMethodmodel_dump_json
Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json Generates a JSON representation of the model using
src/anthropic/_models.py:371
↓ 13 callersFunctionopenapi_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:20
↓ 13 callersMethodread
()
src/anthropic/lib/tools/_file_store.py:155
↓ 13 callersMethodread
(self, size: int = -1)
tests/test_prepare.py:666
↓ 13 callersMethodrename
Rename or move a memory file or directory.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:160
↓ 13 callersFunctionresolve_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
↓ 13 callersMethodrun
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:504
↓ 13 callersMethodsend
Send Events Args: events: Events to send to the `session`. betas: Optional header to specify the beta version(s
src/anthropic/resources/beta/sessions/events.py:160
↓ 13 callersMethodset_messages_params
Update the parameters for the next API call. This invalidates any cached tool responses. With `run_tools_eagerly`, a tool call of the
src/anthropic/lib/tools/_beta_runner.py:195
↓ 13 callersFunctiontag_helper
Mark an object as created by a named SDK helper.
src/anthropic/lib/_stainless_helpers.py:87
↓ 12 callersMethod__class__
(self)
src/anthropic/_utils/_proxy.py:48
↓ 12 callersFunctiondeleted
(path: str, *, was: str)
tests/lib/tools/memory_sync/_fake_anthropic.py:81
↓ 12 callersFunctiondelta
(event_id: str, text: str, index: int | None = None)
tests/lib/sessions/test_accumulate.py:43
↓ 12 callersFunctioniter_next
(iter: Iterator[_T] | AsyncIterator[_T])
tests/test_streaming.py:254
↓ 12 callersMethodremove_tools
Take tools away from the model without changing the `tools` param, which would miss the prompt cache. The tools stop being run at once, and t
src/anthropic/lib/tools/_beta_runner.py:347
↓ 12 callersFunctionresolve_api_key
Resolve the API key. Returns None if using SigV4.
src/anthropic/lib/aws/_credentials.py:65
↓ 12 callersFunctionstarts
When each tool started, and when the caller's loop body ended. `also` keeps the lines that start with it too.
tests/lib/tools/test_runner_eager_toolsets.py:429
↓ 12 callersMethodstop
(self, work_id: str, **kwargs: Any)
tests/lib/environments/test_poller_method.py:64
↓ 11 callersMethod__init__
(self, reason: str)
src/anthropic/lib/tools/_toolsets/_errors.py:116
↓ 11 callersFunction_compaction_block_alone
()
tests/lib/tools/test_runners.py:2477
↓ 11 callersFunction_downloaded
A `SessionMemoryStores` with one store already downloaded to disk.
tests/lib/tools/memory_sync/test_memory_sync.py:31
↓ 11 callersFunction_not_found_result
(tool_use_id: str)
tests/lib/tools/test_runners.py:1288
↓ 11 callersFunction_tool_changes_message
(*blocks: Any)
tests/lib/tools/test_runners.py:1658
↓ 11 callersMethodaclose
(self)
src/anthropic/lib/credentials/_close.py:19
↓ 11 callersFunctionaiter_work
Async version of `iter_work`. See its docstring for semantics, including how `extra_headers` is passed through per request.
src/anthropic/lib/environments/_poller.py:228
↓ 11 callersFunctionbody
()
tests/test_streaming.py:18
↓ 11 callersMethodclose
(self)
src/anthropic/lib/tools/agent_toolset.py:562
↓ 11 callersMethodheartbeat
(self, work_id: str, **_kwargs: Any)
tests/lib/environments/test_worker.py:1163
↓ 11 callersFunctionmiddleware_request_body
(request: APIRequest)
tests/test_middleware.py:83
← previousnext →101–200 of 9,455, ranked by callers