Files
wehub-resource-sync db620d33df
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
CodeQL / Analyze (csharp) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:39:25 +08:00

2.2 KiB

SessionFilesClient

A thin chat REPL that connects to a deployed Hosted-Files agent via FoundryAgent and lets you ask questions whose answers come from the files bundled with that agent. Same shape as SimpleAgent — point it at an AGENT_ENDPOINT, build a FoundryAgent, run.

The agent's container-side ListFiles and ReadFile tools surface the bundled file contents to the model. The client knows nothing about files; that is entirely the agent's concern.

Prerequisites

  • .NET 10 SDK
  • A running Hosted-Files agent (locally via dotnet run or deployed to Foundry)
  • Azure CLI logged in (az login)

Configuration

FOUNDRY_PROJECT_ENDPOINT=https://<host>/api/projects/<project>
AZURE_AI_AGENT_NAME=hosted-files

Both are required. FOUNDRY_PROJECT_ENDPOINT is the Foundry project endpoint URL and AZURE_AI_AGENT_NAME is the registered server-side agent name. The sample builds the per-agent OpenAI endpoint URL from these.

Run

cd dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/SessionFilesClient
$env:FOUNDRY_PROJECT_ENDPOINT = "http://localhost:8088/api/projects/local"
$env:AZURE_AI_AGENT_NAME = "hosted-files"
dotnet run

End-to-end demo

With the Hosted-Files agent running:

══════════════════════════════════════════════════════════
Session Files Client
Connected to: http://localhost:8088/
Try: "Give me the total revenue in the contoso file."
Type a message or 'quit' to exit
══════════════════════════════════════════════════════════

You> Give me the total revenue in the contoso file.
Agent> The contoso file reports total revenue of "$1,482.6M".

You> quit
Goodbye!

The agent looked at its bundled files via ListFiles, picked contoso_q1_2026_report.txt, called ReadFile, and quoted the figure verbatim. The client only sent a chat prompt.