You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Simplify foundry-hosted-agent-copilotkit skill and add plugin with Learn + Foundry MCP - #4349
Platform first: a table of Foundry-native primitives (conversations, durable approvals, background responses, Toolbox, Memory, session files, FoundryStateStore) to use instead of hand-rolled plumbing.
Default wiring is a small FastAPI gateway:FoundryAgent + the MAF AG-UI adapter does the Responses ↔ AG-UI translation. The gateway keeps no thread state: the UI creates a Foundry conversation and uses its conv_… ID as the AG-UI thread ID (use_service_session=True, service_session_id_from_thread_id=True).
HITL rewritten for CopilotKit v2:
Approvals use useInterrupt + resolve({ approved }).
Documents two interop issues found while testing (agent-framework-ag-ui 1.4.0 + CopilotKit 1.76 / @ag-ui/client 1.0.1) and a ~15-line gateway shim for them.
The old bridge workarounds are reduced to a short "older versions" note.
New plugin plugins/foundry-hosted-agent-copilotkit:plugin.json + README.md + mcp.json, bundling the skill with the Microsoft Learn MCP server (https://learn.microsoft.com/api/mcp) and the Foundry MCP server (https://mcp.ai.azure.com) for live grounding.
Uses a paid Azure service (Microsoft Foundry hosted agents); the skill says so up front.
Type of Contribution
New instruction file.
New prompt file.
New agent file.
New plugin.
New skill file.
New agentic workflow.
New canvas extension.
Update to existing instruction, prompt, agent, plugin, skill, workflow, or canvas extension.
Deployed a hosted agent to an existing Foundry project with azd ai agent init --no-prompt + azd deploy. It had a read-only tool and an approval-gated tool.
Ran the gateway and a Next.js + CopilotKit v2 UI exactly as documented.
Playwright (Chromium), 2/2 passing:
balance query works
approve runs the gated tool exactly once
follow-up turns don't re-run it
reject runs nothing
results still render after RUN_FINISHED
Restarting the gateway mid-approval fails safe: the tool doesn't run and the conversation stays usable. This is documented.
The skill's debugging curl snippet was run as written.
Rewrite the skill around Foundry-native primitives and the current
package lines (CopilotKit v2, @Ag-ui 1.x, agent-framework-ag-ui 1.4,
azd azure.yaml-only hosted agents), verified end to end against a
deployed Foundry hosted agent with Playwright.
- Consolidate 6 references into wiring.md, hitl.md, troubleshooting.md
- Default wiring: FoundryAgent + AG-UI adapter gateway that keeps no
thread state (Foundry conversation id is the AG-UI thread id)
- HITL via CopilotKit v2 useInterrupt; document two interop shims
- Drop obsolete workarounds for closed agent-framework issues
- Add foundry-hosted-agent-copilotkit plugin bundling the skill with
Microsoft Learn and Foundry MCP servers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Risk tier:merge-risk:high — Privileged execution, automation, or review-policy change Required to merge: passing submission-gate checks plus 2 approvals from reviewers with write access, including a maintainer with admin or maintain permission.
Why this tier
plugins/foundry-hosted-agent-copilotkit/mcp.json is a high-risk path (automation, scripts, MCP config, hooks, or review policy)
Declares an MCP server or hook command in plugins/foundry-hosted-agent-copilotkit/mcp.json
✓ [spec-compliance] All 1 skill(s) are spec-compliant.
ℹ️
✓ spec-compliance: All spec checks passed.
ℹ️
✓ [valid-refs] All file references across 1 skill(s) are valid.
ℹ️
✓ valid-refs: All file references resolve to existing files within the skill directory.
ℹ️
1 skill(s) linted, 1 passed
Full linter output
### Linting skills/foundry-hosted-agent-copilotkit
✅ foundry-hosted-agent-copilotkit (2/2 checks passed)
✓ [spec-compliance] All 1 skill(s) are spec-compliant.
✓ spec-compliance: All spec checks passed.
✓ [valid-refs] All file references across 1 skill(s) are valid.
✓ valid-refs: All file references resolve to existing files within the skill directory.
1 skill(s) linted, 1 passed
… ag-ui install
- hitl.md: render one card per open interrupt and resolve each by id;
document how parallel gated calls surface with agent-framework-ag-ui 1.4.0
- wiring.md/SKILL.md: a pre-effect watermark is at-most-once; exactly-once
needs a destination-enforced idempotency key or a single transaction
- wiring.md: install @ag-ui/client at the version the installed runtime pins
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The conversation route above returns HTTP 502 with an error body when Foundry fails, but fetch resolves for that response and this chain sets threadId to undefined. The page stays on “Starting conversation…” indefinitely; network and JSON failures are also uncaught. Check the response status, validate the conversation ID, and display a caught error instead of leaving the loading screen active.
The wiring.md page example now checks the /api/thread response status,
validates the conv_ id, and renders caught network/JSON/HTTP errors.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
In CopilotKit 1.76.0's useInterrupt, onRunStartedEvent clears the pending interrupt and its rendered element. Resuming therefore unmounts ApprovalCard and discards its decision state. Since the wiring example also hides confirm_changes, no Approved/Rejected card remains after the resumed run finishes, contrary to SKILL.md:135. Keep decisions outside the transient interrupt renderer and render a read-only approval history; verify that it remains visible after the final RUN_FINISHED.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
Safety-critical approval and recovery guidance warrants maintainer verification of the cross-package contracts despite the reported end-to-end testing.
- `@copilotkit/runtime` pins an exact `@ag-ui/client` version. Read it from the installed runtime with `npm view @copilotkit/runtime@<installed version> dependencies`, then install that exact version: `npm i @ag-ui/client@<pinned version>`.
- Keep all `@copilotkit/*` packages on one version.
Names must agree in three places: the runtime `agents` key, `agentId` on `CopilotChat`/`useAgent`, and the hosted agent name the gateway is given. Use one constant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
npm startand verified thatREADME.mdis up to date.mainbranch for this pull request.Description
Simplifies and updates the existing
foundry-hosted-agent-copilotkitskill (added in #2226) and packages it as a plugin.Why: much of the skill had gone stale:
agent.yaml(nowazure.yamlonly).@ag-ui/*as pre-1.0.What changed:
SKILL.md+references/wiring.md,hitl.md,troubleshooting.md), ~48 KB → ~43 KB.FoundryStateStore) to use instead of hand-rolled plumbing.FoundryAgent+ the MAF AG-UI adapter does the Responses ↔ AG-UI translation. The gateway keeps no thread state: the UI creates a Foundry conversation and uses itsconv_…ID as the AG-UI thread ID (use_service_session=True, service_session_id_from_thread_id=True).useInterrupt+resolve({ approved }).@ag-ui/client1.0.1) and a ~15-line gateway shim for them.plugins/foundry-hosted-agent-copilotkit:plugin.json+README.md+mcp.json, bundling the skill with the Microsoft Learn MCP server (https://learn.microsoft.com/api/mcp) and the Foundry MCP server (https://mcp.ai.azure.com) for live grounding.Uses a paid Azure service (Microsoft Foundry hosted agents); the skill says so up front.
Type of Contribution
Additional Notes
Validation (run locally):
npm run skill:validatefoundry-hosted-agent-copilotkit is validnpm run plugin:validatePlugin validation passed(101 plugins)npm run builddocs/README.skills.md,docs/README.plugins.md,.github/plugin/marketplace.jsonbash eng/fix-line-endings.shEnd-to-end verification of the guidance:
azd ai agent init --no-prompt+azd deploy. It had a read-only tool and an approval-gated tool.RUN_FINISHEDcurlsnippet was run as written.Package versions tested:
@copilotkit/*1.76.0,@ag-ui/client1.0.1, Next.js 16.3.8agent-framework-ag-ui1.4.0,agent-framework-core1.19.0,agent-framework-foundry1.13.1,agent-framework-foundry-hosting1.0.0b260918azure.ai.agents1.0.0-beta.18By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.