[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M699C0QKV5XEBE61PB8NV544":3,"skill-same:01M699C0QKV5XEBE61PB8NV544":85},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":51,"linkOnly":52,"markdownContent":53,"markdownBody":54,"frontMatter":55,"refName":61,"commitSha":62,"skillDirectory":63,"forksCount":64,"repositoryHtmlUrl":65,"repositoryHomepageUrl":66,"ownerHtmlUrl":67,"ownerBlogUrl":68,"ownerDescription":69,"updatedAt":70,"install":71,"resources":84},"01M699C0QKV5XEBE61PB8NV544","foundry-hosted-agent-validation","Foundry 托管智能体示例验证","Step-by-step process for validating a Python Foundry hosted agent sample (under python\u002Fsamples\u002F04-hosting\u002Ffoundry-hosted-agents\u002F) end to end — running it locally (native runtime and `azd ai agent run`) and after deploying it to an Azure AI Foundry project with `azd`. Use this when asked to validate a hosted agent sample.","端到端验证 Python Foundry 托管智能体示例的分步流程（位于 python\u002Fsamples\u002F04-hosting\u002Ffoundry-hosted-agents\u002F）——包括本地运行（原生运行时和 `azd ai agent run`）以及使用 `azd` 部署到 Azure AI Foundry 项目后的验证。当被要求验证托管智能体示例时使用。","microsoft\u002Fagent-framework","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M6999R99RF2DY8AXYFS5HZRM",14676,"MIT",null,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagent-framework\u002Fblob\u002Fmain\u002Fpython\u002Fscripts\u002Fsample_validation\u002Fskills\u002Ffoundry-hosted-agent-validation\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BSAA4FBTWZP6X98STEHG99","智能体开发","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"foundry","foundry hosted agent validation","validation","model","running","when","for","native","end","runtime","sample","project","use","python","tool","framework","azure ai foundry","run","azure","ai agent","2026-11-10 10:12:30",false,"---\nname: foundry-hosted-agent-validation\ndescription: >\n  Step-by-step process for validating a Python Foundry hosted agent sample\n  (under python\u002Fsamples\u002F04-hosting\u002Ffoundry-hosted-agents\u002F) end to end — running\n  it locally (native runtime and `azd ai agent run`) and after deploying it to\n  an Azure AI Foundry project with `azd`. Use this when asked to validate a hosted\n  agent sample.\nlicense: MIT\ncompatibility: Works with any model that supports tool use.\nmetadata:\n  author: agent-framework-samples\n  version: \"1.0\"\n---\n\n# Validating a Foundry Hosted Agent Sample\n\nA hosted agent sample is \"validated\" when it passes **three** independent\nchecks, plus cleanup:\n\n1. **Local, native runtime** — run the sample's own entry point\n   (`python main.py`) and invoke it over HTTP.\n2. **Local, via `azd ai agent run`** — the `azd` local dev loop.\n3. **Deployed** — `azd deploy` to Foundry, then invoke the hosted agent.\n\nEach check must succeed for **single-turn** and **multi-turn** (session \u002F\n`previous_response_id`) conversation. Always end with **cleanup** (delete the\ndeployed agent, remove the temp `azd` project, restore the sample dir).\n\n> Read the sample's own `README.md` and the parent\n> `...\u002Ffoundry-hosted-agents\u002FREADME.md` first — they define the run\u002Fdeploy\n> commands and any sample-specific payload. This skill captures the process and\n> the non-obvious gotchas the READMEs don't.\n\n---\n\n## Inputs you need before starting\n\nGather these:\n\n- **Foundry project endpoint**, e.g.\n  `https:\u002F\u002F\u003Caccount>.services.ai.azure.com\u002Fapi\u002Fprojects\u002F\u003Cproject>`.\n- **Foundry project resource id** (for non-interactive `azd ai agent init`):\n  `\u002Fsubscriptions\u002F\u003Csub>\u002FresourceGroups\u002F\u003Crg>\u002Fproviders\u002FMicrosoft.CognitiveServices\u002Faccounts\u002F\u003Caccount>\u002Fprojects\u002F\u003Cproject>`.\n  Find it with `az cognitiveservices account list` + the project name.\n- **A real, deployed model name** in that project (e.g. `gpt-4.1-mini`). This is\n  often **different** from the model id in `agent.manifest.yaml` — the actual\n  deployment name wins.\n- **An existing ACR to reuse** for deployment (login server, e.g.\n  `myacr.azurecr.io`). Reusing one avoids `azd provision` creating resources.\n- Whether a like-named agent **already exists** in the project (remove it first\n  for a clean validation — see below).\n\n## Tooling \u002F auth\n\n- `az` (logged in: `az login`) and `azd` (logged in: `azd auth login`).\n- `azd` **agents extension**: `azd extension list` should show\n  `azure.ai.agents`; install with `azd extension install azure.ai.agents`.\n- `uv` for the native-Python local run. **`python` need not be on PATH** — `uv`\n  and `azd ai agent run` provision their own interpreter.\n- Docker is **not** required when you reuse an ACR (`remoteBuild: true` builds\n  in ACR Tasks).\n\n---\n\n## Phase 0 — Understand the sample\n\nA responses\u002Finvocations sample folder typically contains:\n`main.py` (entry point + `ResponsesHostServer`\u002F`InvocationsHostServer`),\n`agent.manifest.yaml` (used by `azd ai agent init`), `agent.yaml` (the deployed\nagent definition), `requirements.txt`, `Dockerfile`, `.env.example`.\n\n**The sample is the whole directory whose entry point is `main.py` — not every\n`.py` file in it.** Other Python files in (or alongside) a sample folder are\n**helper\u002Fcompanion scripts**, not standalone samples. Do **not** treat a helper\nscript as an individual sample — validate the sample via its `main.py` host, and\nrun a helper only when the sample's `README.md` calls for it as a setup.\n\nNote the **protocol** (`responses` or `invocations`) from `agent.yaml` \u002F\nmanifest — it changes the invoke command (`--protocol invocations`) and the HTTP\npath (`\u002Fresponses` vs the invocations route).\n\n---\n\n## Phase 1 — Local validation, native runtime (Python)\n\nRun from the sample directory.\n\n```bash\nuv venv .venv --python 3.12          # 3.12 matches the sample Dockerfile\nuv pip install --python .venv\u002F... -r requirements.txt\n```\n\nCreate `.env` from `.env.example` with the **real** values:\n\n```\nFOUNDRY_PROJECT_ENDPOINT=\"https:\u002F\u002F\u003Caccount>.services.ai.azure.com\u002Fapi\u002Fprojects\u002F\u003Cproject>\"\nFOUNDRY_MODEL=\"\u003Creal-deployed-model>\"\n```\n\nStart the server (`python main.py`) — it listens on `http:\u002F\u002Flocalhost:8088`.\n`main.py` uses `DefaultAzureCredential`, so `az login` must be current.\nThe sample code prefers `FOUNDRY_MODEL` locally and falls back to the\nazd-managed `AZURE_AI_MODEL_DEPLOYMENT_NAME` when hosted.\n\nInvoke (single turn), capture the returned `response_id`, then reuse it for a\nfollow-up turn to confirm memory:\n\n```bash\ncurl -X POST http:\u002F\u002Flocalhost:8088\u002Fresponses -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"input\": \"My name is Tao. Remember it.\"}'\n# take response_id from the JSON, then:\ncurl -X POST http:\u002F\u002Flocalhost:8088\u002Fresponses -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"input\": \"What is my name?\", \"previous_response_id\": \"\u003Cresponse_id>\"}'\n```\n\nPowerShell: use `Invoke-WebRequest -Uri http:\u002F\u002Flocalhost:8088\u002Fresponses -Method POST -ContentType application\u002Fjson -Body '...'`.\n\n**Pass:** HTTP 200, non-empty `output[].content[].text`, and the second turn\nrecalls the name. Stop the server afterward.\n\n### Recording the playbook (cached replay)\n\nThe sample-validation harness caches a **playbook** so future runs replay your\nresult without an agent. For a hosted-agent sample the playbook is an\nagent-authored **Python script** that reproduces **only this Phase 1\nnative-local smoke test** — never the `azd`\u002Fdeploy phases (those are\ncredential- and deployment-bound, non-deterministic, and must not enter the\nreplay cache).\n\nEmit a self-contained script that the harness runs with the active interpreter\nfrom the `python\u002F` directory (exit code 0 = success). It may import only the\nsample's own installed deps, the Python stdlib, and `httpx`. It must:\n\n1. Start the sample server in the **background** with\n   `subprocess.Popen([sys.executable, \"\u003Csample>\u002Fmain.py\"])` (path relative to\n   `python\u002F`; the shared `python\u002F.env` and the process env supply credentials).\n2. **Poll** `http:\u002F\u002Flocalhost:8088` until the port accepts a connection (bounded\n   readiness loop with a timeout), failing if it never comes up.\n3. POST turn 1 to the protocol's route (`\u002Fresponses` for `responses` samples;\n   the invocations route for `invocations` samples), capture the `response_id`,\n   then POST turn 2 with `previous_response_id` to confirm recall.\n4. **Assert** HTTP 200, non-empty `output[].content[].text`, and that turn 2\n   recalls the fact from turn 1.\n5. **Always** terminate the server in a `finally` block so port 8088 is freed\n   (the harness force-kills the process group as a backstop, but the script must\n   still clean up). On any failure, print the captured server output before\n   exiting non-zero.\n\nKeep the deep three-phase validation (below) for a full manual\u002F`azd` pass; it is\nout of scope for the cached playbook.\n\n---\n\n## Phase 2 — Local validation via `azd ai agent run`\n\n### Init the azd project (once)\n\nRun in an **empty temp directory outside the repo** (short path avoids Windows\npath-length issues, e.g. `C:\\afval\\\u003Csample>`). Point `-m` at the **local**\nmanifest so it validates the working-tree sample:\n\n```bash\nazd ai agent init -m \u003Cpath>\u002Fagent.manifest.yaml \\\n  --project-id \"\u003Cproject-resource-id>\" \\\n  --model-deployment \"\u003Creal-deployed-model>\" \\\n  --agent-name \"\u003Cagent-name-from-manifest>\" \\\n  --no-prompt --force\n```\n\n`init` downloads the template into a **subfolder named after the agent**, so the\nazd project root is `\u003Ctempdir>\u002F\u003Cagent-name>\u002F`. `cd` there for all later `azd`\ncommands.\n\n> **Before init, remove any `.venv` you created in the sample dir** — `init`\n> copies the entire manifest directory into `src\u002F`. (`.venv` is excluded from\n> deploy packaging by `.agentignore`\u002F`.dockerignore`, so it is harmless but\n> bloats\u002Fslows the copy.)\n\n### Fix the model deployment name (critical — see Gotcha 1)\n\n```bash\nazd env set AZURE_AI_MODEL_DEPLOYMENT_NAME \"\u003Creal-deployed-model>\"\n```\n\n### Run and invoke locally\n\n```bash\nazd ai agent run --no-inspector        # auto-creates a uv venv + installs deps; listens on :8088\nazd ai agent invoke --local --new-session \"My name is Tao. Remember it.\"\nazd ai agent invoke --local \"What is my name?\"   # same session is reused automatically\n```\n\n**Pass:** both invokes return text; the second recalls the name (same\n`Session:` id). Stop the `run` process afterward.\n\n---\n\n## Removing a pre-existing agent (do this before deploying)\n\n`init` prints a warning if the agent name already exists in the project. To\ndelete it, note that **`azd ai agent delete`\u002F`show` resolve the deployed agent\nname from an azd env var, not from the positional argument.** The var is\n`AGENT_{SERVICEKEY}_NAME`, where `SERVICEKEY` = the `azure.yaml` service name\nuppercased with `-`\u002Fspaces → `_`.\n\nExample for service `agent-framework-agent-basic-responses`:\n\n```bash\nazd env set AGENT_AGENT_FRAMEWORK_AGENT_BASIC_RESPONSES_NAME agent-framework-agent-basic-responses\nazd ai agent delete \u003Cservice-name> --force --no-prompt --output json\n# -> {\"object\":\"agent.deleted\",\"name\":\"...\",\"deleted\":true}\n```\n\n(After a successful `azd deploy`, this var is set automatically, so later\n`show`\u002F`delete`\u002F`invoke` work without setting it.)\n\n---\n\n## Phase 3 — Deploy and validate\n\n### Reuse an existing ACR (avoid provisioning)\n\nFor an existing project + model, **do not run `azd provision`\u002F`azd up`** — the\ngenerated `azure.yaml` has a `deployments` block for the manifest's model\n(often an auto-selected `GlobalProvisionedManaged` PTU SKU) that provision would\ntry to create (costly \u002F quota failures). Instead reuse an ACR:\n\n```bash\nazd env set AZURE_CONTAINER_REGISTRY_ENDPOINT \u003Cacr-login-server>   # e.g. myacr.azurecr.io\nazd deploy\n```\n\n`azd deploy` fails with _\"could not determine container registry endpoint\"_ if\nthis is unset and no ACR is provisioned.\n\n### Verify the deployed model env var, then invoke\n\n```bash\nazd ai agent show \u003Cagent-name> --output json   # check definition.environment_variables.AZURE_AI_MODEL_DEPLOYMENT_NAME\nazd ai agent invoke \u003Cagent-name> --new-session \"My name is Tao. Remember it.\"\nazd ai agent invoke \u003Cagent-name> \"What is my name?\"\n```\n\nUse `--output raw` on invoke to see raw SSE events and any failure, e.g.:\n\n```\nevent: response.failed\n... \"code\": \"DeploymentNotFound\" ... 404 ...\n```\n\n`DeploymentNotFound` means the deployed `AZURE_AI_MODEL_DEPLOYMENT_NAME` points\nat a model that isn't deployed → fix per Gotcha 1 and redeploy (creates a new\nversion).\n\n**Pass:** agent reaches `status: active`, invoke returns text (not empty, no\n`response.failed`), and multi-turn recalls the name.\n\n---\n\n## Cleanup (always)\n\n- Delete the deployed agent: `azd ai agent delete \u003Cagent-name> --force --no-prompt`.\n- Delete the temp `azd` project directory.\n- Remove `.env`\u002F`.venv` you created in the sample dir; confirm the sample dir is\n  pristine (`git status --porcelain \u003Cdir>` is empty — `.env`\u002F`.venv` are\n  gitignored).\n- Stop any leftover local server still holding port 8088:\n  `Get-NetTCPConnection -LocalPort 8088 -State Listen` → `Stop-Process -Id \u003Cpid>`\n  (Linux\u002FmacOS: `lsof -ti:8088 | xargs kill`). Stopping the shell may leave the\n  child interpreter running.\n\n---\n\n## Gotchas (the parts that waste the most time)\n\n1. **The deployed model name comes from `agent.yaml`, not the azd env.**\n   `azd ai agent init` ignores `--model-deployment` in `--no-prompt` mode and\n   writes the **manifest's** model id (e.g. `gpt-4.1-mini`) as a **literal** into\n   both the azd env `AZURE_AI_MODEL_DEPLOYMENT_NAME` and the generated\n   `src\u002F\u003Cagent>\u002Fagent.yaml` env var. Local runs read the azd env (so\n   `azd env set` fixes them), but **deployment injects `agent.yaml`'s value**.\n   Fix by setting the generated `agent.yaml` env var to the template\n   `value: ${AZURE_AI_MODEL_DEPLOYMENT_NAME}` (what the repo sample already uses;\n   `init` flattens it) **and** `azd env set AZURE_AI_MODEL_DEPLOYMENT_NAME \u003Creal>`,\n   then redeploy. A literal `value: \u003Creal-model>` also works.\n\n2. **`azd ai agent delete\u002Fshow` need the `AGENT_{SERVICEKEY}_NAME` env var** — a\n   bare positional agent name is treated as the _service_ name and the deployed\n   agent name is looked up from that env var (see \"Removing a pre-existing\n   agent\").\n\n3. **`azd provision`\u002F`azd up` will try to create the manifest's model\n   deployment** (from `azure.yaml`'s `deployments` block). Prefer `azd deploy`\n   with a reused ACR when the project + model already exist.\n\n4. **`python` on PATH is not required.** `uv venv` and `azd ai agent run`\n   provision their own interpreter and install `requirements.txt`.\n\n5. **`init` copies the whole manifest directory into `src\u002F`.** Remove a local\n   `.venv` from the sample dir first to keep the copy clean\u002Ffast.\n\n6. **Port 8088 can stay bound after stopping the shell** — kill the interpreter\n   by PID (see Cleanup).\n\n---\n\n## Success checklist\n\n- [ ] Native local run: 200 + non-empty text + multi-turn recall.\n- [ ] `azd ai agent run` local: text returned + session reused across invokes.\n- [ ] Pre-existing agent removed (if any).\n- [ ] `azd deploy` succeeds; agent `status: active`.\n- [ ] `azd ai agent show` confirms `AZURE_AI_MODEL_DEPLOYMENT_NAME` = the real\n      deployed model.\n- [ ] Deployed invoke: text returned (no `response.failed`) + multi-turn recall.\n- [ ] Cleanup done: agent deleted, temp project removed, sample dir pristine,\n      port 8088 free.\n","# Validating a Foundry Hosted Agent Sample\n\nA hosted agent sample is \"validated\" when it passes **three** independent\nchecks, plus cleanup:\n\n1. **Local, native runtime** — run the sample's own entry point\n   (`python main.py`) and invoke it over HTTP.\n2. **Local, via `azd ai agent run`** — the `azd` local dev loop.\n3. **Deployed** — `azd deploy` to Foundry, then invoke the hosted agent.\n\nEach check must succeed for **single-turn** and **multi-turn** (session \u002F\n`previous_response_id`) conversation. Always end with **cleanup** (delete the\ndeployed agent, remove the temp `azd` project, restore the sample dir).\n\n> Read the sample's own `README.md` and the parent\n> `...\u002Ffoundry-hosted-agents\u002FREADME.md` first — they define the run\u002Fdeploy\n> commands and any sample-specific payload. This skill captures the process and\n> the non-obvious gotchas the READMEs don't.\n\n---\n\n## Inputs you need before starting\n\nGather these:\n\n- **Foundry project endpoint**, e.g.\n  `https:\u002F\u002F\u003Caccount>.services.ai.azure.com\u002Fapi\u002Fprojects\u002F\u003Cproject>`.\n- **Foundry project resource id** (for non-interactive `azd ai agent init`):\n  `\u002Fsubscriptions\u002F\u003Csub>\u002FresourceGroups\u002F\u003Crg>\u002Fproviders\u002FMicrosoft.CognitiveServices\u002Faccounts\u002F\u003Caccount>\u002Fprojects\u002F\u003Cproject>`.\n  Find it with `az cognitiveservices account list` + the project name.\n- **A real, deployed model name** in that project (e.g. `gpt-4.1-mini`). This is\n  often **different** from the model id in `agent.manifest.yaml` — the actual\n  deployment name wins.\n- **An existing ACR to reuse** for deployment (login server, e.g.\n  `myacr.azurecr.io`). Reusing one avoids `azd provision` creating resources.\n- Whether a like-named agent **already exists** in the project (remove it first\n  for a clean validation — see below).\n\n## Tooling \u002F auth\n\n- `az` (logged in: `az login`) and `azd` (logged in: `azd auth login`).\n- `azd` **agents extension**: `azd extension list` should show\n  `azure.ai.agents`; install with `azd extension install azure.ai.agents`.\n- `uv` for the native-Python local run. **`python` need not be on PATH** — `uv`\n  and `azd ai agent run` provision their own interpreter.\n- Docker is **not** required when you reuse an ACR (`remoteBuild: true` builds\n  in ACR Tasks).\n\n---\n\n## Phase 0 — Understand the sample\n\nA responses\u002Finvocations sample folder typically contains:\n`main.py` (entry point + `ResponsesHostServer`\u002F`InvocationsHostServer`),\n`agent.manifest.yaml` (used by `azd ai agent init`), `agent.yaml` (the deployed\nagent definition), `requirements.txt`, `Dockerfile`, `.env.example`.\n\n**The sample is the whole directory whose entry point is `main.py` — not every\n`.py` file in it.** Other Python files in (or alongside) a sample folder are\n**helper\u002Fcompanion scripts**, not standalone samples. Do **not** treat a helper\nscript as an individual sample — validate the sample via its `main.py` host, and\nrun a helper only when the sample's `README.md` calls for it as a setup.\n\nNote the **protocol** (`responses` or `invocations`) from `agent.yaml` \u002F\nmanifest — it changes the invoke command (`--protocol invocations`) and the HTTP\npath (`\u002Fresponses` vs the invocations route).\n\n---\n\n## Phase 1 — Local validation, native runtime (Python)\n\nRun from the sample directory.\n\n```bash\nuv venv .venv --python 3.12          # 3.12 matches the sample Dockerfile\nuv pip install --python .venv\u002F... -r requirements.txt\n```\n\nCreate `.env` from `.env.example` with the **real** values:\n\n```\nFOUNDRY_PROJECT_ENDPOINT=\"https:\u002F\u002F\u003Caccount>.services.ai.azure.com\u002Fapi\u002Fprojects\u002F\u003Cproject>\"\nFOUNDRY_MODEL=\"\u003Creal-deployed-model>\"\n```\n\nStart the server (`python main.py`) — it listens on `http:\u002F\u002Flocalhost:8088`.\n`main.py` uses `DefaultAzureCredential`, so `az login` must be current.\nThe sample code prefers `FOUNDRY_MODEL` locally and falls back to the\nazd-managed `AZURE_AI_MODEL_DEPLOYMENT_NAME` when hosted.\n\nInvoke (single turn), capture the returned `response_id`, then reuse it for a\nfollow-up turn to confirm memory:\n\n```bash\ncurl -X POST http:\u002F\u002Flocalhost:8088\u002Fresponses -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"input\": \"My name is Tao. Remember it.\"}'\n# take response_id from the JSON, then:\ncurl -X POST http:\u002F\u002Flocalhost:8088\u002Fresponses -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"input\": \"What is my name?\", \"previous_response_id\": \"\u003Cresponse_id>\"}'\n```\n\nPowerShell: use `Invoke-WebRequest -Uri http:\u002F\u002Flocalhost:8088\u002Fresponses -Method POST -ContentType application\u002Fjson -Body '...'`.\n\n**Pass:** HTTP 200, non-empty `output[].content[].text`, and the second turn\nrecalls the name. Stop the server afterward.\n\n### Recording the playbook (cached replay)\n\nThe sample-validation harness caches a **playbook** so future runs replay your\nresult without an agent. For a hosted-agent sample the playbook is an\nagent-authored **Python script** that reproduces **only this Phase 1\nnative-local smoke test** — never the `azd`\u002Fdeploy phases (those are\ncredential- and deployment-bound, non-deterministic, and must not enter the\nreplay cache).\n\nEmit a self-contained script that the harness runs with the active interpreter\nfrom the `python\u002F` directory (exit code 0 = success). It may import only the\nsample's own installed deps, the Python stdlib, and `httpx`. It must:\n\n1. Start the sample server in the **background** with\n   `subprocess.Popen([sys.executable, \"\u003Csample>\u002Fmain.py\"])` (path relative to\n   `python\u002F`; the shared `python\u002F.env` and the process env supply credentials).\n2. **Poll** `http:\u002F\u002Flocalhost:8088` until the port accepts a connection (bounded\n   readiness loop with a timeout), failing if it never comes up.\n3. POST turn 1 to the protocol's route (`\u002Fresponses` for `responses` samples;\n   the invocations route for `invocations` samples), capture the `response_id`,\n   then POST turn 2 with `previous_response_id` to confirm recall.\n4. **Assert** HTTP 200, non-empty `output[].content[].text`, and that turn 2\n   recalls the fact from turn 1.\n5. **Always** terminate the server in a `finally` block so port 8088 is freed\n   (the harness force-kills the process group as a backstop, but the script must\n   still clean up). On any failure, print the captured server output before\n   exiting non-zero.\n\nKeep the deep three-phase validation (below) for a full manual\u002F`azd` pass; it is\nout of scope for the cached playbook.\n\n---\n\n## Phase 2 — Local validation via `azd ai agent run`\n\n### Init the azd project (once)\n\nRun in an **empty temp directory outside the repo** (short path avoids Windows\npath-length issues, e.g. `C:\\afval\\\u003Csample>`). Point `-m` at the **local**\nmanifest so it validates the working-tree sample:\n\n```bash\nazd ai agent init -m \u003Cpath>\u002Fagent.manifest.yaml \\\n  --project-id \"\u003Cproject-resource-id>\" \\\n  --model-deployment \"\u003Creal-deployed-model>\" \\\n  --agent-name \"\u003Cagent-name-from-manifest>\" \\\n  --no-prompt --force\n```\n\n`init` downloads the template into a **subfolder named after the agent**, so the\nazd project root is `\u003Ctempdir>\u002F\u003Cagent-name>\u002F`. `cd` there for all later `azd`\ncommands.\n\n> **Before init, remove any `.venv` you created in the sample dir** — `init`\n> copies the entire manifest directory into `src\u002F`. (`.venv` is excluded from\n> deploy packaging by `.agentignore`\u002F`.dockerignore`, so it is harmless but\n> bloats\u002Fslows the copy.)\n\n### Fix the model deployment name (critical — see Gotcha 1)\n\n```bash\nazd env set AZURE_AI_MODEL_DEPLOYMENT_NAME \"\u003Creal-deployed-model>\"\n```\n\n### Run and invoke locally\n\n```bash\nazd ai agent run --no-inspector        # auto-creates a uv venv + installs deps; listens on :8088\nazd ai agent invoke --local --new-session \"My name is Tao. Remember it.\"\nazd ai agent invoke --local \"What is my name?\"   # same session is reused automatically\n```\n\n**Pass:** both invokes return text; the second recalls the name (same\n`Session:` id). Stop the `run` process afterward.\n\n---\n\n## Removing a pre-existing agent (do this before deploying)\n\n`init` prints a warning if the agent name already exists in the project. To\ndelete it, note that **`azd ai agent delete`\u002F`show` resolve the deployed agent\nname from an azd env var, not from the positional argument.** The var is\n`AGENT_{SERVICEKEY}_NAME`, where `SERVICEKEY` = the `azure.yaml` service name\nuppercased with `-`\u002Fspaces → `_`.\n\nExample for service `agent-framework-agent-basic-responses`:\n\n```bash\nazd env set AGENT_AGENT_FRAMEWORK_AGENT_BASIC_RESPONSES_NAME agent-framework-agent-basic-responses\nazd ai agent delete \u003Cservice-name> --force --no-prompt --output json\n# -> {\"object\":\"agent.deleted\",\"name\":\"...\",\"deleted\":true}\n```\n\n(After a successful `azd deploy`, this var is set automatically, so later\n`show`\u002F`delete`\u002F`invoke` work without setting it.)\n\n---\n\n## Phase 3 — Deploy and validate\n\n### Reuse an existing ACR (avoid provisioning)\n\nFor an existing project + model, **do not run `azd provision`\u002F`azd up`** — the\ngenerated `azure.yaml` has a `deployments` block for the manifest's model\n(often an auto-selected `GlobalProvisionedManaged` PTU SKU) that provision would\ntry to create (costly \u002F quota failures). Instead reuse an ACR:\n\n```bash\nazd env set AZURE_CONTAINER_REGISTRY_ENDPOINT \u003Cacr-login-server>   # e.g. myacr.azurecr.io\nazd deploy\n```\n\n`azd deploy` fails with _\"could not determine container registry endpoint\"_ if\nthis is unset and no ACR is provisioned.\n\n### Verify the deployed model env var, then invoke\n\n```bash\nazd ai agent show \u003Cagent-name> --output json   # check definition.environment_variables.AZURE_AI_MODEL_DEPLOYMENT_NAME\nazd ai agent invoke \u003Cagent-name> --new-session \"My name is Tao. Remember it.\"\nazd ai agent invoke \u003Cagent-name> \"What is my name?\"\n```\n\nUse `--output raw` on invoke to see raw SSE events and any failure, e.g.:\n\n```\nevent: response.failed\n... \"code\": \"DeploymentNotFound\" ... 404 ...\n```\n\n`DeploymentNotFound` means the deployed `AZURE_AI_MODEL_DEPLOYMENT_NAME` points\nat a model that isn't deployed → fix per Gotcha 1 and redeploy (creates a new\nversion).\n\n**Pass:** agent reaches `status: active`, invoke returns text (not empty, no\n`response.failed`), and multi-turn recalls the name.\n\n---\n\n## Cleanup (always)\n\n- Delete the deployed agent: `azd ai agent delete \u003Cagent-name> --force --no-prompt`.\n- Delete the temp `azd` project directory.\n- Remove `.env`\u002F`.venv` you created in the sample dir; confirm the sample dir is\n  pristine (`git status --porcelain \u003Cdir>` is empty — `.env`\u002F`.venv` are\n  gitignored).\n- Stop any leftover local server still holding port 8088:\n  `Get-NetTCPConnection -LocalPort 8088 -State Listen` → `Stop-Process -Id \u003Cpid>`\n  (Linux\u002FmacOS: `lsof -ti:8088 | xargs kill`). Stopping the shell may leave the\n  child interpreter running.\n\n---\n\n## Gotchas (the parts that waste the most time)\n\n1. **The deployed model name comes from `agent.yaml`, not the azd env.**\n   `azd ai agent init` ignores `--model-deployment` in `--no-prompt` mode and\n   writes the **manifest's** model id (e.g. `gpt-4.1-mini`) as a **literal** into\n   both the azd env `AZURE_AI_MODEL_DEPLOYMENT_NAME` and the generated\n   `src\u002F\u003Cagent>\u002Fagent.yaml` env var. Local runs read the azd env (so\n   `azd env set` fixes them), but **deployment injects `agent.yaml`'s value**.\n   Fix by setting the generated `agent.yaml` env var to the template\n   `value: ${AZURE_AI_MODEL_DEPLOYMENT_NAME}` (what the repo sample already uses;\n   `init` flattens it) **and** `azd env set AZURE_AI_MODEL_DEPLOYMENT_NAME \u003Creal>`,\n   then redeploy. A literal `value: \u003Creal-model>` also works.\n\n2. **`azd ai agent delete\u002Fshow` need the `AGENT_{SERVICEKEY}_NAME` env var** — a\n   bare positional agent name is treated as the _service_ name and the deployed\n   agent name is looked up from that env var (see \"Removing a pre-existing\n   agent\").\n\n3. **`azd provision`\u002F`azd up` will try to create the manifest's model\n   deployment** (from `azure.yaml`'s `deployments` block). Prefer `azd deploy`\n   with a reused ACR when the project + model already exist.\n\n4. **`python` on PATH is not required.** `uv venv` and `azd ai agent run`\n   provision their own interpreter and install `requirements.txt`.\n\n5. **`init` copies the whole manifest directory into `src\u002F`.** Remove a local\n   `.venv` from the sample dir first to keep the copy clean\u002Ffast.\n\n6. **Port 8088 can stay bound after stopping the shell** — kill the interpreter\n   by PID (see Cleanup).\n\n---\n\n## Success checklist\n\n- [ ] Native local run: 200 + non-empty text + multi-turn recall.\n- [ ] `azd ai agent run` local: text returned + session reused across invokes.\n- [ ] Pre-existing agent removed (if any).\n- [ ] `azd deploy` succeeds; agent `status: active`.\n- [ ] `azd ai agent show` confirms `AZURE_AI_MODEL_DEPLOYMENT_NAME` = the real\n      deployed model.\n- [ ] Deployed invoke: text returned (no `response.failed`) + multi-turn recall.\n- [ ] Cleanup done: agent deleted, temp project removed, sample dir pristine,\n      port 8088 free.\n",{"name":5,"license":16,"metadata":56,"description":59,"compatibility":60},{"author":57,"version":58},"agent-framework-samples","1.0","Step-by-step process for validating a Python Foundry hosted agent sample (under python\u002Fsamples\u002F04-hosting\u002Ffoundry-hosted-agents\u002F) end to end — running it locally (native runtime and `azd ai agent run`) and after deploying it to an Azure AI Foundry project with `azd`. Use this when asked to validate a hosted agent sample.\n","Works with any model that supports tool use.","main","b7884ad88eb85c27b2a7bf40c0e15948e7ccc28d","python\u002Fscripts\u002Fsample_validation\u002Fskills\u002Ffoundry-hosted-agent-validation",2624,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagent-framework","https:\u002F\u002Faka.ms\u002Fagent-framework","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-14 14:06:55",{"source":9,"skillName":5,"commands":72,"prompt":82,"zipAvailable":83},[73,76,79],{"tool":74,"command":75},"npx","npx skills add microsoft\u002Fagent-framework --skill foundry-hosted-agent-validation",{"tool":77,"command":78},"bunx","bunx skills add microsoft\u002Fagent-framework --skill foundry-hosted-agent-validation",{"tool":80,"command":81},"pnpm","pnpm dlx skills add microsoft\u002Fagent-framework --skill foundry-hosted-agent-validation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagent-framework\u002Fblob\u002Fmain\u002Fpython\u002Fscripts\u002Fsample_validation\u002Fskills\u002Ffoundry-hosted-agent-validation\u002FSKILL.md",true,[],[86,110,138,151,174,196],{"skillNo":87,"name":88,"nameZh":17,"description":89,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":51},"01M70H1GNJPW85ENXA0BCPC6PF","draft-release-notes","Create or rewrite Agent Framework release notes from a generated GitHub release log. Use when preparing Python or .NET release notes, filtering mixed-language changelogs, deduplicating changes, preserving inline contributor credits, or documenting breaking-change migrations from pull requests. Requires the user to provide the generated GitHub log, language, and release version before work begins.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagent-framework\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fdraft-release-notes\u002FSKILL.md",[],[93,94,95,96,97,44,98,99,100,101,102,103,43,104,105,106,107,108,109,36],"notes","release notes","release","draft","draft release notes","agent framework","pull requests","create","pull","generated","filtering","version","log","release version","rewrite","mixed-language","contributor",{"skillNo":111,"name":112,"nameZh":113,"description":114,"descriptionZh":115,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":116,"categories":117,"keywords":120,"publishedAt":51},"01M699C55AYGT1ZVZDHWFZNBDB","agent-framework-builder-python","Python Agent Framework 应用构建","Use this skill when building, modifying, reviewing, evaluating, integrating, or hosting Python applications with Microsoft Agent Framework. Use it for Agent Framework agents, harness agents, workflows, orchestrations, declarative definitions, tools, sessions, middleware, evaluation, observability, integrations, or hosting, even when the user has not yet chosen the correct framework pattern.","当使用 Microsoft Agent Framework 构建、修改、审查、评估、集成或托管 Python 应用程序时使用此技能。适用于 Agent Framework 智能体、harness 智能体、工作流、编排、声明式定义、工具、会话、中间件、评估、可观测性、集成或托管，即使用户尚未选定正确的框架模式。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagent-framework\u002Fblob\u002Fmain\u002Fskills\u002Fagent-framework-builder-python\u002FSKILL.md",[118,119],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[44,98,121,46,122,10,123,124,125,126,127,128,129,130,131,43,132,133,134,135,136,37,137,36],"agent framework builder python","builder","workflows","sessions","microsoft agent framework","harness","observability","Evaluation","applications","correct","integrations","hosting","pattern","middleware","with","orchestrations","declarative",{"skillNo":139,"name":140,"nameZh":141,"description":142,"descriptionZh":143,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":144,"categories":145,"keywords":148,"publishedAt":51},"01M699C2PH4WPRCMV90NHANCY9","agent-framework-builder-dotnet",".NET Agent Framework 应用构建","Use this skill when building, modifying, reviewing, evaluating, integrating, or hosting .NET (C#) applications with Microsoft Agent Framework. Use it for Agent Framework agents, harness agents, workflows, orchestrations, declarative definitions, tools, sessions, middleware, evaluation, observability, integrations, or hosting, even when the user has not yet chosen the correct framework pattern.","当使用 Microsoft Agent Framework 构建、修改、审查、评估、集成或托管 .NET (C#) 应用程序时使用此技能。适用于 Agent Framework 智能体、harness 智能体、工作流、编排、声明式定义、工具、会话、中间件、评估、可观测性、集成或托管，即使用户尚未选定正确的框架模式。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagent-framework\u002Fblob\u002Fmain\u002Fskills\u002Fagent-framework-builder-dotnet\u002FSKILL.md",[146,147],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[98,149,150,46,122,10,123,124,125,126,127,129,130,131,43,134,135,136,37,137,36],"dotnet","agent framework builder dotnet",{"skillNo":152,"name":153,"nameZh":154,"description":155,"descriptionZh":156,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":157,"categories":158,"keywords":163,"publishedAt":51},"01M699BYCYJD8RXC5MYY61WBPR","foundry-config-setup","Foundry 项目配置修复","Resolve missing setup caused by a hardcoded Foundry project endpoint or model in a sample. Use when a sample fails because it uses a placeholder\u002Fhardcoded project_endpoint (for example \"https:\u002F\u002Fyour-project.services.ai.azure.com\") or a hardcoded model instead of reading them from the environment.","解决因示例中硬编码 Foundry 项目端点或模型而导致的配置缺失问题。当示例因使用占位符\u002F硬编码的 project_endpoint（例如 \"https:\u002F\u002Fyour-project.services.ai.azure.com\"）或硬编码模型，而非从环境中读取这些值时运行失败，请使用此技能。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagent-framework\u002Fblob\u002Fmain\u002Fpython\u002Fscripts\u002Fsample_validation\u002Fskills\u002Ffoundry-config-setup\u002FSKILL.md",[159,162],{"categoryNo":160,"categoryName":161,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRYS21JX3JFDVCQ5GG4TFK","AI 平台资源管理",{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},[31,164,165,166,167,49,168,169,170,45,34,171,43,172,42,41,173,135,37,36],"foundry config setup","config","setup","placeholder","tool use","https","services","environment","example","missing",{"skillNo":175,"name":176,"nameZh":177,"description":178,"descriptionZh":179,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":180,"categories":181,"keywords":188,"publishedAt":51},"01M699BWSTE6SGCCBY3JFP10GQ","support-style","客户支持沟通风格规范","Contoso Outdoors customer-support tone and formatting guidelines.","Contoso Outdoors 客户支持的语气与格式指南。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagent-framework\u002Fblob\u002Fmain\u002Fpython\u002Fsamples\u002F04-hosting\u002Ffoundry-hosted-agents\u002Fresponses\u002Ffoundry_toolbox_mcp_skills\u002Fskills\u002Fsupport-style\u002FSKILL.md",[182,185],{"categoryNo":183,"categoryName":184,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BTV4QVF3YRSPSWSFBVTSCA","客户支持与服务",{"categoryNo":186,"categoryName":187,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BTV4RTPJG7DBW13TQDFCBY","客户支持专员",[189,190,191,192,193,194,195],"support","support style","style","customer","guidelines","tone","formatting",{"skillNo":197,"name":198,"nameZh":199,"description":200,"descriptionZh":201,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":202,"categories":203,"keywords":206,"publishedAt":51},"01M699BV1KJRPZQ932J8HRHD3E","escalation-policy","客户支持工单升级策略","When and how to escalate Contoso Outdoors customer-support tickets.","何时以及如何升级 Contoso Outdoors 客户支持工单。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fagent-framework\u002Fblob\u002Fmain\u002Fpython\u002Fsamples\u002F04-hosting\u002Ffoundry-hosted-agents\u002Fresponses\u002Ffoundry_toolbox_mcp_skills\u002Fskills\u002Fescalation-policy\u002FSKILL.md",[204,205],{"categoryNo":183,"categoryName":184,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":186,"categoryName":187,"taxonomyType":23,"taxonomyTypeDesc":24},[207,208,209,192,189,210,211,212,213,36],"policy","escalation policy","escalation","how","how to","tickets","escalate"]