Skip to content

.NET: Bring Hosted-Toolbox sample to parity with sibling hosting samples#6633

Open
rogerbarreto wants to merge 2 commits into
microsoft:mainfrom
rogerbarreto:fix/hosted-toolbox-sample-parity
Open

.NET: Bring Hosted-Toolbox sample to parity with sibling hosting samples#6633
rogerbarreto wants to merge 2 commits into
microsoft:mainfrom
rogerbarreto:fix/hosted-toolbox-sample-parity

Conversation

@rogerbarreto

Copy link
Copy Markdown
Member

Motivation & Context

The Hosted-Toolbox sample under 04-hosting/FoundryHostedAgents/responses was thinner than every other sample in that folder. It shipped only HostedToolbox.csproj, Program.cs and a minimal README.md, while every sibling (Hosted-McpTools, Hosted-AgentSkills, Hosted-MemoryAgent, Hosted-Toolbox-AuthPaths, and others) also ships .env.example, agent.yaml, agent.manifest.yaml, Dockerfile and Dockerfile.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 every FOUNDRY_* and AGENT_* 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?

    • Adds the missing scaffolding so the sample matches its siblings: .env.example, agent.yaml, agent.manifest.yaml (toolbox aware, parameter TOOLBOX_NAME default my-toolset), Dockerfile and Dockerfile.contributor.
    • Fixes the toolbox name environment variable to TOOLBOX_NAME (instead of the reserved FOUNDRY_TOOLBOX_NAME) so it survives agent create, and aligns the default to my-toolset.
    • Rewrites the README to the standard section layout used by the other samples, with PowerShell fenced commands.
    • Adds Using-Samples/README.md and Using-Samples/SimpleAgent/README.md explaining why the client REPLs exist (a hosted agent is an HTTP server with no UI, so a small client drives it).
    • Renames Azure AI Foundry to Foundry across the 04-hosting sample READMEs and comments for consistent product naming.
  • What is the impact of these changes?

    • Docs and sample scaffolding only. No library or runtime code changes. The sample now deploys with a configurable toolbox name and reads consistently with its siblings.

Verified live against a Foundry project: the corrected server loaded the toolbox, /readiness returned Healthy, and the agent invoked a live toolbox tool end to end.

Related Issue

N/A. Samples parity and documentation fix.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change.

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.
Copilot AI review requested due to automatic review settings June 19, 2026 16:40
@moonbox3 moonbox3 added documentation Improvements or additions to documentation .NET Issues related to the .NET codebase labels Jun 19, 2026
@github-actions github-actions Bot changed the title Bring Hosted-Toolbox sample to parity with sibling hosting samples .NET: Bring Hosted-Toolbox sample to parity with sibling hosting samples Jun 19, 2026

@github-actions github-actions Bot 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.

Automated Code Review

Reviewers: 5 | Confidence: 83% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach


Automated review by rogerbarreto's agents

@rogerbarreto rogerbarreto self-assigned this Jun 19, 2026
@rogerbarreto rogerbarreto enabled auto-merge June 19, 2026 16:45

Copilot AI 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

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-Toolbox scaffolding: .env.example, agent.yaml, agent.manifest.yaml, Dockerfile, and Dockerfile.contributor.
  • Updates Hosted-Toolbox to read the toolbox name from TOOLBOX_NAME (avoiding a reserved FOUNDRY_* prefix) and rewrites the README to match sibling layout.
  • Adds Using-Samples/README.md and Using-Samples/SimpleAgent/README.md explaining 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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Comment on lines 9 to 12
// 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)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.
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 Issues related to the .NET codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants