Aller au contenu
Skillpedia
Agents40k · #7208

foundry-hosted-agent-copilotkit

Ce qu’il fait

Cet outil vous aide à relier une application web développée avec React (et CopilotKit) à un « agent » intelligent (créé avec Microsoft Agent Framework) qui fonctionne sur un service Microsoft payant appelé Foundry. Il facilite la communication entre les deux pour créer des applications plus avancées.

Quand l’utiliser

  • ✓Lorsque vous construisez une nouvelle application web qui a besoin d'un agent intelligent.
  • ✓Lorsque vous ajoutez ou modifiez un agent intelligent dans une application web existante.
  • ✓Lorsque vous voulez que votre application web utilise des fonctionnalités IA avancées, comme les validations et l'historique des conversations.

Lien du skill

https://github.com/github/awesome-copilot/blob/main/skills/foundry-hosted-agent-copilotkit/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/github/awesome-copilot/blob/main/skills/foundry-hosted-agent-copilotkit/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Comment relier mon application React avec CopilotKit à un agent intelligent sur Microsoft Foundry ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'outil met en place la communication entre votre application React (CopilotKit) et l'agent intelligent (Microsoft Agent Framework) grâce à un protocole appelé AG-UI. Il utilise les services Microsoft (Foundry) pour héberger l'agent et gérer la conversation.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

CopilotKit + AG-UI + Microsoft Foundry hosted agents

Use this skill when a React/Next.js app uses CopilotKit and talks over AG-UI to a Microsoft Agent Framework (MAF) agent hosted in Microsoft Foundry. This covers new builds and changes to existing apps. Foundry hosted agents are a paid Azure service.

Scaffold the agent with azd ai agent init and the frontend with your usual React/Next.js tooling. Then follow this skill for everything that connects them.

Mental model

React (CopilotKit v2)        CopilotKitProvider / CopilotChat threadId=<conv_ id> / useInterrupt
      │ HTTP
CopilotKit runtime           CopilotRuntime({ agents: { default: new HttpAgent({ url }) } })
      │ AG-UI (SSE)
AG-UI gateway (FastAPI)      add_agent_framework_fastapi_endpoint(app, AgentFrameworkAgent(FoundryAgent(...),
                               use_service_session=True, service_session_id_from_thread_id=True))   ← keeps no thread state
      │ OpenAI Responses + Entra token (https://ai.azure.com/.default)
Foundry hosted agent         ResponsesHostServer(Agent(tools=[...]))  ← deployed with azd

A deployed hosted agent does not speak AG-UI. It exposes .../agents/<name>/endpoint/protocols/openai/responses (Responses protocol) or .../protocols/invocations. Translate with MAF's own adapter (FoundryAgent + agent-framework-ag-ui) instead of writing an SSE translator by hand. Browsers cannot hold the Entra token, so the gateway is always server-side.

Use the platform first

Before you write any plumbing, check this table. Each row is something older codebases built by hand.

Need Native primitive (don't hand-roll)
Conversation history across turns and restarts Foundry conversations: create one per chat, use its conv_… ID as the AG-UI thread ID, and the gateway passes it through (no snapshot store)
Durable tool approvals ResponsesHostServer persists approval requests by default (FoundryFunctionApprovalStore). The AG-UI adapter turns them into AG-UI interrupts and forwards decisions back to the hosted agent
Runs that survive browser disconnects Responses background: true + store: true, then poll or reconnect (see wiring)
Durable multi-step workflows with gates Invocations hosted agent + @multi_turn_task + FoundryStateStore
Per-user files for the agent Session Files API; the agent reads $HOME with its own tools. Never inline large documents into the prompt
Long-term user memory Foundry Memory Store (user scope) or FoundryMemoryProvider
Tool catalogs, web search, code interpreter Foundry Toolbox (FoundryToolbox) with Tool Search, instead of listing every tool up front
Live docs while coding The Microsoft Learn and Foundry MCP servers (bundled with this skill's plugin)

Choose the wiring

If the app needs… Use Gateway size
Hosted agent + chat + tools + approvals (default) A. AG-UI gateway over a Responses hosted agent ~50 lines of Python
Every state pattern, local prototype, no Foundry compute B. In-process AG-UI (agent runs inside the FastAPI app) ~15 lines
Background runs that keep going after disconnect, reconnect, per-user conversation lists C. Background-runs gateway (custom AG-UI agent over Foundry conversations) ~150 lines of TypeScript
Multi-step plan → approve → execute, irreversible steps that must not run twice D. Invocations hosted agent alongside A or C REST proxy

Code for each is in references/wiring.md. In an existing codebase, identify the wiring before you change anything:

  • FoundryAgent(...) wrapped by add_agent_framework_fastapi_endpoint means A.
  • Agent(client=...) wrapped directly means B.
  • A custom AbstractAgent calling /responses with background means C.
  • protocol: invocations in azure.yaml means D.

Workflow

  1. Pick or identify the wiring (table above).

  2. Use the latest release of every package (@copilotkit/*, @ag-ui/*, agent-framework-*, azd and its azure.ai.agents extension). Then ground on live sources:

    • the Microsoft Learn MCP server for MAF and Foundry
    • the Foundry MCP server for project state
    • docs.copilotkit.ai and the .d.ts files bundled in the installed @copilotkit/* packages
    • docs.ag-ui.com

    APIs move between minor versions, so don't trust memorized names.

…

Questions fréquentes

Qu'est-ce qu'un « agent » ?

Un agent est un programme informatique capable d'accomplir des tâches, de comprendre des commandes et d'interagir avec vous, comme un assistant virtuel.

Qu'est-ce que Microsoft Foundry ?

Foundry est un service Microsoft qui vous permet d'héberger et de gérer des agents intelligents dans le cloud, afin que vos applications puissent y accéder.

Qu'est-ce que CopilotKit ?

CopilotKit est une bibliothèque pour React qui facilite la création d'interfaces de chat et l'intégration d'agents intelligents dans vos applications web.

Détails

Description originale de l’auteur

Build and evolve agentic web apps that pair a CopilotKit React frontend with a Microsoft Agent Framework agent running as a Microsoft Foundry hosted agent, connected over the AG-UI protocol. Covers choosing the wiring, using Foundry-native primitives instead of hand-rolled plumbing, agent tools, human-in-the-loop approvals, generative UI and shared state, local run and azd deploy, debugging the ev

repo: github/awesome-copilot

Popularité

Étoiles GitHub
40k
Position au classement
#7208
Licence
MIT
Mis à jour
15/10/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires