foundry-hosted-agent-validation
Skill14k starsChanged 10 months agoMITView on GitHub
Step-by-step process for validating a Python Foundry hosted agent sample (under python/samples/04-hosting/foundry-hosted-agents/) 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.
- Reads credentials
- Installs packages
- Sends data out
Trending
More talk lately.about the whole repository
Who's talking about microsoft/agent-framework
- microsoft/vscode-dotnettools“Project system data flow 'CapabilitiesScope Aggregating Publishing: 46625485' closed because of an exception.”GitHub · Nov 4, 2025 · 9 reactions
- @aymericw.bsky.social“Hyperlight codeact disponible en #dotnet et en #python dans Microsoft agent framework #opensource #ai …”Bluesky · May 12, 2026 · 5 likes
- @jeremymorgan.com“Microsoft made multi-agent workflows boring in the best way. Graph orchestration, OpenTelemetry, …”Bluesky · May 1, 2026 · 5 likes
- A Hacker News story“Microsoft's new framework for building and orchestrating AI agents”Hacker News · Apr 4, 2026 · 4 points
- microsoft/AgentSchema“Add headers to McpTool spec”GitHub · Mar 23, 2026 · 4 reactions
The biggest 5 of 31 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 31
Talked about on GitHub, Bluesky and Hacker News (31 times).
On GitHub · 17
- Nov 4, 2025Project system data flow 'CapabilitiesScope Aggregating Publishing: 46625485' closed because of an exception. — microsoft/vscode-dotnettools9 reactions · 13 comments
- Mar 23, 2026Add headers to McpTool spec — microsoft/AgentSchema4 reactions
- Mar 19, 2026Foundry Hosted Agent from_agent_framework removes Authorization Header disabling OBO possibilities — Azure/azure-sdk-for-python4 reactions · 14 comments
- Mar 19, 2026Tool Search Tool feature similar to anthropic — google/adk-python3 reactions · 6 comments
- Dec 4, 2025Add Agent Framework DevUI Integration — microsoft/aspire2 reactions · 4 comments
12 more on GitHub
- Oct 3, 2025Built-in Agent Framework integration — microsoft/prompty2 reactions · 2 comments
- Oct 4, 2026[AgentServer] Resilient Responses turn hangs `in_progress` after graceful shutdown: deferral task update returns 400 and the task is left `suspended` — Azure/azure-sdk-for-net1 reaction · 3 comments
- Sep 23, 2026[azure-search-documents] Enable HTTPX async transport for AnyIO/Trio callers — Azure/azure-sdk-for-python1 reaction · 3 comments
- Sep 18, 2026[Bug]: Background Responses calls on gpt-5.4 return reasoning_tokens equal to output_tokens — Azure/azure-sdk-for-python1 reaction
- Sep 8, 2026[azure-ai-agentserver-responses] Failed response inputs are replayed in conversation history — Azure/azure-sdk-for-python1 reaction · 1 comment
- Aug 18, 2026.NET: Published packages are still built from `microsoft/agent-framework`, so fixes merged here don't reach NuGet — microsoft/agent-framework-durable-extension1 reaction · 2 comments
- Jun 11, 2026Align All Samples with Official Microsoft Agent Framework Samples and Remove Shared Dependencies — punitkshah/FoundryFeatures1 reaction
- May 1, 2026Microsoft Agent Framework 의 기능을 이용한 Multi-Turn Functionality — MSFT-AI-BUILD-INTERNAL/agentic-devops-starter1 reaction
- Apr 16, 2026Add Aspire DevUI Integration — leslierichardson95/aspire-agent-template1 reaction · 1 comment
- Oct 16, 2025[feat] Add TypeScript SDK — manekinekko/agent-framework1 reaction
- Oct 2, 2025Add Agent Framework Scenario: Shopping Assistant — Azure-Samples/eShopLite1 reaction · 1 comment
- Feb 27, 2026NuGet: Bump the microsoftagents group with 2 updates — foxminchan/BookWorm0 reactions · 2 comments
On Bluesky · 10
- May 12, 2026Hyperlight codeact disponible en #dotnet et en #python dans Microsoft agent framework #opensource #ai github.com/microsoft/ag... — @aymericw.bsky.social5 likes and reposts
- May 1, 2026Microsoft made multi-agent workflows boring in the best way. Graph orchestration, OpenTelemetry, time-travel debugging, durable execution.… — @jeremymorgan.com5 likes and reposts · 1 reply
- Apr 6, 2026🤖 Microsoft drops agent-framework today! AutoGen + Semantic Kernel merged for multi-agent AI workflows. Native Python & .NET support.… — @just--bruno.bsky.social2 likes and reposts · 1 reply
- Oct 12, 2025#Autogen was part of my first experiments into multi-agentic AI and I certainly learnt a lot from the platform (including from @ag2oss &… — @5h15h.bsky.social2 likes and reposts
- Jul 17, 2026My first contribution to the Microsoft Agent Framework just got merged! 🚀 I'm excited to contribute to this ecosystem!… — @handle.invalid1 likes and repost
5 more on Bluesky
- Apr 5, 2026Microsoftから新フレームワーク「agent-framework」が登場。 Pythonと.NETに対応し、グラフベースで複雑なAIエージェントのワークフローを構築可能。チェックポイントや人介在(Human-in-the-loop)、タイムトラベル機能まで標準装備なのが熱い… — @woody-ai-tools.bsky.social1 likes and repost
- Oct 14, 2025agent-framework A framework for building, orchestrating and deploying AI agents and multi-agent workflows with support for Python and .NET.… — @pythonhub.dev1 likes and repost
- Oct 3, 2025Agent Framework brings the production ready focus of Semantic Kernel with full C#/Python support, as well as the nimble intuitive interface… — @victordibia.bsky.social1 likes and repost · 1 reply
- Apr 27, 2026microsoft/agent-framework: A framework for building, orchestrating and deploying AI agents and multi-agent workflows with support for… — @fluid.sublimer.me0 likes and reposts · 1 reply
- Oct 3, 2025🎉 Celebrating! 🎉 (500+ new stars) 📦 microsoft / agent-framework ⭐ 1,432 (+678) 🗒 Python A framework for building, orchestrating and… — @github-trending.bsky.social0 likes and reposts · 1 reply
On Hacker News · 4
- Apr 4, 2026Microsoft's new framework for building and orchestrating AI agents4 points
- Oct 1, 2025Microsoft Agent Framework3 points
- Oct 3, 2025Microsoft Agent Framework2 points
- Oct 2, 2025Microsoft releases Agent Framework for Python and .NET1 point
In this repository67 other files it gives its agents.
- dotnet/AGENTS.mdAGENTS.md
- dotnet/samples/AGENTS.mdAGENTS.md
- python/AGENTS.mdAGENTS.md
- python/packages/a2a/AGENTS.mdAGENTS.md
- python/packages/ag-ui/AGENTS.mdAGENTS.md
- python/packages/anthropic/AGENTS.mdAGENTS.md
- python/packages/azure-ai-search/AGENTS.mdAGENTS.md
- python/packages/azure-contentunderstanding/AGENTS.mdAGENTS.md
- python/packages/azure-cosmos/AGENTS.mdAGENTS.md
- python/packages/azure-cosmos-memory/AGENTS.mdAGENTS.md
- python/packages/bedrock/AGENTS.mdAGENTS.md
- python/packages/chatkit/AGENTS.mdAGENTS.md
- python/packages/claude/AGENTS.mdAGENTS.md
- python/packages/copilotstudio/AGENTS.mdAGENTS.md
- python/packages/core/AGENTS.mdAGENTS.md
- python/packages/declarative/AGENTS.mdAGENTS.md
- python/packages/devui/AGENTS.mdAGENTS.md
- python/packages/foundry_local/AGENTS.mdAGENTS.md
- python/packages/gemini/AGENTS.mdAGENTS.md
- python/packages/github_copilot/AGENTS.mdAGENTS.md
- python/packages/hosting-a2a/AGENTS.mdAGENTS.md
- python/packages/hosting-mcp/AGENTS.mdAGENTS.md
- python/packages/lab/AGENTS.mdAGENTS.md
- python/packages/mem0/AGENTS.mdAGENTS.md
- python/packages/mistral/AGENTS.mdAGENTS.md
- python/packages/monty/AGENTS.mdAGENTS.md
- python/packages/ollama/AGENTS.mdAGENTS.md
- python/packages/openai/AGENTS.mdAGENTS.md
- python/packages/purview/AGENTS.mdAGENTS.md
- python/packages/redis/AGENTS.mdAGENTS.md
- python/packages/typesafe/AGENTS.mdAGENTS.md
- python/samples/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- build-and-testSkill
- project-structureSkill
- pull-requestsSkill
- verify-dotnet-samplesSkill
- verify-samples-toolSkill
- unit-converterSkill
- unit-converterSkill
- unit-converterSkill
- risk-scoringSkill
- valuationSkill
- risk-scoringSkill
- valuationSkill
- regex-testerSkill
- escalation-policySkill
- support-styleSkill
- pull-requestsSkill
- agent-framework-py-releaseSkill
- pull-requestsSkill
- python-code-qualitySkill
- python-developmentSkill
- python-feature-lifecycleSkill
- python-package-managementSkill
- python-testingSkill
- risk-scoringSkill
- valuationSkill
- risk-scoringSkill
- valuationSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 1 is distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 87
Run from the sample directory.
- Very specific: line 94
Create .env from .env.example with the real values:
- Very specific: line 101
Start the server (python main.py) — it listens on http://localhost:8088.
- Very specific: line 133
Start the sample server in the background with subprocess.Popen([sys.executable, "<sample>/main.py"]) (path relative to python/.
- Very specific: line 148
Keep the deep three-phase validation (below) for a full manual/azd pass.
- Very specific: line 157
Run in an empty temp directory outside the repo (short path avoids Windows path-length issues, e.g.
- Very specific: line 243
Use --output raw on invoke to see raw SSE events and any failure, e.g.:
- Very specific: line 261
Delete the deployed agent: azd ai agent delete <agent-name> --force --no-prompt.
- Very specific: line 262
Delete the temp azd project directory.
- Very specific: line 263
Remove .env/.venv you created in the sample dir.
- Very specific: line 266
Stop any leftover local server still holding port 8088: Get-NetTCPConnection -LocalPort 8088 -State Listen → Stop-Process -Id <pid> …
- Very specific: line 298
initcopies the whole manifest directory intosrc/: Remove a local .venv from the sample dir first to keep the copy clean/fast.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Validating a Foundry Hosted Agent Sample
A hosted agent sample is "validated" when it passes three independent checks, plus cleanup:
- Local, native runtime — run the sample's own entry point
(
python main.py) and invoke it over HTTP. - Local, via
azd ai agent run— theazdlocal dev loop. - Deployed —
azd deployto Foundry, then invoke the hosted agent.
Each check must succeed for single-turn and multi-turn (session /
previous_response_id) conversation. Always end with cleanup (delete the
deployed agent, remove the temp azd project, restore the sample dir).
Read the sample's own
README.mdand the parent.../foundry-hosted-agents/README.mdfirst — they define the run/deploy commands and any sample-specific payload. This skill captures the process and the non-obvious gotchas the READMEs don't.
Inputs you need before starting
Gather these:
- Foundry project endpoint, e.g.
https://<account>.services.ai.azure.com/api/projects/<project>. - Foundry project resource id (for non-interactive
azd ai agent init):/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.CognitiveServices/accounts/<account>/projects/<project>. Find it withaz cognitiveservices account list+ the project name. - A real, deployed model name in that project (e.g.
gpt-4.1-mini). This is often different from the model id inagent.manifest.yaml— the actual deployment name wins. - An existing ACR to reuse for deployment (login server, e.g.
myacr.azurecr.io). Reusing one avoidsazd provisioncreating resources. - Whether a like-named agent already exists in the project (remove it first for a clean validation — see below).
Tooling / auth
az(logged in:az login) andazd(logged in:azd auth login).azdagents extension:azd extension listshould showazure.ai.agents; install withazd extension install azure.ai.agents.uvfor the native-Python local run.pythonneed not be on PATH —uvandazd ai agent runprovision their own interpreter.- Docker is not required when you reuse an ACR (
remoteBuild: truebuilds in ACR Tasks).
Phase 0 — Understand the sample
A responses/invocations sample folder typically contains:
main.py (entry point + ResponsesHostServer/InvocationsHostServer),
agent.manifest.yaml (used by azd ai agent init), agent.yaml (the deployed
agent definition), requirements.txt, Dockerfile, .env.example.
The sample is the whole directory whose entry point is main.py — not every
.py file in it. Other Python files in (or alongside) a sample folder are
helper/companion scripts, not standalone samples. Do not treat a helper
script as an individual sample — validate the sample via its main.py host, and
run a helper only when the sample's README.md calls for it as a setup.
Note the protocol (responses or invocations) from agent.yaml /
manifest — it changes the invoke command (--protocol invocations) and the HTTP
path (/responses vs the invocations route).
Phase 1 — Local validation, native runtime (Python)
Run from the sample directory.
uv venv .venv --python 3.12 # 3.12 matches the sample Dockerfile
uv pip install --python .venv/... -r requirements.txtCreate .env from .env.example with the real values:
FOUNDRY_PROJECT_ENDPOINT="https://<account>.services.ai.azure.com/api/projects/<project>"
AZURE_AI_MODEL_DEPLOYMENT_NAME="<real-deployed-model>"Start the server (python main.py) — it listens on http://localhost:8088.
main.py uses DefaultAzureCredential, so az login must be current.
Invoke (single turn), capture the returned response_id, then reuse it for a
follow-up turn to confirm memory:
curl -X POST http://localhost:8088/responses -H "Content-Type: application/json" \
-d '{"input": "My name is Tao. Remember it."}'
# take response_id from the JSON, then:
curl -X POST http://localhost:8088/responses -H "Content-Type: application/json" \
-d '{"input": "What is my name?", "previous_response_id": "<response_id>"}'PowerShell: use Invoke-WebRequest -Uri http://localhost:8088/responses -Method POST -ContentType application/json -Body '...'.
Pass: HTTP 200, non-empty output[].content[].text, and the second turn
recalls the name. Stop the server afterward.
Recording the playbook (cached replay)
The sample-validation harness caches a playbook so future runs replay your
result without an agent. For a hosted-agent sample the playbook is an
agent-authored Python script that reproduces only this Phase 1
native-local smoke test — never the azd/deploy phases (those are
credential- and deployment-bound, non-deterministic, and must not enter the
replay cache).
Emit a self-contained script that the harness runs with the active interpreter
from the python/ directory (exit code 0 = success). It may import only the
sample's own installed deps, the Python stdlib, and httpx. It must:
- Start the sample server in the background with
subprocess.Popen([sys.executable, "<sample>/main.py"])(path relative topython/; the sharedpython/.envand the process env supply credentials). - Poll
http://localhost:8088until the port accepts a connection (bounded readiness loop with a timeout), failing if it never comes up. - POST turn 1 to the protocol's route (
/responsesforresponsessamples; the invocations route forinvocationssamples), capture theresponse_id, then POST turn 2 withprevious_response_idto confirm recall. - Assert HTTP 200, non-empty
output[].content[].text, and that turn 2 recalls the fact from turn 1. - Always terminate the server in a
finallyblock so port 8088 is freed (the harness force-kills the process group as a backstop, but the script must still clean up). On any failure, print the captured server output before exiting non-zero.
Keep the deep three-phase validation (below) for a full manual/azd pass; it is
out of scope for the cached playbook.
Phase 2 — Local validation via azd ai agent run
Init the azd project (once)
Run in an empty temp directory outside the repo (short path avoids Windows
path-length issues, e.g. C:\afval\<sample>). Point -m at the local
manifest so it validates the working-tree sample:
azd ai agent init -m <path>/agent.manifest.yaml \
--project-id "<project-resource-id>" \
--model-deployment "<real-deployed-model>" \
--agent-name "<agent-name-from-manifest>" \
--no-prompt --forceinit downloads the template into a subfolder named after the agent, so the
azd project root is <tempdir>/<agent-name>/. cd there for all later azd
commands.
Before init, remove any
.venvyou created in the sample dir —initcopies the entire manifest directory intosrc/. (.venvis excluded from deploy packaging by.agentignore/.dockerignore, so it is harmless but bloats/slows the copy.)
Fix the model deployment name (critical — see Gotcha 1)
azd env set AZURE_AI_MODEL_DEPLOYMENT_NAME "<real-deployed-model>"Run and invoke locally
azd ai agent run --no-inspector # auto-creates a uv venv + installs deps; listens on :8088
azd ai agent invoke --local --new-session "My name is Tao. Remember it."
azd ai agent invoke --local "What is my name?" # same session is reused automaticallyPass: both invokes return text; the second recalls the name (same
Session: id). Stop the run process afterward.
Removing a pre-existing agent (do this before deploying)
init prints a warning if the agent name already exists in the project. To
delete it, note that azd ai agent delete/show resolve the deployed agent
name from an azd env var, not from the positional argument. The var is
AGENT_{SERVICEKEY}_NAME, where SERVICEKEY = the azure.yaml service name
uppercased with -/spaces → _.
Example for service agent-framework-agent-basic-responses:
azd env set AGENT_AGENT_FRAMEWORK_AGENT_BASIC_RESPONSES_NAME agent-framework-agent-basic-responses
azd ai agent delete <service-name> --force --no-prompt --output json
# -> {"object":"agent.deleted","name":"...","deleted":true}(After a successful azd deploy, this var is set automatically, so later
show/delete/invoke work without setting it.)
Phase 3 — Deploy and validate
Reuse an existing ACR (avoid provisioning)
For an existing project + model, do not run azd provision/azd up — the
generated azure.yaml has a deployments block for the manifest's model
(often an auto-selected GlobalProvisionedManaged PTU SKU) that provision would
try to create (costly / quota failures). Instead reuse an ACR:
azd env set AZURE_CONTAINER_REGISTRY_ENDPOINT <acr-login-server> # e.g. myacr.azurecr.io
azd deployazd deploy fails with "could not determine container registry endpoint" if
this is unset and no ACR is provisioned.
Verify the deployed model env var, then invoke
azd ai agent show <agent-name> --output json # check definition.environment_variables.AZURE_AI_MODEL_DEPLOYMENT_NAME
azd ai agent invoke <agent-name> --new-session "My name is Tao. Remember it."
azd ai agent invoke <agent-name> "What is my name?"Use --output raw on invoke to see raw SSE events and any failure, e.g.:
event: response.failed
... "code": "DeploymentNotFound" ... 404 ...DeploymentNotFound means the deployed AZURE_AI_MODEL_DEPLOYMENT_NAME points
at a model that isn't deployed → fix per Gotcha 1 and redeploy (creates a new
version).
Pass: agent reaches status: active, invoke returns text (not empty, no
response.failed), and multi-turn recalls the name.
Cleanup (always)
- Delete the deployed agent:
azd ai agent delete <agent-name> --force --no-prompt. - Delete the temp
azdproject directory. - Remove
.env/.venvyou created in the sample dir; confirm the sample dir is pristine (git status --porcelain <dir>is empty —.env/.venvare gitignored). - Stop any leftover local server still holding port 8088:
Get-NetTCPConnection -LocalPort 8088 -State Listen→Stop-Process -Id <pid>(Linux/macOS:lsof -ti:8088 | xargs kill). Stopping the shell may leave the child interpreter running.
Gotchas (the parts that waste the most time)
- The deployed model name comes from
agent.yaml, not the azd env.azd ai agent initignores--model-deploymentin--no-promptmode and writes the manifest's model id (e.g.gpt-4.1-mini) as a literal into both the azd envAZURE_AI_MODEL_DEPLOYMENT_NAMEand the generatedsrc/<agent>/agent.yamlenv var. Local runs read the azd env (soazd env setfixes them), but deployment injectsagent.yaml's value. Fix by setting the generatedagent.yamlenv var to the templatevalue: ${AZURE_AI_MODEL_DEPLOYMENT_NAME}(what the repo sample already uses;initflattens it) andazd env set AZURE_AI_MODEL_DEPLOYMENT_NAME <real>, then redeploy. A literalvalue: <real-model>also works. azd ai agent delete/showneed theAGENT_{SERVICEKEY}_NAMEenv var — a bare positional agent name is treated as the service name and the deployed agent name is looked up from that env var (see "Removing a pre-existing agent").azd provision/azd upwill try to create the manifest's model deployment (fromazure.yaml'sdeploymentsblock). Preferazd deploywith a reused ACR when the project + model already exist.pythonon PATH is not required.uv venvandazd ai agent runprovision their own interpreter and installrequirements.txt.initcopies the whole manifest directory intosrc/. Remove a local.venvfrom the sample dir first to keep the copy clean/fast.- Port 8088 can stay bound after stopping the shell — kill the interpreter by PID (see Cleanup).
Success checklist
- Native local run: 200 + non-empty text + multi-turn recall.
azd ai agent runlocal: text returned + session reused across invokes.- Pre-existing agent removed (if any).
azd deploysucceeds; agentstatus: active.azd ai agent showconfirmsAZURE_AI_MODEL_DEPLOYMENT_NAME= the real deployed model.- Deployed invoke: text returned (no
response.failed) + multi-turn recall. - Cleanup done: agent deleted, temp project removed, sample dir pristine, port 8088 free.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

