Skip to content

.NET: Add File Search Sample for Foundry Agents.#3990

Open
rogerbarreto wants to merge 5 commits intomicrosoft:mainfrom
rogerbarreto:feature/3674-file-search
Open

.NET: Add File Search Sample for Foundry Agents.#3990
rogerbarreto wants to merge 5 commits intomicrosoft:mainfrom
rogerbarreto:feature/3674-file-search

Conversation

@rogerbarreto
Copy link
Member

@rogerbarreto rogerbarreto commented Feb 17, 2026

Motivation and Context

Adds a new FoundryAgents_Step18_FileSearch sample demonstrating how to use the File Search tool with AI Agents.

Description

  • Upload files and create vector stores in Azure Foundry
  • Create agents with file search capabilities using two approaches:
    • Option 1: HostedFileSearchTool (MEAI + AgentFramework abstraction)
    • Option 2: ResponseTool.CreateFileSearchTool (Native SDK)
  • Handle file citation annotations from agent responses
  • Manage full resource lifecycle (create and cleanup)

Changes

  • New sample: FoundryAgents_Step18_FileSearch with Program.cs and README.md
  • Added project to agent-framework-dotnet.slnx
  • Added entry to FoundryAgents samples table in parent README.md

rogerbarreto and others added 4 commits February 5, 2026 14:30
- Add FoundryAgents_Step18_FileSearch to agent-framework-dotnet.slnx
- Add FileSearch entry to FoundryAgents samples table in README.md
- Fix README inaccuracy: sample creates one agent, not two

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Refactor agent creation into switchable local functions
- Use DefaultAzureCredential with WARNING comment (matching other samples)
- Update README to reference DefaultAzureCredential

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 17, 2026 13:45
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation .NET labels Feb 17, 2026
@github-actions github-actions bot changed the title .Net: Add File Search Sample for Foundry Agents. .NET: Add File Search Sample for Foundry Agents. Feb 17, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new .NET “File search” getting-started sample under Foundry Agents, documenting and wiring it into the sample index/solution so developers can see how to use vector stores + file search tools with the Agent Framework and the native SDK.

Changes:

  • Adds FoundryAgents_Step18_FileSearch sample project (code + README) demonstrating file upload, vector store creation, and file-search-enabled agent execution.
  • Updates the Foundry Agents samples README to include the new sample link.
  • Adds the new sample project to the dotnet/agent-framework-dotnet.slnx solution.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
dotnet/samples/GettingStarted/FoundryAgents/README.md Adds the new “File search” sample to the samples table.
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step18_FileSearch/README.md Documents prerequisites, environment variables, and expected behavior for the new sample.
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step18_FileSearch/Program.cs Implements the end-to-end file upload → vector store → agent run → citation display → cleanup flow.
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step18_FileSearch/FoundryAgents_Step18_FileSearch.csproj Introduces the new sample project and references required packages/projects.
dotnet/agent-framework-dotnet.slnx Adds the new sample project to the solution.

Use Path.Combine + Path.GetRandomFileName instead of Path.GetTempFileName
to avoid leaving an orphaned temp file on disk.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|[Code interpreter](./FoundryAgents_Step14_CodeInterpreter/)|This sample demonstrates how to use the code interpreter tool with a Foundry agent|
|[Computer use](./FoundryAgents_Step15_ComputerUse/)|This sample demonstrates how to use computer use capabilities with a Foundry agent|
|[File search](./FoundryAgents_Step18_FileSearch/)|This sample demonstrates how to use the file search tool with a Foundry agent|
|[Local MCP](./FoundryAgents_Step27_LocalMCP/)|This sample demonstrates how to use a local MCP client with a Foundry agent|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, so feel free to ignore or include in a follow up PR, but it doesn't look like step27 is in the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments