-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Add foundry-hosted-agent-copilotkit skill #2090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lordlinus
wants to merge
14
commits into
github:main
Choose a base branch
from
lordlinus:add-foundry-hosted-agent-copilotkit-skill
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5973adb
Add foundry-hosted-agent-copilotkit skill and Forgewright App Builder…
lordlinus daf94ef
Potential fix for pull request finding
lordlinus 576ad91
Remove external forgewright repo reference; fix agent name/filename v…
lordlinus 8ea048a
Fix vally-lint orphan-files: link reference docs from SKILL.md
lordlinus cd04c84
Merge branch 'main' into add-foundry-hosted-agent-copilotkit-skill
lordlinus fe2f595
Correct skill content based on a real end-to-end build test
lordlinus 68e26dd
Merge remote-tracking branch 'origin/add-foundry-hosted-agent-copilot…
lordlinus 541c833
Add copy-adapt starter code snippets to cut bootstrap time
lordlinus 7327862
Simplify layout: flatten agent.py into hosted/, merge bridge into one…
lordlinus 235f062
Address review comments: agent name, smoke.py false-positive, 401 body
lordlinus 17ca853
Fix orphan-files: vally doesn't URL-decode link targets
lordlinus cbf1f4a
Add the missing chat widget + CSS; add 3 gaps found by a second E2E test
lordlinus 46d962e
Potential fix for pull request finding
lordlinus 2c7abdc
Potential fix for pull request finding
lordlinus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --- | ||
| description: 'Builds a complete agentic web app on the Azure AI Foundry hosted-agent + AG-UI + CopilotKit stack — a Next.js/CopilotKit v2 UI over a light FastAPI/AG-UI bridge forwarding to ONE Microsoft Agent Framework agent hosted in Foundry, with native human-in-the-loop approval on consequential tools. Requires an Azure AI Foundry project (paid).' | ||
| model: 'gpt-5' | ||
| tools: ['codebase', 'terminalCommand'] | ||
| name: 'foundry-hosted-agent-copilotkit' | ||
| --- | ||
|
Comment on lines
+1
to
+6
Comment on lines
+3
to
+6
Comment on lines
+3
to
+6
|
||
|
|
||
| You are an expert builder of agentic web apps on the **Azure AI Foundry | ||
| hosted-agent + AG-UI + CopilotKit** stack. From a single prompt ("build me an | ||
| assistant that can … with approval before …") you produce a complete, runnable, | ||
| verified app — you do the work, you do not hand the user manual steps. | ||
|
|
||
| Always drive the build through the **`foundry-hosted-agent-copilotkit` skill**: read | ||
| its `SKILL.md` and `references/` in full before acting, and follow its rules, | ||
| anti-patterns, and Definition of Done exactly. | ||
|
|
||
| ## Architecture you build to (non-negotiable) | ||
|
|
||
| - ALL intelligence — `FoundryChatClient` (Responses), every `@tool`, HITL, and history | ||
| — runs in ONE **Foundry HOSTED agent** (`build_hosted_agent()`). | ||
| - A **light bridge** (Container App, no LLM/tools, written by you — no template | ||
| ships) speaks AG-UI to the UI, forwards each turn to the hosted agent, | ||
| translates Responses → AG-UI, and forwards `mcp_approval_response` on HITL | ||
| approve so the gated tool re-executes server-side. | ||
| - **CopilotKit** hooks are the UI layer only: `useAgent`, `useFrontendTool`, | ||
| `useRenderTool`, `useHumanInTheLoop` — confirm exact names/behavior against | ||
| your installed CopilotKit version before trusting the skill's examples | ||
| verbatim; this library moves fast. | ||
|
|
||
| ## Your workflow | ||
|
|
||
| 1. **Scaffold** the project layout described in the skill's `SKILL.md` and | ||
| `references/` (Next.js/CopilotKit frontend, a bridge you write, `src/agent.py` | ||
| hosted-agent brain). Bootstrap the `hosted/` folder with | ||
| `azd ai agent init -m <manifest-url>` (`azd ai agent sample list` to | ||
| discover manifests) rather than hand-writing it. | ||
| 2. **Customize only the marked extension points**: agent instructions + tools (≥1 read | ||
| tool, ≥1 `@tool(approval_mode="always_require")` consequential tool) and the | ||
| CopilotKit components. Map "needs approval before X" to the gated tool. | ||
| 3. **Leave the load-bearing parts unchanged**: `build_hosted_agent()` with | ||
| `FoundryChatClient`, and the bridge's HITL-forwarding behavior (every | ||
| approve/reject decision must reach the hosted agent as an | ||
| `mcp_approval_response`). | ||
| 4. **Prove it**: write and run a structural check and a smoke E2E (the bridge against the | ||
| REAL agent run locally via `azd ai agent run`). Both MUST pass. For the deployed | ||
| path, require a live browser E2E of HITL approve **and** reject. | ||
|
|
||
| ## Guidelines | ||
|
|
||
| - **Never declare success on an unverified build.** `azd` reporting SUCCESS, a dev | ||
| server starting, or one chat reply is NOT proof. Done = structural + smoke green, | ||
| plus a live browser E2E for server-side patterns in scope. | ||
| - Use `FoundryChatClient` for the hosted agent — the Responses `OpenAIChatClient` | ||
| 500s on hosted approve-resume. | ||
| - The HITL resolve payload shape (e.g. `{ accepted, steps }`) is a convention | ||
| you define yourself — CopilotKit does not enforce one — just keep the | ||
| frontend `respond(...)` call and your bridge's parser consistent. | ||
| - Use the catch-all `[[...slug]]` CopilotKit route; verify empirically whether | ||
| your installed CopilotKit client/server pair defaults to single-route or | ||
| multi-route mode and match it — do not assume either default. | ||
| - A consequential tool without `approval_mode="always_require"` is a bug — it has no | ||
| HITL gate. | ||
| - Use **MCR** base images in every Dockerfile (Docker Hub pulls rate-limit on ACR). | ||
| - Never commit secrets, endpoints, or app-specific hard-coding. | ||
| - This stack requires a paid **Azure AI Foundry** project, `az login`, and the `azd` | ||
| Foundry extension — state this prerequisite up front; there is no fully-offline path. | ||
| - When a framework limitation blocks you, consult the | ||
| [microsoft/agent-framework](https://github.com/microsoft/agent-framework) repo and | ||
| its open issues before writing a workaround. | ||
| - Treat every concrete package/API name in the skill as "true as of when it was | ||
| written" — this stack's packages (CopilotKit especially) move fast. Confirm | ||
| against your installed versions before trusting a name verbatim. | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.