Skip to content

Python: Migrate Foundry Toolbox sample to unified azure.yaml - #9560

Closed
John Miller (therealjohn) wants to merge 2 commits into
microsoft:mainfrom
therealjohn:therealjohn-toolbox-azure-yaml-migration
Closed

John Miller (therealjohn) wants to merge 2 commits into
microsoft:mainfrom
therealjohn:therealjohn-toolbox-azure-yaml-migration

Conversation

@therealjohn

Copy link
Copy Markdown
Member

Motivation & Context

The Foundry Toolbox sample still initializes from a legacy manifest in another repository. Current Foundry CLI template adoption requires a unified azure.yaml, and local hosting alone does not create the authenticated connections or toolbox.

Keep this Agent Framework sample independently runnable and deployable by migrating its configuration and dependency graph, rather than deleting the legacy manifests without replacements.

Description & Review Guide

  • What are the major changes? Replace agent.manifest.yaml, agent.yaml, and the standalone toolbox.yaml with a unified project containing the Foundry project/model, three authenticated connections, six-tool toolbox, and hosted agent. Preserve the agent name, metadata, gpt-4.1 model, Responses 2.0 protocol, and CPU/memory limits. Declare dependency ordering and map the versioned toolbox output to TOOLBOX_ENDPOINT.
  • What is the impact of these changes? Initialize from this repository's azure.yaml, prepare PAT/Language/Foundry access before init, deploy dependencies before local use, and update all services with azd deploy --all. The README describes the actual flat project/source layout, the existing-model workaround in [Issue] Template adoption does not offer existing Foundry model deployments Azure/azure-dev#10519, and a Toolkit path that does not rely on legacy gallery manifests. Exclude local environment state from deployment contexts. main.py is unchanged, preserving request-owned resources, async cleanup, platform headers/identity, and history_source="agent_server".
  • What do you want reviewers to focus on? The dependency graph, connection authentication/environment bindings, versioned endpoint mapping, and initialization/deployment guidance. Eight new offline tests pass using python -m pytest python\samples\04-hosting\foundry-hosted-agents\responses\foundry_toolbox\tests -q --confcutdir=python\samples\04-hosting\foundry-hosted-agents\responses\foundry_toolbox. python -m ruff check python\samples\04-hosting\foundry-hosted-agents\responses\foundry_toolbox\tests and python -m ruff format --check python\samples\04-hosting\foundry-hosted-agents\responses\foundry_toolbox\tests pass. The current azd root and all six service schemas validate, local README links resolve, and 18 external Markdown links return HTTP 200. No Azure deployment or live authentication/tool invocation was performed. The existing python -m pytest python\tests\samples\hosting\test_toolbox_endpoint.py -q --confcutdir=python\tests\samples\hosting fails during collection because its unchanged loader references the nonexistent responses/04_foundry_toolbox/main.py.

Related Issue

No agreed Agent Framework issue was supplied or found in the targeted open-issue search. Maintainer agreement is not verified. Related external issue: Azure/azure-dev#10519, which this migration documents a workaround for but does not fix. No competing open PR was found in the targeted toolbox azure.yaml search.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. Human contributor review, verification, and acceptance of responsibility are pending; the standard attestation is not yet made.

AI assistance details: Copilot assisted with configuration migration, offline regression tests, README updates, validation, and this PR description. This draft is opened for the contributor to review. The contributor has not yet completed the personal review and attestation required by AI_CONTRIBUTIONS.md; it must be completed before marking this PR ready for review.

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 links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI balanced review requested due to automatic review settings October 20, 2026 14:38
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Oct 20, 2026

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.

🟡 Changes recommended

Template exclusions and initialization guidance prevent the documented setup paths from working correctly.

3 open issues
What changed in this PR

Migrates the Python Foundry Toolbox sample to a unified azure.yaml, keeping deployment configuration within Agent Framework.

Changes:

  • Declares the project, model, connections, toolbox, and hosted agent with dependency ordering.
  • Updates initialization, authentication, deployment, and local-run guidance.
  • Adds eight offline configuration tests and expands file exclusions.
File Description
toolbox.yaml Removes the standalone toolbox definition.
tests/​test_configuration.py Adds configuration and documentation checks.
README.md Documents the unified deployment workflow.
azure.yaml Defines services, dependencies, authentication, and endpoint bindings.
agent.yaml Removes the legacy hosted-agent definition.
agent.manifest.yaml Removes the legacy initialization manifest.
.env.example Updates local runtime settings.
.dockerignore Excludes local state and tests from container builds.
.azdignore Revises template file exclusions.

Review effort: Balanced

Comment on lines 1 to 2
azure.yaml
.env.example

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.

Fixed in 03ddda6: removed azure.yaml and .env.example from .azdignore so azd template adoption pulls them down.

Comment on lines +129 to +130
For a repository checkout, work from this sample directory and use the CLI's local-code setup
(`azd ai agent init --src .`) rather than adopting a second manifest over the existing `azure.yaml`.

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.

Fixed in 03ddda6: the repository checkout path now uses azd ai agent init . and accepts reuse of the existing configuration.

Comment on lines +132 to +133
After init, confirm the project managed identity has **Cognitive Services Language Owner** on the
Language resource before deploying. See the

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.

Fixed in 03ddda6: the README now documents azd provision, granting the Language role to the new project identity, then azd deploy --all for new projects; existing projects grant after init and before azd up.

This branch was successfully deployed

1 active deployment
github-app-auth — 03ddda61 Deployed Oct 21, 2026 by therealjohn via add_label #25864
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants