# How To Build AI Agents With ChatGPT (GPT 4.1)

## Метаданные

- **Канал:** TheAIGRID
- **YouTube:** https://www.youtube.com/watch?v=xhIUS1zOdU8
- **Дата:** 15.04.2025
- **Длительность:** 7:49
- **Просмотры:** 59,075

## Описание

Join my AI Academy - https://www.skool.com/postagiprepardness 
🐤 Follow Me on Twitter https://twitter.com/TheAiGrid
🌐 Checkout My website - https://theaigrid.com/


Links From Todays Video:
https://n8n.io/

Welcome to my channel where i bring you the latest breakthroughs in AI. From deep learning to robotics, i cover it all. My videos offer valuable insights and perspectives that will expand your knowledge and understanding of this rapidly evolving field. Be sure to subscribe and stay updated on my latest videos.

Was there anything i missed?

(For Business Enquiries)  contact@theaigrid.com

Music Used

LEMMiNO - Cipher
https://www.youtube.com/watch?v=b0q5PR1xpA0
CC BY-SA 4.0
LEMMiNO - Encounters
https://www.youtube.com/watch?v=xdwWCl_5x2s

#LLM #Largelanguagemodel #chatgpt
#AI
#ArtificialIntelligence
#MachineLearning
#DeepLearning
#NeuralNetworks
#Robotics
#DataScience

## Содержание

### [0:00](https://www.youtube.com/watch?v=xhIUS1zOdU8) Segment 1 (00:00 - 05:00)

So GBT 4. 1 is here and one of the main use cases of this is to be able to build successful AI agents. So in today's video I'll be showing you guys exactly how you can get started step by step even if you have no knowledge of making AI agents before. So let's get started. So for this video we're going to be using N8N. It's a low code drag and drop builder where you can build AI agents for practically anything. Trust me, this one is going to take you less than 8 minutes to set up. It's really easy to get started. So now that we're in this place where it says AI agents, we're firstly going to need to add a first step. What we're going to be creating is we are a simple email agent. What the agent does is essentially it just replies to our emails for us. So firstly an email hits my inbox. My agent is actually looking at my inbox because it has that data. Then it will take that data, convert it into something nice and then quickly craft a draft reply for me. So let me show you guys this agent in action. So this is the agent that I have built and it is already working in my inbox. So, this is the AI agent I've already built. It's already working, but I'm going to quickly explain to you exactly what's going on. This right here is the Gmail trigger. This watches your Gmail for a specific account to happen. This is basically what triggers the entire process. In simple terms, this is basically like a doorbell for your workflow. When the right kind of email arrives, it rings the bell telling everything to get started. This is where we have the AI agent brain. This is the central node as the main processor or decision maker. This takes the information from the Gmail trigger and figures out what to do with it. So it basically takes that email and uses the connected resources to be able to process it. Now you can see right here I've got the OpenAI chat model. This is GPT 4. 1. And I've also got a window buffer memory so it remembers past things in the conversation. And of course I've got the final action which is of course to create the draft. This node takes the output created by the AI agent and then it performs the action in Gmail. In this specific case, it creates the draft meaning it's going to create a new draft in your email account containing the AI generated response. In simple terms, this is how it looks like. An email arrives in Gmail. This triggers the AI agent to get the email details and then Gmail uses that to create a draft that's left in your email. Let's go ahead and check about this email that we recently received on our Domino's order. It's already running late. Now, because my AI agent was already here and is already running, if I go over to my draft section, you can see that I already have a draft ready. That is a nice response. You can see my draft is here ready to send off as soon as I wish. So, now let me show you guys how you can set this up yourself so that you don't have to manage your emails anymore. So now what we need to do is add our first step. Let's click the plus icon. Then let's search the Gmail icon. If we click Gmail, you'll see that we have triggers. Click this one that says on message received. Now you can see it pops up with a bunch of different information. The only thing we need to do here is to click this dropown menu. Then what we're going to do is we're going to click create new credential. This is where we can just sign in with our Google account. It's super safe and secure. And this is where we're linking a Google account so it can manage the emails and actually read them as they come in. I've already done this step, so I don't need to log into another email account. So now that that's set up, the only thing we need to do now is just to add our AI agent. So let's go ahead to the drop-own menu. Let's click AI agent. If we just click add right there, it adds the AI agent node. So now we're going to make sure that this one is a tools AI agent. And for the system prompt, we're going to click define below. So this is basically we just have a source for the prompt. So this is what the AI is going to read every single time it reads the information. So I'm going to input this prompt right here. It's super small. It basically just says, "As an AI assistant handling Gmail messages, your primary task is to analyze incoming emails and create appropriate draft responses. " And I'm going to do the from here. Then subject. And message. So before I decide to trigger this, now let's add ourselves a chat model. If we click the plus icon, you'll see that we have a range of different models to choose from. For this example, we're actually going to be using the GPT4. 1. So we go to OpenAI chat model right here. Here's where you're going to need to make sure you can connect your account. This is basically where you'd have to sign in. So, if I click create new credential, it's basically going to pop up with my API key. So, if you don't know how to set up your OpenAI API key, I'll show you guys quickly right now. So, basically, just head on over to the OpenAI playground and then once you're here on this website, I'll leave a link to that in the description. Click the settings icon, then go to API keys. Here's where you'll see every API key you've created. Here you can see some that I've already created. This is where I'll click create new API key. And this is where you can name this one NA10 and whatever project you want to have. Then you can click create secret key after selecting your default project. And then the key that it generates here is one that you never want to share with anyone. Just copy this and then click done. And then just paste this API key into this area here. And then just click save. And that should be done. Now from this drop-own menu here, I'm going to go ahead and select the model. So we can see GPT41. If we just scroll down, we can see GPT 4. 1. Let's just click that. And then now the model is there. And this is exactly what we needed. So now we have our chat model here. This is exactly what we wanted. Now let's of course add some memory here. So if we click here, we can add the Windows buffer memory. And then what we want to do is change this to defined below. And for the key, you can really enter any random number as you want. So I'm just going to enter 1 2 3 4 5. And then let's leave that as that. So now we have our AI agent set up with the chat model and

