Skip to content

Python: configure startup environment for foundry hosted samples - #9643

Draft
Shiva S (Shivakishore14) wants to merge 2 commits into
microsoft:mainfrom
Shivakishore14:sshiva/python-startup-env-framework
Draft

Shiva S (Shivakishore14) wants to merge 2 commits into
microsoft:mainfrom
Shivakishore14:sshiva/python-startup-env-framework

Conversation

@Shivakishore14

@Shivakishore14 Shiva S (Shivakishore14) commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Motivation & Context

Make Python startup configuration explicit in the Foundry hosted-agent examples before the interpreter starts, through deployment environment configuration and Python Dockerfiles.

Description & Review Guide

  • What are the major changes? Set PYTHONNOUSERSITE to the string "1" in all 18 agent.yaml files, all 18 hosted manifest templates, the Telegram direct-code service, and all 18 Python Dockerfiles under the related hosting examples. Update shared deployment-environment guidance and the maintained Python consumer hosting reference. Extend the existing Telegram deployment assertion.
  • What is the impact of these changes? These customer-configured examples disable Python user-site loading; Foundry and Agent Framework are not claimed to inject this setting automatically. This is not a restriction on all code execution or other language runtimes. Install dependencies into a virtual environment or image/system site-packages, not with pip install --user. Existing deployments need a newly deployed agent version. The Hyperlight example remains unsupported on the default Foundry runtime; its startup configuration does not change its hypervisor requirement. No .NET, runtime-library, dependency-manifest, or CLI minimum-version changes.
  • What do you want reviewers to focus on? Coverage of both YAML entry points, direct-image startup, Telegram source deployment, and environment-specific guidance. Keep individual Python/uv commands unchanged, with no command prefixes or shell exports. Local checks passed: all 37 deployment environment maps parse and contain the exact string value, all 18 Python Dockerfiles configure startup in the final Python stage, all 53 Python files in the related hosting directory parse, and removing the new setting leaves the deployment definitions unchanged. The existing Telegram infrastructure suite passed (10 tests), including the added startup assertion. git diff --check, new documentation links, dependency-installation path checks, and a local Python startup check passed. Verified the final PR adds no Python/uv command prefixes or startup-variable shell exports; deployment configuration remains unchanged by this revision. No cloud deployment was performed.

Related Issue

No public issue is linked and no prior maintainer approval is claimed. This is a draft sample-configuration proposal for maintainer review; agreement on the proposed sample startup default is still needed.

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: GitHub Copilot CLI prepared the sample configuration, documentation, small regression assertion, local validation, and this description. This draft remains subject to author and maintainer 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.

Configure user-site loading before Python starts in deployment files,
container images, and local sample instructions.

Authored-by: GitHub Copilot CLI v1.0.102
Model: GPT-6.1 Sol (gpt-6.1-sol)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 23, 2026 10:47
@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 23, 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.

🔵 Needs a closer look

The proposed sample-wide default still needs maintainer agreement, and managed-runtime behavior has not been validated through a hosted deployment.

No open issues 🎉

What changed in this PR

This PR makes Python startup configuration explicit in Agent Framework’s Foundry hosting samples, covering deployed agents, direct container launches, and local development without changing runtime-library behavior.

Changes:

  • Adds PYTHONNOUSERSITE=1 to 18 Dockerfiles, both sets of 18 deployment definitions, and Telegram’s direct-code service.
  • Documents shell-before-launch setup, dependency installation requirements, redeployment, and the setting’s limited scope.
  • Extends the Telegram infrastructure test to check the exact environment-variable value.

Paths below are relative to python/samples/04-hosting/, except the consumer reference under skills/.

File Description
skills/​agent-framework-builder-python/​references/​hosting-and-deployment.md Adds consumer-facing startup guidance.
foundry-hosted-agents/​responses/​workflows/​README.md Configures local workflow launches.
foundry-hosted-agents/​responses/​workflows/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​workflows/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​workflows/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​tools/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​tools/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​tools/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​steerable_long_running_agent/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​steerable_long_running_agent/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​steerable_long_running_agent/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​resilient_long_running_workflow/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​resilient_long_running_workflow/​agent.yaml Adds deployment startup environment.
foundry-hosted-agents/​responses/​resilient_long_running_workflow/​agent.manifest.yaml Adds hosted-template startup environment.
foundry-hosted-agents/​responses/​observability/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​observability/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​observability/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​monty_codeact/​README.md Configures local script launches.
foundry-hosted-agents/​responses/​monty_codeact/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​monty_codeact/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​monty_codeact/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​mcp/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​mcp/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​mcp/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​foundry_toolbox/​README.md Configures local azd launches.
foundry-hosted-agents/​responses/​foundry_toolbox/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​foundry_toolbox/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​foundry_toolbox/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​foundry_toolbox_mcp_skills/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​foundry_toolbox_mcp_skills/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​foundry_toolbox_mcp_skills/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​foundry_memory/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​foundry_memory/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​foundry_memory/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​files/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​files/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​files/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​declarative_customer_support/​Dockerfile Sets startup environment in the final Python stage.
foundry-hosted-agents/​responses/​declarative_customer_support/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​declarative_customer_support/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​custom_storage/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​custom_storage/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​custom_storage/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​basic/​README.md Links shell-before-launch guidance.
foundry-hosted-agents/​responses/​basic/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​basic/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​basic/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​responses/​azure_search_rag/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​responses/​azure_search_rag/​agent.yaml Sets deployment startup environment.
foundry-hosted-agents/​responses/​azure_search_rag/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​README.md Explains startup setup, scope, dependencies, and redeployment.
foundry-hosted-agents/​invocations/​telegram/​tests/​test_infrastructure.py Asserts the exact startup environment entry.
foundry-hosted-agents/​invocations/​telegram/​azure.yaml Configures direct-code service startup.
foundry-hosted-agents/​invocations/​break_glass/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​invocations/​break_glass/​agent.yaml Adds deployment startup environment.
foundry-hosted-agents/​invocations/​break_glass/​agent.manifest.yaml Sets hosted-template startup environment.
foundry-hosted-agents/​invocations/​basic/​README.md Configures local workflow launches.
foundry-hosted-agents/​invocations/​basic/​Dockerfile Sets image startup environment.
foundry-hosted-agents/​invocations/​basic/​agent.yaml Adds deployment startup environment.
foundry-hosted-agents/​invocations/​basic/​agent.manifest.yaml Sets hosted-template startup environment.
container/​hyperlight_codeact/​README.md Adds startup guidance while preserving the hypervisor caveat.
container/​hyperlight_codeact/​Dockerfile Sets image startup environment.
container/​hyperlight_codeact/​agent.yaml Sets deployment startup environment.
container/​hyperlight_codeact/​agent.manifest.yaml Sets hosted-template startup environment.

Review effort: Balanced

Remove startup-variable shell exports and local command prerequisites.
Preserve Dockerfile and deployment environment configuration.

Authored-by: GitHub Copilot CLI v1.0.102
Model: GPT-6.1 Sol (gpt-6.1-sol)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
github-app-auth — 65684334 Deployed Oct 23, 2026 by Shivakishore14 via add_label #26022
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