Generated banner for Foundry Agentic Loop
Generated logo for Foundry Agentic Loop

Foundry Agentic Loop

GitHubOfficialFirst committed by vieiraaeDistributed by GitHub

  • Skill
  • Workflow
  • Software development
  • MIT
  • Low risk
  • Has scripts

From the author

Build agentic solutions on Microsoft Foundry, GitHub and Azure: hosted agents, toolbox tools and skills, Foundry IQ grounding and a React/FastAPI app. Three modes: rapid prototyping in an existing Foundry project; spec-driven development (SDD), where the foundry-agentic-loop-workflow runs Specify, Implement, Verify and Deploy to create the Foundry project and deploy with azd, or one phase runs alone; and Improve, which refines this skill and the workflow from past runs. Use for Agentic Loop requests and canvas actions, or end-to-end agent solutions from architecture to Azure deployment. Not for isolated Azure administration or unrelated UI edits.
— the description by vieiraae

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

foundry-agentic-loop provides a structured framework for developing agentic applications. It supports two primary modes: rapid prototyping for existing projects and Spec-Driven Development (SDD) for new projects requiring full Azure deployment pipelines. The skill manages the lifecycle of agents, toolbox tools, Foundry IQ grounding, and web application components, ensuring consistent architecture, security, and observability across the development process.

What it does

  • Orchestrates end-to-end agentic solution development from architecture to Azure deployment.
  • Provides a Spec-Driven Development workflow covering Specify, Implement, Verify, and Deploy phases.
  • Supports rapid prototyping for existing Foundry projects.
  • Manages Foundry hosted agents, toolbox tools, and Foundry IQ grounding configurations.
  • Automates deployment of React/FastAPI applications to Azure Container Apps.
  • Enforces security best practices through managed identities and least-privilege RBAC.

When to use it

  • When building new agentic solutions on Microsoft Foundry that require a structured development lifecycle.
  • When you need to deploy agentic applications to Azure using standardized pipelines.
  • When prototyping agentic features within an existing Foundry project.
  • When you need to integrate Foundry IQ grounding or custom toolbox tools into an agent.

Advantages

  • Ensures architectural consistency through a contract-first development approach.
  • Automates complex deployment tasks using azd and Bicep infrastructure layers.
  • Provides built-in observability via OpenTelemetry and Application Insights integration.
  • Maintains project history and lessons learned to improve future development cycles.
  • Reduces manual configuration errors by enforcing standardized workspace structures.

Usage examples

“Start a new agentic project using the SDD workflow.”
The agent initializes the SDD workflow, creates the necessary project structure, and begins the Specify phase to define the project requirements.
“Deploy my current Foundry project to Azure.”
The agent validates the current configuration, runs the deployment pipeline, and reports the status of the Azure Container Apps deployment.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/github/foundry-agentic-loop/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip foundry-agentic-loop.zip -d .agents/skills

Documentation by vieiraae

Foundry Agentic Loop

Coordinate the solution and use microsoft-foundry for platform operations. Explicit user choices override defaults. Reuse known context, ask only for missing decisions, read only the references a step needs, and report decisions, blockers and endpoints concisely.

Bootstrap (once per session)

  1. Foundry skill. If microsoft-foundry is unavailable, ask, then install it (copilot plugin install azure@awesome-copilot, or gh skill install microsoft/azure-skills microsoft-foundry --agent github-copilot --scope project) and reload skills.

  2. Canvas and workflow. This plugin ships foundry-agentic-loop-canvas and foundry-agentic-loop-workflow, listed as foundry-agentic-loop:<name> or <name>. Call extensions_manage with operation: "list". Never install extensions from a URL and never edit Copilot settings files. If one is listed under neither name, tell the user which is missing and that it ships with the plugin, then ask before running copilot plugin install foundry-agentic-loop@awesome-copilot; after they approve, call extensions_reload once. If one is disabled, tell the user to re-enable it in their extension settings and continue in a new session: running sessions keep it disabled, even after a reload. If one failed, inspect it and report its log. Without the canvas, continue in Chat; without the workflow, SDD cannot start, so offer rapid prototyping.

  3. Canvas. When work starts from Chat, open it once: open_canvas with canvasId: "foundry-agentic-loop-canvas", instanceId: "foundry-agentic-loop" and input: { mode }. Prompts that begin [Agentic Loop canvas action] come from the canvas; follow their target, approval and resume instructions literally.