### [5:00](https://www.youtube.com/watch?v=xhIUS1zOdU8&t=300s) Segment 2 (05:00 - 07:00)

the Windows buffer memory. So now what I've done is I've just sent myself another email just so that I can go ahead and test this step. So you can see right here I've put an email domino's order 678. Now I'm going to go ahead and I'm going to execute the previous nodes. You can see it just went ahead and grabbed the email. You can see now I actually have the information that I can go ahead and put into this template. So now what I can do is I can simply grab this from area and I can simply put it right on the from. Then for the subject I can just grab this, drag it all the way to the subject. Then what I can do for the message is I can just grab this snippet. So this snippet is the actual message and then I can just grab that snippet and place it right there. So now you can see that the AI has all of this information. That is really good. So now our AI actually has all of the information. So when it gets put in, that's exactly what it's going to see. So now I need to do is I just need to click add. Then I need to click Gmail. Then I'm going to click again. And then here we can see a list of different actions that we can use with that information. So with that information, now what we can do is we can click create a draft. So right here, this is where we can click the draft. So right here it's on draft. Option is of course to create. And for the subject, what we're going to do is we're going to execute the previous notes. This is so that we can use the information and input it into these fields. So this is what we do. We grab this and we can put it into this message right here. So for the subject, let's click this dropown menu, go to the Gmail trigger, then what we're going to do is we're going to just grab the subject from here. And there we go. And then of course that is the step. So now if we go ahead and run this AI agent, if we click test workflow, this should in theory create us a draft email. So let's test this workflow. Now it is working through the steps and you can see it says workflow successfully executed. So now if I go ahead and check my drafts, there should be a draft email there and you can see my draft email is right here. You can see draft response already. It says thanks for letting us know. We'll be ready for your arrival. So here you can see my email here is ready to send off and this was super easy and only took me less than 5 minutes to create. Now of course this is just the beginning when it comes to building AI agents. There are many different things that you can do. And I'm going to be continuing to build out these AI agents, especially for you beginners. If you guys enjoy tutorials like this where I break them down in super simple ways so that even anyone without any technical expertise can follow them, don't forget to leave a like on this video telling me what you want me to build in the next video. Or don't forget to join the AI grid academy where this is what we're doing. We're actually building AI agents on a large scale and I'm actually using them to run my business on a day-to-day basis in much more complex terms if you want the templates because with these AI agents with n what you can actually do is you can just simply import this agent if you don't want to. So, if you actually want this agent for yourself, all you'd have to do click the three dots, click import from file, and just download it. If you really want, you can just download it from my community. I've actually just publish this now, so anyone can use it there. I've also got other agents in that area, and I'm going to be using that place to basically store all of my agents, so you guys can use them as well. So, if you guys enjoyed this video, don't forget to leave a like, subscribe, all that good stuff.

---
*Источник: https://ekstraktznaniy.ru/video/13050*