/azure-ai-foundry:foundry-hosted-agent-copilotkitfrom azure-ai-foundry
Guides development of CopilotKit frontends connected via AG-UI to Microsoft Agent Framework agents and Azure AI Foundry hosted agents. Covers tool gating, human-in-the-loop approval, generative UI, shared state, AG-UI event stream debugging, package upgrades, and hosted agent deployment.
Ships in azure-ai-foundry. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Work inside an existing React or Next.js CopilotKit app that talks AG-UI to a Microsoft Agent Framework agent running locally, in-process, or as an Azure AI Foundry hosted agent; identify the wiring first, then change tools, approvals, UI, state, dependencies, or deployment loops without assuming hosted agents speak AG-UI natively.
EXISTING React/Next.js application; do not scaffold a new app with the CopilotKit CLI or azd ai agent init from this skill./agent-framework/integrations/ag-ui/, /azure/foundry/, agent-framework/integrations/ag-ui/, azure/foundry/), CopilotKit docs for hooks and runtime, AG-UI docs for event semantics. Inspect installed @copilotkit/* declarations when docs and local package versions differ.A deployed Foundry hosted agent endpoint does not speak ag-ui by default. The original architecture question is WHERE AG-UI is produced; answer that before changing code. It exposes no read-only AG-UI facade by default. A deployed Foundry hosted agent endpoint does not speak AG-UI by default. It exposes an OpenAI Responses endpoint such as .../protocols/openai/responses and/or a raw .../protocols/invocations endpoint. AG-UI must be produced by the app, by the hosted agent container, or by a bridge.
| Wiring | Evidence in code | AG-UI producer | Consequence |
|---|---|---|---|
| Architecture A: in-process AG-UI endpoint | Python add_agent_framework_fastapi_endpoint(...) or .NET MapAGUI(...) wraps the agent. | The app service hosting the Microsoft Agent Framework agent. | Native AG-UI interaction patterns are available closest to the agent. |
| Architecture B: hosted container serves AG-UI | agent.yaml declares protocol: invocations and the container exposes an AG-UI route. | The deployed hosted-agent container. | Local and deployed behavior can match, but deployment versioning matters. |
| Runtime route | agents: { <name>: new HttpAgent({ url }) } in TypeScript config connects CopilotKit Runtime to the AG-UI endpoint. | Keep the runtime URL and agent name aligned before testing hooks. | |
| Architecture C: translation bridge | Code references previous_response_id, mcp_approval_response, a Foundry conversation object, or /responses. | A separate bridge translates Responses protocol to AG-UI. | Human-in-the-loop and state patterns require explicit synthesis work. |
The frontend agent name must align across the runtime agents config, the agent prop on <CopilotKit>, and the hosted agent name in agent.yaml.
useFrontendTool, useHumanInTheLoop, useRenderToolCall, and useCoAgent; useCopilotAction is legacy.| Task | Backend rule | Frontend rule | Verification |
|---|---|---|---|
| Add or modify a tool | Define @tool in Python or AIFunctionFactory.Create in .NET with typed, described parameters. | Add useRenderToolCall when the tool needs custom UI. | Trigger through chat and confirm TOOL_CALL_* events plus final message snapshot. |
| Gate a side-effecting tool | Use approval_mode="always_require" or ApprovalRequiredAIFunction. | Register approval UI with useHumanInTheLoop. | Test approve, reject, and a follow-up turn in the same thread. |
| Build generative UI | Return compact model-consumable data, not rich formatting. | Render rich content in useRenderToolCall or the CopilotKit render map. | Confirm rendering while streaming and after stream end. |
| Share agent state | Prefer native AG-UI state patterns in Architecture A/B. | Use useCoAgent only when the backend emits compatible state events. | Check state after reload and after follow-up turns. |
| Debug stream failures | curl -N the AG-UI endpoint with a minimal RunAgentInput body. | Inspect browser console and network after backend stream is proven good. | Compare raw SSE events with rendered UI state. |
Keep tool docstrings grounding-safe: do not include concrete example values for model-derived fields because models often copy literal examples. Use placeholders and validate inside the tool.
Read bundled references on demand; each file is self-contained.
| Resource | Use when |
|---|---|
references/architecture.md | Choosing Architecture A/B/C, local-vs-deployed behavior, or bridge responsibilities. |
references/patterns.md | Implementing frontend tools, backend rendering, HITL, generative UI, shared state, or predictive state. |
references/hitl.md | Adding or debugging approvals, especially the duplicate-execution and re-execution hazard. |
references/troubleshooting.md | Matching exact symptoms to root causes and fixes across layers. |
references/upgrading.md | Bumping CopilotKit, AG-UI, Microsoft Agent Framework, or hosting protocol packages. |
references/deploy-loop.md | Running azd ai agent run, deploying with azd deploy, and verifying deployed agent versions. |
Hosted Foundry endpoint is not AG-UI by default: do not point CopilotKit directly at /responses and expect AG-UI events.
One successful chat reply is not proof: approvals, final snapshots, and follow-up turns often fail after a basic response works.
Do not bump one preview package alone: runtime, AG-UI client, agent-framework line, hosting protocol, and manifest version must stay compatible.
Restart local hosted agents between stateful verification passes: azd ai agent run can retain stale in-memory state.
Approval rejection must prevent server-side execution: a UI cancel button is insufficient if the tool already ran.
Preserve JSON payload shape when parameters are renamed or re-typed; any workaround removal must be re-validated against the tracked upstream issue.
## CopilotKit hosted-agent result
**Status:** complete | needs verification | blocked
**Architecture:** A in-process AG-UI | B hosted AG-UI | C Responses bridge | unknown
**Changed area:** tools | HITL | generative UI | shared state | debugging | upgrade | deploy
### Evidence
- `<file/config/endpoint>`: <what was verified>
- `<event or command>`: <observed result>
### Validation
- UI read/query path: pass | fail | not run
- Approval approve path: pass | fail | not applicable
- Approval reject path: pass | fail | not applicable
- Follow-up turn after approval: pass | fail | not applicable
- Deployed endpoint verification: pass | fail | not applicable
agents key, and agent.yaml hosted agent name are consistent.approval-gated side-effecting tools require approval and were tested for approve and reject.What SKILL.md sets; muted values are Claude Code's defaults
11 skills in this plugin
/agentic-evalDesign evaluator-optimizer, reflection, rubric, LLM-as-judge, and test-driven refinement loops for AI agent outputs. Use when implementing self-critique, iterative improvement, quality gates, agent response evaluation, code refinement, or rubric-based scoring for generated code, reports, or analysis./apim-ai-gatewayDesign Azure API Management as the runtime AI gateway for model and tool traffic, including token-per-minute controls, token limits, quotas, multi-backend load-balanced backend pools, circuit breakers, semantic caching, token metrics, managed identity, and content safety. Use when fronting model deployments, enforcing token budgets, adding semantic cache, load balancing LLM endpoints, or governing tool API calls at runtime./azure-agentic-architecture-patternsProvides a decision framework for production multi-agent and AI-native systems on GitHub and Azure AI Foundry. Use this skill when designing model routing, prompt caching, semantic caching, memory, context curation, RAG, tools, MCP, identity, guardrails, evaluation, observability, or cost controls./azure-aiBuild on Azure AI services including AI Search, Speech, Azure OpenAI, and Document Intelligence, covering keyword, vector, hybrid, and semantic search, speech-to-text, text-to-speech, transcription, and OCR. Use when the user asks about AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcription, OCR, or converting text to speech./azure-api-centerDesign Azure API Center as the enterprise inventory and governance plane for APIs, agent tools, OpenAPI definitions, environments, deployments, metadata, linting, and MCP server discovery. Use when building an API or tool catalog, enforcing API standards, registering MCP servers, or making approved tools discoverable to agent builders./azure-managed-redis-cacheUse when designing or provisioning Azure Managed Redis for cache, semantic cache, vector memory, session store, or agent memory in AI-native systems; produces SKU guidance, network and identity controls, Bicep deployment steps, and integration recommendations. DO NOT USE FOR: general agent architecture (use agentic-architecture-patterns), Foundry agent runtime design (use foundry-agent-blueprint), or general Azure infrastructure (use azure-infrastructure). Triggers include "design Redis semantic cache", "provision Azure Managed Redis", "add vector memory".npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin azure-ai-foundryOther plugins' skills for the same job