Tools and state
anthropic_web_search
Executes server-owned WebSearch tool calls in an Anthropic Messages loop.
Switching projects opens that project’s default documentation release.
Versions marked “overview” do not contain this page. Selecting one opens that version’s documentation overview.
On this page
Executes server-owned WebSearch tool calls in an Anthropic Messages loop.
Configuration Notes
Each provider request is executed through the shared filtered-subrequest executor, which enforces destination authority, DNS/SSRF, TLS/SNI, and Host centrally. An optional outbound_chain runs operator-managed cross-cutting filters on the callout; when omitted it defaults to an empty inline chain (pure passthrough), so the central protections still apply.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
provider | brave | tavily | you | yes | Search backend provider. |
user_credential | string | no | Optional callout-credential slot id. When set, the web-search callout uses the caller’s per-user secret from that slot instead of the shared provider api_key. Non-secret (a slot name). Supported for every provider: each stages the secret as a destination-bound header credential the executor injects after pinning the provider authority (Brave and You.com under their provider header, Tavily as an Authorization: Bearer token). |
api_key | CredentialSource | yes | API key credential source for the search provider: exactly one of value, env_var, or file. A file source is watched for restart-free rotation; see [CredentialSource]. The token never appears in Debug output. |
default_context_size | string | no | Default search context size when the client omits it. |
timeout_ms | integer | no | Callout timeout in milliseconds. Inside an iterative request router, the effective timeout is capped by the router’s remaining deadline. |
max_body_bytes | integer | no | Maximum request and response body bytes buffered per loop round. |
max_query_bytes | integer | no | Maximum UTF-8 bytes accepted for one model-generated search query, after trimming (1..=8192; default: 8192). A blank or oversized query fails the call locally instead of reaching the provider. 8192 is a hard ceiling: admins may lower the bound but cannot raise it. |
base_url | string | no | Override the provider’s default API base URL. |
outbound_chain | string | object | no | Outbound filter chain the provider callout executes through. A named reference resolves against the top-level filter_chains map, so it binds only when the filter is placed at the top level of a pipeline (see the web-search.yaml example). An inline definition embeds the filters directly and always binds — including when the filter runs nested as a step of an iterative_request_router (the agentic loop), where the step pipeline’s chain map is empty and a named reference cannot resolve. Use an inline chain for any nested/IRR placement; a named reference is available only where top-level filter_chains are in scope. The chain carries cross-cutting concerns (observability, security, credential injection) and is bound once at pipeline-build time — a chain that cannot be built fails config validation. Destination authority, DNS/SSRF, TLS/SNI, and Host are enforced centrally by the executor, gated by insecure_options.allow_private_upstreams. Optional. The provider callout always runs through the shared executor; this chain only adds filters along the way. When omitted it defaults to an empty inline chain (pure passthrough) via [default_outbound_chain], so every central protection still applies. Provide it only to attach cross-cutting concerns. |
Examples
Example 1
filter: anthropic_web_search
provider: you
api_key:
env_var: WEB_SEARCH_API_KEY
Example 2
filter: anthropic_web_search
provider: you
api_key:
env_var: WEB_SEARCH_API_KEY
outbound_chain: web_search_outbound
default_context_size: medium
timeout_ms: 10000
max_body_bytes: 67108864
max_query_bytes: 8192
Example 3
# cargo run -p praxis-test-utils --example anthropic_messages_web_search_mock
# WEB_SEARCH_API_KEY="$WEB_SEARCH_API_KEY" VLLM_API_KEY="$VLLM_API_KEY" \
# cargo run -p praxis-ai-proxy -- \
# -c examples/configs/anthropic/full-flow-agentic.yaml
# curl http://127.0.0.1:8080/v1/messages \
# -H 'content-type: application/json' \
# -d '{"model":"openai/gpt-oss-20b","max_tokens":1024,"stream":false,"messages":[{"role":"user","content":"Use web search to look up potato, then summarize in one sentence."}],"tools":[{"name":"WebSearch","description":"Search the web","input_schema":{"type":"object","properties":{"query":{"type":"string"}},"required":["query"]}}]}'