foundry-samples / hello-world
AGENTS.md476 starsChanged 3 months agoMITView on GitHub
This sample is a Microsoft Foundry hosted agent that uses the M365 Agents SDK and the Activity protocol to respond to Microsoft Teams messages with a Foundry model. It runs in Foundry Agent Service, which manages hosting, security, scaling, and observability. - Direct code deployment: azure.yaml declares the Python runtime and main.py entry point. azd deploy packages and deploys the agent without a Dockerfile or Azure Container Registry. - Activity ingress: hosted Activity protocol traffic is forwarded to POST /activity/messages.…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository294 other files it gives its agents.
- samples/cli/prompt-agents/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/a2a/01-delegation/caller/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/a2a/01-delegation/executor/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/agent-skills/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/azure-search-rag/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/browser-automation/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/egress-control/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/file-tools/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/foundry-memory-rag/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/foundry-toolbox-mcp-skills/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/foundry-toolbox-server-side/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/harness-data-processing/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/harness-research/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/harness-scaling-capabilities/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/hello-world/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/invocations-echo-agent/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/local-tools/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/mcp-tools/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/observability/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/resilient-workflow/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/simple-agent/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/steerable-workflow/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/steering/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/teams-activity/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/text-search-rag/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/toolbox-auth-paths/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/agent-framework/workflows/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/bring-your-own/invocations/HelloWorld/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/bring-your-own/invocations/human-in-the-loop/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/bring-your-own/invocations/notetaking-agent/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/bring-your-own/invocations_ws/HelloWorld/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/bring-your-own/responses/background-agent/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/bring-your-own/responses/browser-automation/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/bring-your-own/responses/env-vars-agent/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/bring-your-own/responses/HelloWorld/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/bring-your-own/responses/notetaking-agent/AGENTS.mdAGENTS.md
- samples/csharp/hosted-agents/bring-your-own/responses/openai-computer-tool/AGENTS.mdAGENTS.md
- samples/python/autopilot-agents/foundry-toolbox/AGENTS.mdAGENTS.md
- samples/python/autopilot-agents/meeting-assistant/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/a2a/01-delegation/caller/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/a2a/01-delegation/executor/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/invocations/01-basic/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/invocations/02-content-safety-guardrail/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/01-basic/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/02-tools/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/04-foundry-toolbox/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/05-workflows/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/06-files/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/07-skills/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/07-teams-activity/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/08-observability/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/09-declarative-customer-support/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/10-downstream-azure/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/11-azure-search-rag/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/12-foundry-skills/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/13-foundry-memory/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/14-browser-automation-agent/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/15-optimization-travel-approver/AGENTS.mdAGENTS.md
- samples/python/hosted-agents/agent-framework/responses/16-content-safety-guardrail/AGENTS.mdAGENTS.md
- The first 60 shown.
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Keep FOUNDRY_AGENT365_TRACING_ENABLED=true for hosted Agent 365 export and OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=false to …
- Very specific: line 53
Do not commit .vscode launch or task files generated by the Foundry Toolkit.
- Very specific: line 57
Keep requirements.txt fully resolved with exact direct and transitive dependency pins.
- Distinctive: line 62
Keep the sample README self-contained, including common setup commands and permissions.
- Very specific: line 66
Use azd provision to configure the project and model, then azd deploy to deploy the code.
- Distinctive: line 78
Keep infrastructure and provisioning scripts excluded from the agent package.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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
Coding Agent Instructions - Hello World
This sample is a Microsoft Foundry hosted agent that uses the M365 Agents SDK and the Activity protocol to respond to Microsoft Teams messages with a Foundry model. It runs in Foundry Agent Service, which manages hosting, security, scaling, and observability.
Deployment mode
- Direct code deployment:
azure.yamldeclares the Python runtime andmain.pyentry point.azd deploypackages and deploys the agent without a Dockerfile or Azure Container Registry. - Activity ingress: hosted Activity protocol traffic is forwarded to
POST /activity/messages. Do not use the older Bot Framework/api/messagesroute; the hosted sandbox will return 404. - AgentServer host:
ActivityAgentServerHostbuilds the M365 stack withdigital_worker=Trueand default storage. Register Teams handlers onhost.agent_app; do not recreate the HTTP routes or connection configuration. - Guided provisioning:
azd provisionruns an interactive preprovision hook to select existing resources or create missing ones with Bicep. It savesAZURE_SUBSCRIPTION_ID,AZURE_LOCATION,AZURE_AI_PROJECT_ID,FOUNDRY_PROJECT_ENDPOINT, andAZURE_AI_MODEL_DEPLOYMENT_NAMEfor deployment. Reused resources retain their configuration. Provisioning must not inspect or manage role assignments or add an extra confirmation after resource selection. Required resource access is an administrator prerequisite. - Microsoft 365 publication is an explicit, separate action performed with
azd ai agent publishusing sample-specific metadata fromazure.yaml. - AgentServer owns OpenTelemetry initialization and exporter configuration.
Keep
FOUNDRY_AGENT365_TRACING_ENABLED=truefor hosted Agent 365 export andOTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=falseto preserve the sensitive-data instrumentation opt-out. Do not add custom telemetry middleware or initialize exporters separately; surface telemetry gaps to the SDK team rather than compensating in the sample. Disable only the unused OpenAI Agents SDK instrumentation.
Key files
azure.yaml- hosted-agent service, direct code deployment, and publication metadatascripts/prepare-provision.ps1- in-project hook wrapper required by azd../scripts/prepare-provision.ps1- shared resource selection and preprovision settingsinfra/main.bicep- resource-group orchestration and deployment outputsinfra/modules/foundry.bicep- conditional Foundry resourcesmain.py- direct code deployment entry pointagent/app.py- Teams handlers, Foundry model call, and server setupagent/activity_routing.py- selectors for supported Teams conversations../README.md- sample index and shared utility links../scripts/stop-agent-sessions.ps1- stops active hosted-agent sessions after deploying updated coderequirements.txt- Python runtime dependenciesREADME.md- self-contained setup, deployment, publication, approval, and instance-creation walkthrough
Do not commit .vscode launch or task files generated by the Foundry Toolkit.
Dependency workflow
Keep requirements.txt fully resolved with exact direct and transitive
dependency pins.
Development workflow
Keep the sample README self-contained, including common setup commands and permissions. Do not require readers to alternate between it and the parent README to complete the getting-started workflow.
Use azd provision to configure the project and model, then azd deploy to
deploy the code. On code-only iterations, run azd deploy without reprovisioning.
The environment must identify the project with both AZURE_AI_PROJECT_ID and
FOUNDRY_PROJECT_ENDPOINT, and code deployment also requires its region in
AZURE_LOCATION. Neither project identifier can currently be
substituted into an azure.ai.project.endpoint field because the project
provider reads that field before azd environment expansion. Keep Microsoft 365
publication as a separate azd ai agent publish invocation; deploying code
must not automatically publish a new Microsoft 365 app version.
Provisioning must preserve reused resources, resolve their actual region, and fail on discovery errors rather than treating failed queries as empty lists. Keep infrastructure and provisioning scripts excluded from the agent package.
Microsoft Foundry Skill
Install the Microsoft Foundry Skill for guided deployment, evaluation, and troubleshooting workflows:
npx skills add https://github.com/microsoft/azure-skills --skill microsoft-foundryReferences
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.

