.NET: Bring Hosted-Toolbox sample to parity with sibling hosting samples#6633
.NET: Bring Hosted-Toolbox sample to parity with sibling hosting samples#6633rogerbarreto wants to merge 2 commits into
Conversation
Adds the standard scaffolding files (.env.example, agent.yaml, agent.manifest.yaml, Dockerfile, Dockerfile.contributor) that every other 04-hosting Foundry sample ships but Hosted-Toolbox lacked. Fixes the toolbox name environment variable: reads TOOLBOX_NAME instead of the platform reserved FOUNDRY_TOOLBOX_NAME so it survives agent create, and aligns the default to my-toolset. Rewrites the README to the standard section layout with PowerShell fenced commands, and adds Using-Samples READMEs documenting why the client REPLs exist. Renames Azure AI Foundry to Foundry across the 04-hosting sample READMEs and comments for consistent product naming.
There was a problem hiding this comment.
Pull request overview
This PR updates the .NET FoundryHostedAgents/responses samples to make Hosted-Toolbox consistent with its sibling hosted-agent samples by adding the missing deployment scaffolding (env template, azd manifests, Dockerfiles) and refreshing documentation. It also standardizes product naming (“Azure AI Foundry” → “Foundry”) across multiple sample READMEs/comments and adds documentation for the “Using-Samples” client REPLs.
Changes:
- Adds missing
Hosted-Toolboxscaffolding:.env.example,agent.yaml,agent.manifest.yaml,Dockerfile, andDockerfile.contributor. - Updates
Hosted-Toolboxto read the toolbox name fromTOOLBOX_NAME(avoiding a reservedFOUNDRY_*prefix) and rewrites the README to match sibling layout. - Adds
Using-Samples/README.mdandUsing-Samples/SimpleAgent/README.mdexplaining the client REPL purpose/usage, and updates multiple sample READMEs/comments to say “Foundry”.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/SimpleAgent/README.md | Adds end-user documentation for the generic hosted-agent REPL client. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/README.md | Explains why client REPLs exist and documents shared configuration/endpoint shape. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Handoff/README.md | Updates terminology for consistency (“Foundry project endpoint”). |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/Program.cs | Updates terminology in required-env-var comments. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/README.md | Rewrites README into standard hosted-sample layout and documents TOOLBOX_NAME. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/Program.cs | Switches toolbox env var lookup to TOOLBOX_NAME and updates header commentary. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/Dockerfile.contributor | Adds contributor-oriented Dockerfile for pre-published output. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/Dockerfile | Adds standard multi-stage Dockerfile for package consumers. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/agent.yaml | Adds hosted agent spec for Foundry deployment. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/agent.manifest.yaml | Adds azd manifest including TOOLBOX_NAME parameterization and toolbox resource. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/.env.example | Adds local-dev env template aligned with the updated sample docs. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/Program.cs | Updates terminology in required-env-var comments. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/.env.example | Updates terminology in env template header comment. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-FoundryAgent/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/Program.cs | Updates terminology in required-env-var comments. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/README.md | Updates terminology from “Azure AI Foundry” to “Foundry”. |
| ```text | ||
| ══════════════════════════════════════════════════════════ | ||
| Simple Agent Sample | ||
| Connected to: http://localhost:8088/agents/hosted-toolbox-agent/endpoint/protocols/openai |
There was a problem hiding this comment.
Good catch. Banner now show real URL client print: https scheme plus /api/projects/local segment. Fixed.
| // Demonstrates how to register one or more Foundry toolboxes so the agent can | ||
| // call tools provided by the Foundry platform's managed MCP proxy. | ||
| // | ||
| // Required environment variables: |
There was a problem hiding this comment.
True. FOUNDRY_MODEL not really required: have gpt-4o default and AZURE_AI_MODEL_DEPLOYMENT_NAME fallback. Moved it from Required block to Optional. Fixed.
| // Required environment variables: | ||
| // FOUNDRY_PROJECT_ENDPOINT - Azure AI Foundry project endpoint | ||
| // FOUNDRY_PROJECT_ENDPOINT - Foundry project endpoint | ||
| // FOUNDRY_TOOLBOX_NAME - Name of the Foundry Toolbox to connect to | ||
| // FOUNDRY_MODEL - Model deployment name (default: gpt-5) |
There was a problem hiding this comment.
Yes same reserved-prefix trap. Switched ToolboxMcpSkills to TOOLBOX_NAME across Program.cs, .env.example, agent.yaml, agent.manifest.yaml, README. Now deployable via manifest like other toolbox samples. Fixed.
- SimpleAgent README: correct the demo banner to the real per-agent URL the client prints (https scheme and the /api/projects/<project> segment). - Hosted-Toolbox Program.cs: move FOUNDRY_MODEL out of the Required block into Optional since it has a gpt-4o default and an AZURE_AI_MODEL_DEPLOYMENT_NAME fallback. - Hosted-ToolboxMcpSkills: switch the toolbox name from the reserved FOUNDRY_TOOLBOX_NAME to TOOLBOX_NAME across Program.cs, .env.example, agent.yaml, agent.manifest.yaml and README so it is deployable via the manifest, matching the other toolbox samples.
Motivation & Context
The
Hosted-Toolboxsample under04-hosting/FoundryHostedAgents/responseswas thinner than every other sample in that folder. It shipped onlyHostedToolbox.csproj,Program.csand a minimalREADME.md, while every sibling (Hosted-McpTools, Hosted-AgentSkills, Hosted-MemoryAgent, Hosted-Toolbox-AuthPaths, and others) also ships.env.example,agent.yaml,agent.manifest.yaml,DockerfileandDockerfile.contributor. It was born thin in the PR that first introduced it and later PRs never closed the gap.It also read the toolbox name from
FOUNDRY_TOOLBOX_NAME. The Foundry container platform reserves everyFOUNDRY_*andAGENT_*environment variable and rejects them at agent create, so that name could never be supplied through the manifest at deploy time.Description & Review Guide
What are the major changes?
.env.example,agent.yaml,agent.manifest.yaml(toolbox aware, parameterTOOLBOX_NAMEdefaultmy-toolset),DockerfileandDockerfile.contributor.TOOLBOX_NAME(instead of the reservedFOUNDRY_TOOLBOX_NAME) so it survives agent create, and aligns the default tomy-toolset.Using-Samples/README.mdandUsing-Samples/SimpleAgent/README.mdexplaining why the client REPLs exist (a hosted agent is an HTTP server with no UI, so a small client drives it).Azure AI FoundrytoFoundryacross the 04-hosting sample READMEs and comments for consistent product naming.What is the impact of these changes?
Verified live against a Foundry project: the corrected server loaded the toolbox,
/readinessreturned Healthy, and the agent invoked a live toolbox tool end to end.Related Issue
N/A. Samples parity and documentation fix.
Contribution Checklist