Skip to content

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

Merged
Roger Barreto (rogerbarreto) merged 6 commits into
microsoft:mainfrom
rogerbarreto:feature/3674-file-search
Feb 19, 2026
Merged

.NET: Add File Search Sample for Foundry Agents.#3990
Roger Barreto (rogerbarreto) merged 6 commits into
microsoft:mainfrom
rogerbarreto:feature/3674-file-search

Conversation

@rogerbarreto

@rogerbarretoRoger Barreto (rogerbarreto) commented Feb 17, 2026

Copy link
Copy Markdown
Member

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

- 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>
CopilotAI review requested due to automatic review settings February 17, 2026 13:45
@markwallace-microsoftMark Wallace (markwallace-microsoft) added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net labels Feb 17, 2026
@github-actionsgithub-actionsBot changed the title .Net: Add File Search Sample for Foundry Agents..NET: Add File Search Sample for Foundry Agents.Feb 17, 2026

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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
FileDescription
dotnet/samples/GettingStarted/FoundryAgents/README.mdAdds the new “File search” sample to the samples table.
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step18_FileSearch/README.mdDocuments prerequisites, environment variables, and expected behavior for the new sample.
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step18_FileSearch/Program.csImplements the end-to-end file upload → vector store → agent run → citation display → cleanup flow.
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step18_FileSearch/FoundryAgents_Step18_FileSearch.csprojIntroduces the new sample project and references required packages/projects.
dotnet/agent-framework-dotnet.slnxAdds 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>
Comment threaddotnet/samples/GettingStarted/FoundryAgents/README.md
Merged via the queue into microsoft:main with commit 5aa05ebFeb 19, 2026
15 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationUsage: [Issues, PRs], Target: documentation in the code base and learn docs.NETUsage: [Issues, PRs], Target: .Net

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants

@rogerbarreto@SergeyMenshykh@westey-m@markwallace-microsoft