Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Deploy, evaluate, and manage AI agents end-to-end on Microsoft Azure AI Foundry
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
foundry-agent/create/references/tool-file-search.md
1# File Search Tool23Enables agents to search through uploaded files using semantic and keyword search from vector stores. Supports a wide range of file formats including PDF, Markdown, Word, and more.45> ⚠️ **Important:** Before creating an agent with file search, you **must** read the official documentation linked in the References section to understand prerequisites, supported file types, and vector store setup.67## Prerequisites89- A [basic or standard agent environment](https://learn.microsoft.com/azure/ai-foundry/agents/environment-setup)10- A **vector store** must be created before the agent — the `file_search` tool requires `vector_store_ids`11- Files must be uploaded to the vector store before the agent can search them1213## Key Concepts1415| Concept | Description |16|---------|-------------|17| **Vector Store** | A container that indexes uploaded files for semantic search. Must be created first. |18| **vector_store_ids** | Required parameter on the `file_search` tool — references the vector store(s) to search. |19| **File upload** | Files are uploaded to the project, then attached to a vector store for indexing. |2021## Setup Workflow2223```241. Create a vector store (REST API: POST /vector_stores)25│26▼272. (Optional) Upload files and attach to vector store28│29▼303. Create agent with file_search tool referencing the vector_store_ids31│32▼334. Agent can now search files in the vector store34```3536> ⚠️ **Warning:** Creating an agent with `file_search` without providing `vector_store_ids` will fail with a `400 BadRequest` error: `required: Required properties ["vector_store_ids"] are not present`.3738## REST API Notes3940When creating vector stores via `az rest`:4142| Parameter | Value |43|-----------|-------|44| **Endpoint** | `https://<resource>.services.ai.azure.com/api/projects/<project>/vector_stores` |45| **API version** | `v1` |46| **Auth resource** | `https://ai.azure.com` |4748## Troubleshooting4950| Error | Cause | Fix |51|-------|-------|-----|52| `vector_store_ids` not present | Agent created without vector store | Create a vector store first, then pass its ID |53| 401 Unauthorized | Wrong auth resource for REST API | Use `--resource "https://ai.azure.com"` with `az rest` |54| Bad API version | Using ARM-style API version | Use `api-version=v1` for the data-plane vector store API |55| No search results | Vector store is empty | Upload files to the vector store before querying |5657## References5859- [File Search tool documentation](https://learn.microsoft.com/azure/ai-foundry/agents/how-to/tools/file-search?view=foundry&pivots=python)60- [Tool Catalog](https://learn.microsoft.com/azure/ai-foundry/agents/concepts/tool-catalog?view=foundry)61