How to Integrate Your Agent Swarms Into Custom GPTs

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
In this video I'm gonna show you how to integrate  your agent swarms directly into custom GPTs,   making them easily accessible to  any number of users at any time,   regardless of their technical experience. I will  also talk about a lot of exciting updates,   including a discord community  which I know you guys have been   waiting for. So make sure to stay until the end. Let's dive in. If you   haven't been following me before,  welcome to this channel. My   name is Arsen and my goal is to automate my entire  AI agency with AI. To do this, I've created a   framework called Agency Swarm, which unlike other  frameworks does not write prompts for you, is   extremely reliable in production,  and allows you to easily define   communication flows. But the one biggest piece that we were missing   until today was a community where  you guys can grow ideas, share   your work and get some help. Now finally with our  new discord server you have the opportunity   to do all of these things and more.  I'll be there with you personally   sharing my own perspectives, insights and listening closely   to your feedback. So for everyone  who wants to be a part of this   movement shaping the future of AI the link will  be in the description and in comments. Now,   without further i do, let's  see what we are going to build   today. So, this is my custom GPT that is currently integrated with a BitInvest swarm from   my previous video created by the Genesys swarm. So make sure to check out this video later.   Now, let's see how this works.  I'm gonna ask what are   the Bitcoin prices for today. And as you can  see, the BitInvest CEO immediately proceeds   with calling the first function  which sends our message to the   market analyzer agent. Make sure to click always allow so I can upload   some viruses to your computer and  steal your data. And just so you   don't have to confirm these messages each time.  The CEO simply informs me that the process of   fetching the latest Bitcoin  prices is underway. As some of   you might have already guessed, we finally have a synchronous execution. But more on this   later. So currently, the Market Analyzer agent is running on our Firebase backend in a   separate serverless function.  We will check back with him   later. In the meantime, let's ask the CEO what are  the latest news today. Amazing, so this time   it calls the News Harvester agent, which is our  second agent and also notifies me that fetching   the latest news is underway. In  the meantime, let's check if we   got the response from the first agent. Indeed, as you can see,   we now get a list of Bitcoin prices  from the market analyzer agent,   and it seems like Bitcoin prices have dropped,  unfortunately. So now let's also check if there   are any news related to this. Awesome, now we get  a list of top news from the market harvester.   Seems like most of them aren't very  positive and we might be expecting   a crash soon. So let's ask the CEO if I should invest in   Bitcoin or not. Now the CEO provides  me with some factors to consider   based on these news and prices. Not an investing  advice. The link to this custom GPT will be in   our Discord if you want to try  this out yourself or hack my   Binance account. Now before I show you how to create this integration yourself,   you need to understand the three  significant updates that I   have added to this framework. First and foremost,  we now have a synchronous execution mode inside   the agency class. This allows your agents to send  tasks to one another without having to wait for   a response. All you have to do to enable it  is simply set async mode to threading when   initializing your agency. Currently, only  the threading mode is available, however,   in the future I do plan to add  more options. After you've done so,   all your agents will automatically utilize two tools instead of one. The first tool,   SendMessage, is still there, however, in async mode, it doesn't wait for the recipient agent to   finish the task. Instead, it simply triggers it in another thread and then sends a status   response back. The caller agent  can then check the response   by using the new GetResponse tool.  This tool retrieves the latest   message from the thread using OpenAI Assistance API or returns   another status update if the run  is still in progress. Literally   everything else works almost  exactly in the same way. You   don't even have to think about it. There is still not a single hard-coded prompt   like in all other frameworks.  Your agents will determine   how to communicate with each  other only based on these tool   descriptions. This means that you still have full control over your entire system. The   second major update is that now you can easily load your agents and threats from the database,   making this framework easily runnable on all types of backends. So even if you have a stateless   backend like a serverless  function, you can still   allow your agents to continue  their conversations exactly where   they left off. To use this feature, you have to insert two functions into the   Threads callbacks and Settings  callbacks parameters inside   the Agency class. Essentially, the Save function  should take the input parameter and save it to   your database, while the Load  function should load this parameter   in the exact same format and return it as a function output. I will   show you how to set this up yourself with  Firestore NoSQL database in just a moment.   And finally, I've hired someone from my YouTube  channel to help me out with documentation and   some examples for this framework. Now, let's  see how you can create your own custom GPT   swarm yourself. To get started, I've created a  repository for you called Agency Swarm Custom   GPT. Simply clone this repo,  the link will be in our Discord   server and follow these steps. First, search for Firebase Console on Google and login   into your account. Create a new project, set the billing plan to Blaze. Don't worry   about the costs as Firebase  offers a generous free usage   quota that you're super unlikely to hit. This step  is only necessary so you can enable certain   features required for deployment. After creating  the project you'll be taken to your project's   dashboard. Open the Firestore database  under the build tab and enable this   service. Then go to your project settings click service   accounts then click Python and click  generate new key. Drop this key   into the functions directory of the  repository that you have just cloned   from our discord server and then also don't forget   to insert your OpenAI key and create  a DB token for authentication. You   can follow the provided link to generate a simple  random token or use any random password. Now,   go to Firebase console, copy  your project ID and paste it into   ".firebaserc file". Open your terminal, navigate into the functions directory and   create a new Python environment with the following command. Activate it and then run   pip install-r requirements.txt. Now it's time to set up your agency. You can   drop your agency folder or separate agent files into the same functions directory.   After adding your agent  files, import them inside   the helpers.py file inside the init agency method.  Please refer to the commented example on how to   do this. Alternatively, if  your agency is super simple,   you can set it up in the same helpers.py file. The only thing you have to keep in mind   is to add the threads callbacks as shown in the commented example with the two functions defined   above. If you are not sure how to create your agency, this is unfortunately out of scope of this   video, so make sure to check out this one next. To save the threads we'll use a special   function that connects to our  Firestore database and stores   them in the conversations collection document.  The ID of this document will be a conversation   ID from our custom GPT provided in a special  header by OpenAI. You can see this header in   the main.py file. The load function will check  if a document with this conversation ID exists   and return the saved threads accordingly. If the  document does not exist, it means that this is   a new conversation, so we can simply return an  empty object. This setup ensures that all chat   histories between your agents are  unique to each conversation in your   custom GPT. So if a user starts a new conversation,   all the chat histories between your  agents will be reset. But in the same   conversation, your agents can continue talking to  one another, even if the user has left the chat   and returned back later. Now, there are just a few  more steps left. First, run the schema.py file,   which will create a schema.json and settings.json  files in your functions directory. This schema   will be used to create our actions on custom  GPT, and the settings file will initialize   our agents on the backend. Then, if you don't  already have Firebase tools installed, install   them with npm using the  following command. After that,   run firebase login if needed. And finally, run "firebase deploy - -functions". After our   functions are deployed, copy the URL from the terminal, go back into the schema.py file, paste   it into the "getCustomGPTSchema" method and run the schema.py file again. This will replace the   server URL of your schema with the correct URL from our cloud function. Now we are finally ready   to configure our custom GPT. Copy the CEO instructions from the terminal output   after running schema.py file,  create a new custom GPT,
Info
Channel: VRSEN
Views: 5,512
Rating: undefined out of 5
Keywords: Custom GPT integration, Agent Swarms, AI tutorial, multi-agent frameworks, AI agency, AI automation, AI programming, AI for beginners, AI solutions, ai development, ai tools, chatgpt, python, openai, ai agents, open ai, microsoft autogen, agency swarm, artificial intelligence, agi, assistants api, openai assistants api, ai automation agency, custom gpt, ai, Agency Swarm, custom gpts, openai custom gpt
Id: nrfVO8bLRL4
Channel Id: undefined
Length: 11min 0sec (660 seconds)
Published: Wed Jan 31 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.