Choose the mode

SignalMode
Root AGENTS.md has an Agentic Loop sectionIts mode. Switch only when the user confirms, then rewrite the section
Canvas prompt or explicit choiceAs stated
Existing Foundry project selected or named; fast prototype; no deployment pipeline neededRapid prototyping: rapid.md
Spec, new Foundry project, azd or IaC, CI-ready repo or full Azure deploymentSDD: sdd.md
Improve, learn from runs, or the canvas improve promptImprove: improve.md; measure changes with node scripts/evals.mjs (index, then run --base <commit>; exit 2 means evals are unavailable, so stop)
One named SDD phase, with no run activeIts guide (Specify, Implement, Verify or Deploy) with the SDD defaults

Otherwise ask once with the choices "Rapid prototyping (existing Foundry project)" and "SDD (new project, deployed with azd)".

Lock it in. Before any other workspace write (in the rapid preflight, or just before the SDD workflow starts), upsert the section from agents-md-rapid.md or agents-md-sdd.md into the root AGENTS.md: replace everything between its foundry-agentic-loop begin and end markers, or append it, keeping other content; then read it back. The section routes short commands such as deploy and locks the mode for Chat, the canvas and the workflow. Azure settings go only in .azure/deployment-plan.md, never in AGENTS.md. Improve mode never writes it.

Defaults

  • Agents: Foundry hosted agents exposing the Responses API, Python 3.13, code deployment. Create them through microsoft-foundry's foundry-agent/create/quick-start-hosted.md with the Basic sample, resolved through that skill, never a guessed URL. Use its advanced workflow only when quick-start cannot support a capability, keeping these defaults. Prompt agents only when requested.

  • Framework: the Copilot SDK for agents that use runtime skills (recipe, reference agent); Microsoft Agent Framework for basic agents and explicit workflows. If a workflow also needs skills, clarify. One framework per agent.

  • Models: rapid keeps the Basic sample's model deployment, or verifies and reuses a supplied one; SDD defaults to gpt-5.4-mini unless the spec needs otherwise. Run the joint placement preflight in foundry-models.md before creating resources. Never hard-code a replacement or silently duplicate a deployment.

  • Tools and knowledge: one governed Foundry toolbox for built-in tools, MCP connections and agent skills; agents use its endpoint, not hard-coded tool URLs. Private knowledge uses Foundry IQ through the toolbox, with citations for supported claims and a deterministic insufficient-evidence response; test both. Add Search only when needed. Reuse run skills the user names from the run catalog instead of regenerating them.

  • App: React + Vite, FastAPI and FastMCP (streamable HTTP) on Azure Container Apps. Rapid deploys with az containerapp up --name <app> --source <dir> --resource-group <rg> --environment <env>; SDD uses azd with a microsoft.foundry layer plus a Bicep (AVM) app layer, remoteBuild: true and one ACR pulled by managed identity. Add services from the reference architecture only when the solution needs them.

  • App access: decide it from the data. When everything the app shows is sample, synthetic or deliberately public, default to no end-user sign-in, even for staff users; services still authenticate with managed identities and need no anonymous-session or identity-verification workarounds. When it shows private, sensitive or user-specific data, ask for the access model before deploying and default to internal ingress or Entra sign-in; anonymous access needs explicit approval. With sign-in, the API pre-authorizes the SPA, the spec states how automated browser tests get a user token, and Implement proves that token path as soon as the app registrations exist.

  • Identity and safety: managed identities and least-privilege keyless RBAC (contract; preflight with check_rbac_preflight.py). Check management-plane, data-plane and role-assignment rights separately; subscription Owner does not grant Foundry data-plane roles. Plan roles for identities not yet created and verify actual principals after creation. No credentials in browser code or Git; Foundry guardrails on.

  • Observability: OpenTelemetry from the backend, agents, MCP servers and model calls into one Application Insights connected to the project (observability.md). Sensitive content capture stays off unless approved with redaction and retention controls.

Workspace files

FileHolds
AGENTS.md (root)The mode lock and short-command routes; never Azure settings
README.md (rapid) or docs/spec.md (SDD, from the spec template)The contract
.azure/deployment-plan.mdEvery Azure setting, in both modes (template)
.env (Git-ignored)What the canvas reads: FOUNDRY_PROJECT (full ARM ID, once validated or created), LOCAL_FRONTEND and DEPLOYED_FRONTEND (verified URLs only). Upsert, keep other keys and read back
docs/LOOP.mdLessons (template)
.agentic-loop/runs/<runId>.jsonSDD flight records, written by the workflow
.devcontainer/devcontainer.jsonOptional dev container (asset)

