Python: use writable runtime directory for Foundry Skills sample#6606
Open
malsabbagh05 wants to merge 3 commits into
Open
Python: use writable runtime directory for Foundry Skills sample#6606malsabbagh05 wants to merge 3 commits into
malsabbagh05 wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Foundry Skills hosted-agent Python sample to download skills into a writable runtime directory by default, avoiding failures when the application directory is mounted read-only in hosted Foundry Agent Service environments.
Changes:
- Default the downloaded-skills directory to
<system temp>/maf_downloaded_skills, while still allowing override viaDOWNLOADED_SKILLS_DIR. - Update the sample README to explain the writable runtime directory behavior and override.
- Update
.env.exampleto document the optionalDOWNLOADED_SKILLS_DIRsetting.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| python/samples/04-hosting/foundry-hosted-agents/responses/09_foundry_skills/main.py | Switches the default downloaded-skills path from the app directory to the system temp directory, with an env var override. |
| python/samples/04-hosting/foundry-hosted-agents/responses/09_foundry_skills/README.md | Documents the new default runtime directory behavior and how to override it. |
| python/samples/04-hosting/foundry-hosted-agents/responses/09_foundry_skills/.env.example | Adds documentation for the optional DOWNLOADED_SKILLS_DIR env var. |
Comment on lines
+38
to
+41
| # Defaults to a system temp location because hosted containers may mount the | ||
| # application directory read-only. Set DOWNLOADED_SKILLS_DIR to override it. | ||
| _DEFAULT_DOWNLOADED_SKILLS_DIR: Final = Path(tempfile.gettempdir()) / "maf_downloaded_skills" | ||
| DOWNLOADED_SKILLS_DIR: Final = Path(os.environ.get("DOWNLOADED_SKILLS_DIR", str(_DEFAULT_DOWNLOADED_SKILLS_DIR))) |
| ``` | ||
|
|
||
| The downloaded `SKILL.md` files land under `downloaded_skills/<name>/SKILL.md` next to `main.py`. This directory is recreated from scratch on every run, so deleting it manually is never necessary. | ||
| The downloaded `SKILL.md` files land under `<downloaded-skills-dir>/<name>/SKILL.md`. The directory is recreated from scratch on every run, so deleting it manually is never necessary. |
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
The Foundry Skills hosted agent sample currently downloads skills under the sample directory. In hosted Foundry Agent Service, the application directory can be mounted read-only, so startup can fail when the sample tries to recreate
downloaded_skillsunder/app.This fixes #6571 by defaulting downloaded skills to a writable system temp directory while preserving an environment variable override for deployments that want a specific location.
Description & Review Guide
What are the major changes?
DOWNLOADED_SKILLS_DIRto<system-temp>/maf_downloaded_skillsinstead of a folder next tomain.py.DOWNLOADED_SKILLS_DIRenvironment variable..env.exampleto document the runtime directory behavior.What is the impact of these changes?
DOWNLOADED_SKILLS_DIR.What do you want reviewers to focus on?
Related Issue
Fixes #6571
Contribution Checklist
breaking changelabel or add "[BREAKING]" to the title prefix, before or after any language prefix. A workflow keeps the label and title prefix in sync automatically.