Oggi vi spiegherò come creare co-agenti AI o applicazioni basate su Copilot.
CoAgent offre un set di strumenti necessari per integrare gli agenti LanGraph nelle applicazioni React per creare applicazioni native di agenti. In questo post parleremo di questo strumento e vedremo come si possono creare applicazioni AI CoAgent o basate su Copilot.Come creare co-agenti AI o applicazioni basate su Copilot.
CoAgent offre un set di strumenti necessari per integrare gli agenti LanGraph nelle applicazioni React per creare applicazioni native di agenti. In questo post parleremo di questo strumento e vedremo come si possono creare applicazioni AI CoAgent o basate su Copilot.
Che cosa è CoAgents?
Come accennato in precedenza, CoAgent è un set di strumenti che ti consentirà di integrare agenti AI in applicazioni per lo sviluppo di applicazioni native. Parliamo ora di alcune delle sue funzionalità.
- CoAgents ha una funzionalità chiamata Stato condiviso, grazie alla quale anche una sola riga di codice consente all'applicazione di ottenere informazioni dall'agente, e l'agente può ottenere le informazioni dall'applicazione perché sono sincronizzati e possono interagire in tempo reale.
- Fornisce inoltre agenti frontend in tempo reale che possono eseguire azioni frontend e backend in base al contesto fornito dall'utente e allo stato dell'applicazione, supponendo che si tratti di un'interfaccia utente generativa, queste chiamate di strumenti vengono automaticamente trasmesse in base ai requisiti. Human-in-the-Loop consente l'integrazione senza soluzione di continuità del monitoraggio e dell'intervento umano nei flussi di lavoro AI, specificando punti di interruzione per l'input o l'approvazione per migliorare la sicurezza e le prestazioni.
- Disponiamo inoltre di Stream Intermediate Agent State, che mostra in tempo reale i processi del flusso di pensiero dell'agente per garantire trasparenza ed esperienze utente coinvolgenti, fondamentali per le prestazioni di un agente e per un'esperienza utente che soddisfi le sue aspettative.
- L'interfaccia utente generativa Agentic di CoAgent crea interfacce dinamiche generate dall'intelligenza artificiale che si adattano alle esigenze dell'utente e all'output dell'agente, fornendo visibilità sullo stato dell'agente e creando fiducia.
- Se ti piacciono le funzionalità menzionate sopra, potresti prendere in considerazione l'utilizzo di CoAgents per la tua attività. Vediamo come farlo.
Crea AI CoAgents o app basate su Copilot
Per creare CoAgent AI o app basate su Copilot, seguire i passaggi elencati di seguito.
- Installa CopilotKit
- Impostazione dell'endpoint backend remoto
- Aggiunta di un agente LangGraph
Vediamoli nel dettaglio.
1] Installazione di CopilotKit
Before we get started with CoAgents, we first need to install CopilotKit on your device. We assume that you have already installed Node.js and npm on your computer and created a folder for React apps; however, the last part is optional for this step. CopilotKit uses an open-source LLM model; in this tutorial, we will be using the OpenAI API key. Without further ado, let’s get started.
- Open Windows Terminal and navigate to the location where you have created the React app using the cd (change directory) command.
cd C:\React\My\App
- Now, run the following command.
npm install @copilotkit/react-core @copilotkit/react-ui @copilotkit/runtime
Then, run the below-mentioned command to install OpenAI.
- npm install openai
- In your project, go to the .eve file, which will be located at the root, and add the following line.
OPENAI_API_KEY=your_api_key_here
After making changes to the file, we recommend you navigate to docs.copilot.ai/quickstart to learn how to configure the endpoint and setup the CopilotKit provider in your project.
2] Configure the backend remote endpoint
To integrate Python-based services (or any other Node.js alternative), we need to connect the Copilot application to a remote backend endpoint. To do so, we first install the Copilot dependencies in Windows Terminal using the following query.
pip install copilotkit fastapi uvicorn --extra-index-url https://copilotkit.gateway.scarf.sh/simple/
Now, we need to configure the FastAI server, for that, run the commands mentioned below.
mkdir my_copilotkit_remote_endpointcd my_copilotkit_remote_endpointecho. > server.py
If echo didn't work, you can open the folder in Visual Studio Code and then create the server.py file.
Open the server.py file in VSCode and then paste the following lines of code.
from fastapi import FastAPI app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"}
Now, go back to Windows Terminal and install FastAPI and Uvicorn.
pip install fastapi uvicorn
Once you're done with that, head over to the docs.copilot.ai guides for more information.
3] Add LangGraph Agent
Next, we need to integrate the LangGraph agent into the server.py file. First, locate the CopilotKitSDK instance inside your Python remote endpoint, which is usually located in server.py. Next, adjust the CopilotKitSDK instance (set in the previous step) to accommodate the LangGraph agents. You need to add the following lines of code.
agents=[ Lanonfig={ # if you use Google Gemini, uncomment this code (and import `copilotkit_messages_to_langchain`, see above) # "convert_messages": copilotkit_messages_to_langchain(use_function_call=True) # } ) ],
Deve essere inserito sotto il tag CopilotKitSDK.
Se non sai come risolvere l'errore del copilota, leggi la guidaall'autenticazione: troverai una guida che puoi utilizzare.
Ti spiegherò come creare agenti Copilot utilizzando Microsoft AI?
Per imparare come creare un barbaro del Sentiero del Cuore Selvaggio in Dungeons & Dragons, ecco una guida completa.
Ti spiegherò come configurare il mirroring delle porte Hyper-V
Ti consiglierò come ottenere la chiave BIOS ASUS per PC Windows
Ti guiderò su come creare un video con il sito Google AI Vids.new
Se non sai dove trovare il minerale di stagno nel Sengoku Dynasty, ecco una guida che ti aiuterà.
Nel nostro post di oggi vi mostriamo come ottenere un dente di mostro marino in Disney Dreamlight Valley.
Se non sai come raggiungere le profondità di Roblox Fisch, ecco una guida passo passo che ti aiuterà.
Ecco una guida completa che ti insegnerà come ottenere la Perla Nera in Roblox King Legacy.