Working rules

  • Contract first. Freeze service names, environment variables, protocols, endpoints, schemas, auth, streaming, errors and versions (implementation-contract.md) before parallel work.

  • Integration first. Pass the hosted integration checkpoint with a minimal agent before building full orchestration, UI or backend: always a model request, plus a toolbox skill load and a safe MCP call only when the architecture needs them. Record excluded capabilities as N/A with the reason, never as passed, and never add unused ones to satisfy the checkpoint.

  • Evidence, not signals. HTTP 200, exit 0 or active never pass alone; require terminal completion, schema-valid output, execution evidence and correlated traces. Fix with bounded diagnostics, not unchanged redeployments.

  • Wait by completion. Provisioning, deployments, role-assignment propagation and agent readiness end when their command or status check says so: run the command synchronously with a long initial wait, or poll its status every 30-60 s against a stated deadline. Never chain fixed sleeps; keep coding while Azure works.

  • Subagents. Before the checkpoint, parallelize only research and preflight. After it, give each worker a bounded goal, exclusive workspace-relative files or folders, skill references, verified context, the contract, acceptance checks and stop conditions. One owner (the coordinator, or the SDD phase lead) holds the contract and the shared files: azure.yaml, infra/, docs/, .env, .azure/, .agentic-loop/, AGENTS.md and the root lockfiles. Keep teams small, avoid recursive delegation, serialize shared Azure mutations and integrate centrally; worker success is not acceptance. Delegation grants no extra approval. Without subagents, work sequentially and say so.

  • Safety. Reuse resources; confirm billable, security or compliance changes; delete without approval only a resource this build created whose provisioning failed; never sign in for the user; never report an unverified deployment as successful.

  • Workspace boundary. Builds stay inside the workspace: read lessons only from its own docs/LOOP.md, scaffold from the Foundry samples and these references, and use code from other folders only when the user names them. Only improve mode reads past runs elsewhere.

  • Work IQ context. Only when the user or a canvas prompt asks for it, query the workiq MCP server before clarifying questions, fold in only the requirements that matter, cite each by source type and confirm them. Never copy confidential content, personal data or secrets into the workspace; if Work IQ is unavailable or needs consent, say so and continue without it.

  • Companions and SDKs. Verify installed SDK APIs against the latest stable release (or the newest stable one the build's package index serves, recording the gap) and lock versions before generating code; package sources beat stale guidance. Consult the build catalog only for needed capabilities; respect pins, ask before installs and route third-party skill defects upstream.

Lessons

Right after a fix is verified (the failing probe or an equivalent boundary check reruns successfully; an edit, commit or deployment alone is not resolution), upsert a lesson in the workspace's docs/LOOP.md from the template before unrelated work, then read it back. Keep user notes, update matching lessons instead of duplicating them, and never include secrets, raw .env values or payloads. The coordinator, or the SDD phase lead, owns writes; workers report evidence. Lessons never authorize skill edits or weaker gates; improve mode applies them with approval.

Files

references/sdd.md

Spec-driven development (SDD)

SDD turns a brief into a deployed, reproducible solution: a new Foundry project and Azure resources provisioned with azd and Bicep (AVM), keyless and monitored. The foundry-agentic-loop-workflow dynamic workflow runs four phases in sequence. Each phase runs in fresh-context subagents, follows its phase guide, must pass an evidence gate and leaves durable artifacts:

PhaseGuideGate evidenceArtifacts
Specifyspecify.mdIndependent review of EARS criteria, contract, workstreams, verification mapping, placement and RBAC verdictdocs/spec.md, .azure/deployment-plan.md
Implementimplement.mdazd provision, hosted checkpoint, parallel workstreams integrated, builds and unit testsdocs/implementation.md
Verifyverify.mdLocal E2E and contract tests, independent spec-conformance review, agent evaluationsdocs/verify.md
Deploydeploy.mdazd up, health checks, deployed smoke and E2E testsdocs/deploy.md

In each phase a lead does the work, a fresh-context reviewer reruns the checks, and fixers get up to maxFixLoops rounds. Only the reviewer's verdict passes a gate. Implement runs disjoint workstreams in parallel.

Phases reconcile existing artifacts instead of starting over, so reruns are safe. Lessons go to docs/LOOP.md. Each run writes a flight record to .agentic-loop/runs/<runId>.json, with status running, awaiting-approval, blocked, deployed, verified (or specified/implemented when to ends it early) or error, saved at the start, at the first step after a resume, at each gate and checkpoint, and at the end. A record that cannot be written pauses the run at blocked-record-<step>. One run is active per workspace: .agentic-loop/active-run.json holds its lease, and a second run refuses to start while that lease is under 30 minutes old.

Start a run

  1. Check for a run. List runs with dynamic_workflows_manage (runs) and match them to this workspace's .agentic-loop/runs/ records. If one is running or paused, report it and offer to resume it instead of starting a second run.

  2. Preflight in Chat (read-only): az account show, azd auth login --check-status, azd ai agent --help (azd Foundry extension), microsoft-foundry and the bootstrap. Report all gaps at once, and ask before installing or upgrading tools.

  3. Clarify once. Ask, with choices, only the questions whose answers change the spec: users, data, tools, UX or compliance. Take the subscription, region and azd environment from the canvas prompt. Otherwise confirm the current az default subscription, leave the region to Specify's placement check, and derive a short environment name such as claims-triage-dev.

  4. Lock the mode. Upsert the SDD section of the root AGENTS.md (lock-in). The workflow also writes it and refuses a workspace locked to rapid prototyping.

  5. Start with run_dynamic_workflow, name: "foundry-agentic-loop-workflow", and these args:

    ArgPurpose
    briefRequired. Self-contained, with the user's answers and decisions
    subscriptionId, location, environmentNameAzure target when known
    scenarioIdCanvas prompt template
    autonomygated (default) pauses for spec approval; auto skips it
    maxFixLoopsFix rounds per phase gate, 0–5 (default 2)
    skipDeployStop after Verify
    fromRerun from this phase; refused unless the latest record passed every earlier phase
    toLast phase to run (default Deploy); from and to set to one phase run it alone

    Pass limits only when the user sets them; defaults are 250 subagents, 4 concurrent and 12 hours of active time.

  6. Report the run ID and the checkpoints ahead. The run continues in the background, posting phase and gate lines in Chat; the Foundry Agentic Loop canvas Build tab shows live agents. No input is needed until a checkpoint. Do not poll; the run notifies when it pauses or ends.

Checkpoints and recovery

Live status first. For status, approve, resume or deploy requests, read the run with dynamic_workflows_manage (runs, then inspect-run) before its flight record. The run status is authoritative: a cancelled run keeps its last saved record status.

A pause posts a Needs you: line. Answer it in one message: what paused and why, the files to review, then the options as ask_user choices (approve or resume, change or fix first, leave paused).

PauseMeaningChat action on request
approve-spec-v1Spec ready for reviewSummarize scope, assumptions, region and cost drivers; apply requested edits to the artifacts
approve-spec-r<n>-v1The spec or plan changed since spec approval, before Implement round nSummarize what changed; approving records the new fingerprint
approve-deploy-v1Verified and ready to deploy (always pauses)Summarize resources, cost, security and region impact; apply requested edits without deploying
approve-deploy-r<n>-v1, approve-deploy-r<n>-a<k>-v1The deployment plan, spec, verify report or azd target changed since deploy approval, before round n or after its attempt kSummarize what changed; approving records the new fingerprint
blocked-record-<step>The flight record could not be writtenFix the path or permission shown, then resume
blocked-<phase>-r<n>A gate failed after its fix rounds, a subagent ended twice without a report (usually a provider error), or a decision is needed (permissions, quota, cost, security)List every issue from that phase and round in the flight record's phases, not just the first from the log. Fix and verify each root cause in the artifacts, record the evidence and docs/LOOP.md lessons. Resuming starts round n+1, which continues from the current state; its review first confirms these issues are resolved. To accept an issue instead, only on the user's explicit decision, write [{"issue": "<exact issue>", "reason": "..."}] to .agentic-loop/waivers/<runId>.json before resuming. After round 20, start a new run or rerun that phase alone with from and to.
  • Resume with run_dynamic_workflow and resumeFromRunId only when the user asks. When a canvas prompt says "Do not resume the run", don't: the canvas resumes it.

  • Liveness. Workflow subagents don't appear in list_agents or read_agent, and one Implement step can run for over an hour without a record change. The canvas Build tab shows live subagent activity. Never cancel, pause or restart a run to unstick it; only the user decides that.

  • Provider errors. A subagent that ends without a report is retried once with instructions to continue from the current state; a second miss blocks the phase, except for a workstream worker, which integration finishes. Check the session log, then resume.

  • Effort. Subagents inherit the session's model and reasoning effort. Prefer medium or high: maximum effort multiplies step time.

  • A run that ends in error with workflow_limit_reached resumes with only that limit raised, after approval. For other errors, read the run with dynamic_workflows_manage (inspect-run), fix the cause and start a new run.

  • Never weaken a gate, skip a phase or report unverified checks as passed.

  • For a single named phase, start the workflow with from and to both set to it; from alone also runs every later phase. Without the workflow, follow the phase guides yourself in order, checking each gate and pausing at the same approvals: ask before azd provision, azd deploy or azd up.

SDD defaults

  • Placement: a new resource group in the chosen subscription. Model gpt-5.4-mini unless the spec needs otherwise. Preferred region eastus2 (swedencentral for EU data residency) unless the user chose one. The joint placement check decides before AZURE_LOCATION is persisted; record the preferred and deployed regions in the deployment plan.

  • Naming: azd environment <solution>-<stage> in at most 20 characters; resource group rg-<environment>, set with azd env set AZURE_RESOURCE_GROUP right after scaffolding to replace the salted default. Check az group exists and add a short suffix on collision.

  • Skills first: reusable agent behavior goes into Foundry skills authored at skills/<name>/SKILL.md and declared as host: azure.ai.skill services, so azd deploy versions them. Agents load them from the toolbox at runtime, so the image never copies skills/. Agents that use skills run on the Copilot SDK; basic agents and graph workflows use MAF.

  • Toolbox: one host: azure.ai.toolbox service carries the skills, MCP tools (each through a host: azure.ai.connection service) and grounding. Agents list it in uses and map its TOOLBOX_<NAME>_MCP_ENDPOINT to TOOLBOX_ENDPOINT (toolbox guide). Older azd extensions without upgrade approval fall back to ordered postprovision hooks.

  • Infra: scaffold the Basic sample with azd ai agent init . in an empty .scaffold folder, then move it into place (scaffold); never azd init -t <template> followed by agent init (it rewrites the provider). azure.yaml then uses two infra.layers: foundry (provider: microsoft.foundry: account, project and the model deployments in services.ai-project) and app (Bicep with AVM, dependsOn: [foundry]) for user-assigned identities, Log Analytics and Application Insights connected to the project, one ACR pulled by managed identity, the Container Apps environment and apps, and every RBAC row. Agents use host: azure.ai.agent; MCP servers, backend and frontend use host: containerapp with docker.remoteBuild: true. Cosmos DB for NoSQL only when state is needed. No private networking unless required. Layout: azd-layout.md.

  • Identity: user-assigned managed identities. Bicep creates the RBAC contract rows at provision; an idempotent postdeploy hook creates the runtime instance rows and the MCP Easy Auth allow-lists. The RBAC preflight runs in Specify; BLOCKED stops the run and hands the owner a ready-to-run grant block.

  • Repository: .gitignore covers .azure/* with !.azure/deployment-plan.md, .env and build output. Python dependencies follow the dependency contract and are locked with uv.lock or pinned requirements. .gitattributes sets * text=auto eol=lf.

  • Evaluations: Verify always runs a small agent evaluation on spec scenarios (task adherence, intent resolution, and groundedness when grounded); content safety comes from Foundry guardrails. Add recurring or CI evaluations only on request.

Teardown

Only on request and with explicit approval for the named environment and subscription: run azd down --purge --force from the workspace. It deletes the resource group and purges soft-deleted Foundry resources. Entra app registrations live outside the resource group: with the same approval, delete those recorded in docs/implementation.md with az ad app delete --id <appId>.

Requirements and compatibility

Written for: GitHub Copilot

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs an MCP server, Needs Python, Needs Node.js

Security

What our scanner noticed· Low risk

  • Instructions that use the network
  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

First committed by
GitHub avatar of vieiraaevieiraae
Publisher
GitHub (Official)
Distributed by
GitHub
Source
github/awesome-copilot · skills/foundry-agentic-loop · commit 797337f
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Contributors
vieiraae

AutoGineer is not affiliated with or endorsed by vieiraae or GitHub.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download foundry-agentic-loop.zip