Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

ProviderExecutedToolMetadata.md

47 lines1.5 KB

1---
2id: ProviderExecutedToolMetadata
3title: ProviderExecutedToolMetadata
4---
5​
6Defined in: [packages/ai/src/types.ts:227](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L227)
7​
8Convention for tool-call `metadata` that marks a call as **provider-executed**
9— run by the provider's own infrastructure (e.g. Anthropic `web_search` /
10`web_fetch` server tools) rather than by the agent loop. Adapters set
11`providerExecuted: true` so that:
12​
131. The agent loop never tries to execute the call client-side (see
14 [isProviderExecutedToolCall](../functions/isProviderExecutedToolCall.md) usage in the chat engine), and
152. The adapter can stash the raw provider result alongside it so the call —
16 and its evidence — round-trips into the next turn's request.
17​
18Provider-specific payloads live under a namespaced key (e.g. `anthropic`),
19keeping this convention opaque to the framework core. The index signature
20preserves those per-adapter fields. `sources` is the normalized list of
21links a web search used, shared across providers.
22​
23## Indexable
24​
25```ts
26[key: string]: unknown
27```
28​
29## Properties
30​
31### providerExecuted?
32​
33```ts
34optional providerExecuted?: boolean;
35```
36​
37Defined in: [packages/ai/src/types.ts:228](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L228)
38​
39***
40​
41### sources?
42​
43```ts
44optional sources?: ProviderExecutedToolSource[];
45```
46​
47Defined in: [packages/ai/src/types.ts:229](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L229)