agentleFS
MicrosoftKnown publishermicrosoft-foundry/foundry-samples/samples/python/autopilot-agents/hello-world/AGENTS.md

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.…

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
  1. Very specific:

    Keep FOUNDRY_AGENT365_TRACING_ENABLED=true for hosted Agent 365 export and OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=false to …

    line 29
  2. Very specific:

    Do not commit .vscode launch or task files generated by the Foundry Toolkit.

    line 53
  3. Very specific:

    Keep requirements.txt fully resolved with exact direct and transitive dependency pins.

    line 57
  4. Distinctive:

    Keep the sample README self-contained, including common setup commands and permissions.

    line 62
  5. Very specific:

    Use azd provision to configure the project and model, then azd deploy to deploy the code.

    line 66
  6. Distinctive:

    Keep infrastructure and provisioning scripts excluded from the agent package.

    line 78

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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.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. Do not use the older Bot Framework /api/messages route; the hosted sandbox will return 404.
  • AgentServer host: ActivityAgentServerHost builds the M365 stack with digital_worker=True and default storage. Register Teams handlers on host.agent_app; do not recreate the HTTP routes or connection configuration.
  • Guided provisioning: azd provision runs an interactive preprovision hook to select existing resources or create missing ones with Bicep. It saves AZURE_SUBSCRIPTION_ID, AZURE_LOCATION, AZURE_AI_PROJECT_ID, FOUNDRY_PROJECT_ENDPOINT, and AZURE_AI_MODEL_DEPLOYMENT_NAME for 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 publish using sample-specific metadata from azure.yaml.
  • AgentServer owns OpenTelemetry initialization and exporter configuration. Keep FOUNDRY_AGENT365_TRACING_ENABLED=true for hosted Agent 365 export and OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=false to 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 metadata
  • scripts/prepare-provision.ps1 - in-project hook wrapper required by azd
  • ../scripts/prepare-provision.ps1 - shared resource selection and preprovision settings
  • infra/main.bicep - resource-group orchestration and deployment outputs
  • infra/modules/foundry.bicep - conditional Foundry resources
  • main.py - direct code deployment entry point
  • agent/app.py - Teams handlers, Foundry model call, and server setup
  • agent/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 code
  • requirements.txt - Python runtime dependencies
  • README.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-foundry

References

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.