Skill 180 · Foundry Agentic Loop
Subchapter 180.12
references/implement.mdMarkdown6 KBView on GitHub
Build what docs/spec.md specifies on the target in .azure/deployment-plan.md. Apply the skill defaults and use microsoft-foundry for platform operations. Reconcile existing code and infra; never re-scaffold over work.
Run azd from the workspace root, with AZURE_DEV_USER_AGENT=microsoft_foundry_skill inline on each azd command.
Skip any step whose result already exists.
manifestUrl from azd ai agent sample list --language python --output json (the recommended Basic entry).azd ai agent init . with --no-prompt in an empty .scaffold folder, then move it into place. Never run azd init -t first: agent init would rewrite the provider and nest the project.<agent>, point its project at src/agents/<agent>, and set the top-level name to the solution. For each further agent, copy a working agent folder to src/agents/<name> and run azd ai agent init --src ./src/agents/<name> --agent-name <name> --no-prompt --deploy-mode code --runtime python_3_13 --entry-point main.py.azd env set each deployment-plan variable, one per command, with AZURE_RESOURCE_GROUP first. Read them back with azd env get-values.azure.yaml:
services.ai-project.deployments[] is not empty.{{…}}.entryPoint exists.-2 agent service.Lay out azure.yaml, infra/foundry and infra/app exactly as in azd-layout.md:
remoteBuild.postdeploy hook for the runtime instance rows and MCP allow-lists (grants after deploy).Validate with az bicep build --file infra/app/main.bicep. Then run azd provision --no-prompt. Outside a workflow run, whose spec approval covers it, ask first, naming the checkpoint services this phase also deploys. Record the actual regions and resource groups, including the Foundry provider’s group (azd env get-value AZURE_FOUNDRY_RESOURCE_GROUP), in the plan’s Region, Resource groups and Environment variables rows, and any fallback with its reason in the plan and docs/spec.md, before continuing. Upsert FOUNDRY_PROJECT (the AZURE_AI_PROJECT_ID value) into the root .env. For Copilot SDK agents, discover the model account’s /openai/v1/ base and azd env set MODEL_API_BASE_URL <url> (endpoint contract).
docs/spec.md. Contract changes go to the spec first.N/A.
azd ai agent run --no-client, in the background, and azd ai agent invoke --local "<probe>". AgenticIdentityToken tool calls work only hosted.azd deploy <service> for the MCP server, skill, connection, toolbox and agent services, in uses order.azd ai agent invoke <agent> "<probe>".azure.yaml, infra/, docs/, .env, .azure/, .agentic-loop/, AGENTS.md and the root lockfiles. After the workers finish, the workflow diffs git status against its pre-fan-out snapshot and hands any changed path outside the workstreams to integration as an issue.uv.lock or pinned versions).Deployments. Implement deploys only the checkpoint services (MCP servers, skills, connections, toolbox and agents); the frontend, backend and workers run locally until Deploy. Reproduce agent defects locally first (azd ai agent run with invoke --local), and redeploy a hosted agent only for hosted-only behavior, once per verified fix. Redeploy only services whose source or configuration changed since their last verified deployment. After a transient postdeploy failure, rerun only the hook with azd hooks run postdeploy.
Agent code follows these references:
microsoft-agent-frameworkWrite docs/implementation.md with:
Add microsoft-foundry’s AGENTS.md marker (its quick-start Step 6) if missing, outside the foundry-agentic-loop markers.
Pass only when:
azd ai agent show) with scope https://ai.azure.com/.default.Report: status, summary, artifacts, assumptions, issues and lessons.