Skip to content

Simplify foundry-hosted-agent-copilotkit skill and add plugin with Learn + Foundry MCP - #4349

Merged
aaronpowell merged 4 commits into
github:mainfrom
lordlinus:skill-foundry-copilotkit-simplify
Oct 7, 2026
Merged

aaronpowell merged 4 commits into
github:mainfrom
lordlinus:skill-foundry-copilotkit-simplify

Conversation

@lordlinus

@lordlinus lordlinus commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request Checklist

  • I have read and followed the CONTRIBUTING.md guidelines.
  • I have read and followed the Guidance for submissions involving paid services.
  • My contribution adds a new instruction, prompt, agent, skill, workflow, or canvas extension file in the correct directory.
  • The file follows the required naming convention.
  • The content is clearly structured and follows the example format.
  • I have tested my instructions, prompt, agent, skill, workflow, or canvas extension with GitHub Copilot.
  • I have run npm start and verified that README.md is up to date.
  • I am targeting the main branch for this pull request.

Description

Simplifies and updates the existing foundry-hosted-agent-copilotkit skill (added in #2226) and packages it as a plugin.

Why: much of the skill had gone stale:

  • The HITL workarounds it centred on target agent-framework issues that are now closed (#6652, #6851, #6828).
  • It still described hosted agents with agent.yaml (now azure.yaml only).
  • It used CopilotKit v1 APIs and treated @ag-ui/* as pre-1.0.

What changed:

  • Smaller, restructured skill: 7 files → 4 (SKILL.md + references/wiring.md, hitl.md, troubleshooting.md), ~48 KB → ~43 KB.
  • 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.
  • Other (please specify):

Additional Notes

Validation (run locally):

Command Result
npm run skill:validate ✅ foundry-hosted-agent-copilotkit is valid
npm run plugin:validate ✅ Plugin validation passed (101 plugins)
npm run build ✅ regenerated docs/README.skills.md, docs/README.plugins.md, .github/plugin/marketplace.json
bash eng/fix-line-endings.sh ✅ run

End-to-end verification of the guidance:

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

Package versions tested:

  • @copilotkit/* 1.76.0, @ag-ui/client 1.0.1, Next.js 16.3.8
  • agent-framework-ag-ui 1.4.0, agent-framework-core 1.19.0, agent-framework-foundry 1.13.1, agent-framework-foundry-hosting 1.0.0b260918
  • azd 1.35.0 with azure.ai.agents 1.0.0-beta.18

By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.

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>
@github-actions github-actions Bot added plugin PR touches plugins skills PR touches skills labels Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🔒 PR Risk Scan Results

Scanned 8 changed file(s).

Severity Count
🔴 High 0
🟠 Medium 2
ℹ️ Info 0
Severity Rule File Line Match
🟠 package-exec-command .github/plugin/marketplace.json 994 "description": "Windows-only Excel automation plugin that runs the latest excelcli package through npx.",
🟠 package-exec-command .github/plugin/marketplace.json 1025 "description": "Windows-only Excel automation plugin that runs the latest ExcelMcp MCP server through npx.",

This is an automated soft-gate report. Findings indicate review targets and do not block merge by themselves.

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🚦 Submission status: 💬 Review in progress

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

Automated checks

Check Status Details
Line endings ✅ Passed Passed · logs
Spelling ✅ Passed Passed · logs
Generated README consistency ✅ Passed Passed · logs
Plugin and extension validation ✅ Passed Passed · logs
Plugin structure ✅ Passed Passed · logs
Skill validation ✅ Passed Passed · logs
Skill lint (vally) ✅ Passed Passed · logs
Risk scan ✅ Passed Passed · logs
Contributor reputation ✅ Passed Passed · logs
Duplicate resource scan ⏳ Pending (advisory, non-blocking) Running · logs
PR quality signal ⏭️ Skipped Skipped by its workflow · logs
Canvas/plugin smoke test ✅ Passed Passed · logs

Review

  • Approvals: 1/2 (aaronpowell)
  • Assigned reviewer: not assigned yet — comment /request-review to ask for one
  • Review target date: not set
  • Still needed: 1 more approval(s)
  • The core-maintainers pool is not staffed yet; an approver with admin or maintain permission is required instead.

Commands

Command Who What it does
/rerun-checks PR author, maintainers Re-runs failed or incomplete checks and re-evaluates this gate
/request-review PR author, maintainers Asks the review rotation to assign a reviewer (adds needs-reviewer)

Updated for b72978e · gate run · This comment is maintained automatically — see submission gate docs.

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🔍 Vally Lint Results

✅ All checks passed

Scope Checked
Skills 1
Agents 0
Total 1
Severity Count
❌ Errors 0
⚠️ Warnings 0
ℹ️ Advisories 0

Summary

Level Finding
ℹ️ ✅ 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
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

@lordlinus
lordlinus marked this pull request as ready for review October 2, 2026 09:49
@lordlinus
lordlinus requested review from a team as code owners October 2, 2026 09:49
Copilot AI balanced review requested due to automatic review settings October 2, 2026 09:49
@github-actions github-actions Bot added ready-for-review Submission passed intake validation and is ready for maintainer review and removed awaiting-automation labels Oct 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The documented approval and recovery paths still have correctness gaps.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Updates the Foundry hosted-agent skill with simpler CopilotKit v2 guidance and packages it as an installable plugin.

Changes:

  • Consolidates wiring, approval, deployment, and troubleshooting guidance.
  • Adds a plugin bundling the skill with Microsoft Learn and Foundry MCP servers.
  • Refreshes generated catalogs and marketplace metadata.
File Description
skills/​foundry-hosted-agent-copilotkit/​SKILL.md Updates workflow and platform guidance.
skills/​foundry-hosted-agent-copilotkit/​references/​wiring.md Adds consolidated integration examples.
skills/​foundry-hosted-agent-copilotkit/​references/​upgrading.md Removes superseded upgrade reference.
skills/​foundry-hosted-agent-copilotkit/​references/​troubleshooting.md Updates diagnostics and upgrade rules.
skills/​foundry-hosted-agent-copilotkit/​references/​patterns.md Removes separate interaction-pattern reference.
skills/​foundry-hosted-agent-copilotkit/​references/​hitl.md Rewrites approval guidance for CopilotKit v2.
skills/​foundry-hosted-agent-copilotkit/​references/​deploy-loop.md Removes separate deployment reference.
skills/​foundry-hosted-agent-copilotkit/​references/​architecture.md Removes superseded architecture reference.
plugins/​foundry-hosted-agent-copilotkit/​README.md Documents plugin contents and requirements.
plugins/​foundry-hosted-agent-copilotkit/​plugin.json Defines the skill bundle.
plugins/​foundry-hosted-agent-copilotkit/​mcp.json Configures both MCP servers.
docs/​README.skills.md Refreshes the skill catalog entry.
docs/​README.plugins.md Adds the plugin catalog entry.
.github/​plugin/​marketplace.json Registers the plugin in the marketplace.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread skills/foundry-hosted-agent-copilotkit/references/hitl.md Outdated
Comment thread skills/foundry-hosted-agent-copilotkit/references/wiring.md Outdated
@github-actions github-actions Bot added awaiting-automation ready-for-review Submission passed intake validation and is ready for maintainer review and removed ready-for-review Submission passed intake validation and is ready for maintainer review awaiting-automation labels Oct 2, 2026
… 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>
Copilot AI balanced review requested due to automatic review settings October 4, 2026 00:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The frontend example hides conversation-creation failures behind an indefinite loading screen.

Review effort: Balanced
Findings: None

Resolved since last review (2)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Handle conversation startup failures instead of hanging indefinitely

skills/​foundry-hosted-agent-copilotkit/​references/​wiring.md:212

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>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 01:19
@github-actions github-actions Bot added awaiting-automation and removed ready-for-review Submission passed intake validation and is ready for maintainer review labels Oct 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Safety-sensitive approval and recovery guidance needs maintainer validation, including the unresolved approval-history behavior.

Review effort: Balanced
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Medium severity Approval decision is lost when an interrupted run resumes

skills/​foundry-hosted-agent-copilotkit/​references/​hitl.md:69

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.

@github-actions github-actions Bot added ready-for-review Submission passed intake validation and is ready for maintainer review and removed awaiting-automation labels Oct 5, 2026
Copilot AI balanced review requested due to automatic review settings October 7, 2026 05:42
@github-actions github-actions Bot added awaiting-automation and removed ready-for-review Submission passed intake validation and is ready for maintainer review labels Oct 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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.

Review effort: Balanced
Findings: 1 Low severity

Open (1)

- `@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.
@aaronpowell
aaronpowell merged commit 581d809 into github:main Oct 7, 2026
27 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants