/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import Anthropic from "@anthropic-ai/sdk"; import type { IExecuteContext } from "@workglow/task-graph"; import type { IWebSearchProvider, WebSearchCapabilities, WebSearchRequest, WebSearchResponse } from "@workglow/web-search"; export interface AnthropicWebSearchOptions { readonly client?: Anthropic | undefined; /** * Key handed to the SDK. Left unset it reads `ANTHROPIC_API_KEY`, which is * the only other place this adapter looks — a credential-store key named for * it in the task's `credential_keys` is refused rather than sent. */ readonly apiKey?: string | undefined; readonly model?: string | undefined; readonly maxTokens?: number | undefined; /** * How many searches the model may run for one request — Anthropic's * `max_uses`. A budget on the work done, not on the results returned, and * exceeding it comes back as a tool error that fails the search. Left unset, * the API applies its own default. */ readonly maxUses?: number | undefined; } export declare class AnthropicWebSearchProvider implements IWebSearchProvider { readonly name = "anthropic"; /** No endpoint: this adapter reaches Anthropic through the vendor SDK. */ readonly endpoint: undefined; /** The SDK carries the key; `credentialKey` never reaches this request. */ readonly acceptsCredentialKey = false; readonly capabilities: WebSearchCapabilities; private readonly client; private readonly model; private readonly maxTokens; private readonly maxUses; constructor(options?: AnthropicWebSearchOptions); search(request: WebSearchRequest, context: IExecuteContext): Promise; /** * A successful `web_search_tool_result` carries a LIST of results; a failed one * carries an error OBJECT, and the request still returns HTTP 200 with nothing * thrown. Branching on that is what keeps a quota failure from being recorded * as a search that legitimately found nothing. */ private collect; }