Skip to content

Python: Update Python Foundry hosted agent samples to use new "-t" (template) deployment instead of deprecated -m - #9402

Draft
Darren Cohen (dargilco) wants to merge 1 commit into
microsoft:mainfrom
dargilco:dargilco/foundry-hosted-agents-use-new-azd-ai-template
Draft

Darren Cohen (dargilco) wants to merge 1 commit into
microsoft:mainfrom
dargilco:dargilco/foundry-hosted-agents-use-new-azd-ai-template

Conversation

@dargilco

Copy link
Copy Markdown
Member

Motivation & Context

Description & Review Guide

  • What are the major changes?
  • What is the impact of these changes?
  • What do you want reviewers to focus on?

Related Issue

Fixes #

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details:

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 14, 2026 23:11
@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 14, 2026
@github-actions github-actions Bot changed the title Update Python Foundry hosted agent samples to use new "-t" (template) deployment instead of deprecated -m Python: Update Python Foundry hosted agent samples to use new "-t" (template) deployment instead of deprecated -m Oct 14, 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

The replacement template omits model provisioning required by the documented fresh-project setup.

1 open finding
What changed in this PR

Migrates the basic Python Foundry hosted-agent sample from deprecated manifest-based initialization to template-based deployment.

Changes:

  • Adds azure.yaml and removes the basic sample’s legacy manifests.
  • Updates initialization commands to use -t and revises deployment guidance.
File Description
python/​samples/​04-hosting/​foundry-hosted-agents/​responses/​basic/​README.md Documents template-based initialization.
python/​samples/​04-hosting/​foundry-hosted-agents/​responses/​basic/​azure.yaml Defines the Foundry project and hosted agent.
python/​samples/​04-hosting/​foundry-hosted-agents/​responses/​basic/​agent.yaml Removes the legacy agent configuration.
python/​samples/​04-hosting/​foundry-hosted-agents/​responses/​basic/​agent.manifest.yaml Removes the legacy deployment manifest.
python/​samples/​04-hosting/​foundry-hosted-agents/​README.md Updates shared deployment and protocol guidance.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +5 to +6
ai-project:
host: azure.ai.project
@eavanvalkenburg

Copy link
Copy Markdown
Member

Darren Cohen (@dargilco) Please set PYTHONNOUSERSITE: "1" in the hosted agent service's deployment-controlled environment before Python starts. The new azure.yaml does not supply it, and the sample image starts ordinary python main.py. Foundry persists session uploads beneath $HOME; when upload callers are not trusted to execute application code, Python's automatic user-site loading can otherwise trust startup files from that upload-writable location. The Foundry Python startup contract explicitly requires this setting for Python container images and says the platform does not inject it. Setting it inside main.py is too late. This unsafe default also exists in the legacy setup; it is not a migration-only regression.

ai-project:
host: azure.ai.project
agent-framework-agent-basic-responses:
project: .

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Darren Cohen (@dargilco) The Docker build can include local azd environment files — azd stores each environment under .azure/<environment>/.env beside this azure.yaml. With project: ., the root becomes the Docker build context, and the sample Dockerfile uses COPY ., while .dockerignore does not exclude .azure/. Local configuration or secrets can therefore be copied into the image and pushed to the registry. Please exclude .azure/ or use a separate application build context.

This branch was previously deployed

1 inactive deployment
github-app-auth — 7b28655e Deployed Oct 14, 2026 by dargilco via team_check #6836
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.

3 participants