Overview
Tinfoil provides a private web search capability that allows AI models to augment their responses with real-time web search results. The search agent runs inside a secure enclave and connects directly to Exa, a search provider with Zero Data Retention (ZDR). This architecture provides:- Query privacy from Tinfoil: The enclave generates queries and sends them directly to Exa over TLS. Tinfoil only sees encrypted traffic and never learns query contents.
- User anonymity from search provider: All users share a single API key, and Exa only sees the enclave’s IP address, not individual user IPs.
- Legal protections: Exa’s ZDR agreement ensures queries are never written to persistent storage or sent to external subprocessors.
- Optional PII protection: A safeguard model blocks queries containing sensitive information before they’re sent to Exa. The model still responds, just without search results.
- Decides when a search is needed
- Generates search queries from conversation context
- Optionally blocks queries containing PII before sending to Exa
- Returns citations with URLs, titles, and content snippets
Read our blog post on private AI web search to learn more!
Quick Start
Enable web search by addingweb_search_options to your chat completion request. Optionally add pii_check_options to block queries containing sensitive information:
Available Options
| Option | Required | Description |
|---|---|---|
web_search_options | Yes | Enables web search capability |
pii_check_options | No | Blocks queries containing PII from being sent to Exa. The model still responds, just without search results. |
PII filtering is optional. The
pii_check_options field prevents queries containing sensitive information like SSNs, credit card numbers, and other PII from being sent to Exa. When a query is blocked, the model still responds to the user, but without search results.
This serves as an extra layer of protection. Exa access is already covered by a ZDR agreement, and Tinfoil cannot view the user’s query from the secure enclave.Example: Web Search Only
Example: Web Search with PII Protection
Response Format
Web Search Events
During streaming, the API emitsweb_search_call SSE events before the chat completion chunks begin. These events track search progress and are separate from the chat completion chunk structure:
in_progress- Search execution has startedcompleted- Search completed successfully and results are availablefailed- Search encountered an error (includesreasonfield with error details)blocked- Search was blocked by PII check (includesreasonfield explaining why)
Blocked Search Example
When PII is detected in a query:Annotations (Citations)
Citations are provided in the streaming delta’sannotations field:
Search Reasoning
The search agent’s reasoning about search decisions is provided in thesearch_reasoning field:
Blocked Searches
In non-streaming responses, blocked searches are listed in theblocked_searches field:
web_search_call events with status: "blocked" instead.
Streaming Event Sequence
When using streaming mode, events are emitted in this order:- Web search call events - One or more
web_search_callSSE events with statusblocked,in_progress,completed, orfailed - Metadata chunk - A single chat completion chunk containing
annotationsandsearch_reasoning(if any searches completed) - Content chunks - Multiple chat completion chunks containing response text in the
delta.contentfield - Final chunk - A chunk with
finish_reason: "stop"and empty delta - Done signal - The
data: [DONE]SSE message
Processing Citations
Citations in the response content use numbered markers (e.g., 【1】, 【2】) that correspond to the annotations:Non-Streaming Usage
For non-streaming requests, all metadata is included in the final message:PII Protection
Thepii_check_options field prevents search queries containing sensitive personally identifiable information from being sent to Exa. When PII is detected, the query is blocked and the model responds without search results.
Blocked PII types:
- Government IDs: social security numbers, tax IDs, passport numbers, driver’s licenses, voter IDs, national IDs
- Financial: bank account numbers, credit card numbers, IBANs
- Contact: personal email addresses, personal phone numbers, home addresses
- Linkable identifiers: VINs, license plates, device serial numbers
- Identifying combinations: name + date of birth, name + address, or other combinations that identify a specific person
- Names alone
- Dates of birth alone
- Business/corporate contact information
- Public figures’ public information

