Transcript for:
n8n AI Agent Setup Guide

everyone right now is talking about AI agents and how they can improve your life by making you way more efficient way more productive and handling a whole bunch of tasks that you just don't want to do so today I want to take you through building your first AI agent using nadn which is rapidly becoming my favorite tool for AI Automation in this beginner-friendly step-by-step tutorial I'm going to show you exactly how you can get started in n8n building your first AI agent the agent we build today will help you search through a list of contacts to draft emails to them and even schedule events on your calendar and the end of the video I'm going to show you how to create a simple connection to telegram so you can chat with your agent using text and voice anywhere in the world and so you can see this says I scheduled the meeting with Brian Johnson on Monday February 24th 2025 at 10: a.m. to discuss baseball and it gives me the meeting details here what's also cool these agents are so smart this says I also sent an email to Brian to inform him about this meeting so not only if I go over to my calendar do I have this meeting scheduled at 10:00 a.m. uh with Brian to discuss baseball which is great I also have an email drafted that just says hi Brian I've scheduled a meeting to discuss baseball on Monday the 24th uh here and then here are the details right AI agents are becoming incredibly powerful and getting easier and easier to set up so by the end of this video we'll have your first AI agent set up and already handling tasks for you so let's hop into nadn and let's get started so the first thing you're going to need to do is head over to nn. and create an account you can just click this button get started for free they give you a free 14-day trial where you can really try everything so when you first sign in you'll see a screen that looks like this and all you got to do is open up your workspace so you can start creating scenarios this is what my workspace looks like and right now I have a whole bunch of workflows that I've already began creating but we're going to start from scratch today so I'm just going to go ahead and click create workflow and I haven't built this workflow out before but I just want to show you how simple it is to get started building these AI agents even with almost no experience whether you're coming from a platform like make.com or you're totally new to Ai and automation nadn is a great tool and it should feel really intuitive to use so the first thing we need to do obviously is this big plus buttons we need to add a first step and what this is this is the trigger this is the thing that kicks off your entire Automation and so I'm just going to go ahead and I'm going to click the plus and basically you can see this whole list of Triggers on the right hand side here and for today what we want to do is we want to start by just triggering this with a basic chat message so we're just going to type right here inside of nadn to our AI agent for it to handle tasks and then at the end of this video I'm going to show you how you can link up telegram so you can start texting and speaking into telegram to get your AI agent to per form tasks for you so this is already set up and you can just go ahead and click out of this and if you want to start talking to it basically just come down to the bottom here and click open chat we don't have any like AI models like chat GPT or anything linked up yet but you can start typing to it you just won't really get a response you can just say like hey what's up and you're not going to get an answer because we don't have anything linked up but I just want to show you that this is available and once we do want to start talking to our agent this is where we'll go so I just created this little flowchart for what we're going to be building today because sometimes I think it's easier to visualize things beforehand before you actually hop into building and so I'm just going to go over this really quickly and basically everything starts up top here with this input message again that's that chat module that we already linked up so basically we type something to our AI agent and I kind of sometimes actually like to work backwards I say what do we want this thing to do today well we want to do two things really we wanted to send and or draft an email and we want to be able to schedule a meeting right and so in order to do that what kind of information do we need well we need the contacts like name and info right we need their name we need their email address whether we're either you know sending an email or scheduling a meeting and so we'll take this input message and then the we'll send it to the AI agent and then the agent's job is to route that information to the proper channel right so the AI agent is going to get the contact information and then it's going to either send that to the to the tool that's going to draft an email or to the tool that's going to schedule a meeting and these things kind of work back and forth these agents are actually incredibly smart and with very little prompting you can have something incredibly effective so now that we kind of have seen the flow right and now we have our chat message set up what do we need well we can basically already link this up to the most powerful feature in Ed which is the AI agent so we can just go ahead and click the plus and you can just search up here uh for agent right and we see this AI agent tool here so this is the AI agent and this is essentially what it looks like and what's really getting powerful about this is now we can actually use nad's built-in intelligence to figure out how to hook this thing up properly so right now this doesn't do anything quite yet we need to hook it up to some sort of large language model mod like chat gbt we also need to give it some memory so that it can remembers the history of our chat conversation and so basically here in this plus if I zoom in here you can see this says chat model memory and Tool and so the chat model is the kind of the brains of the operation in our case we use chat TPT the memory is so it can remember our history our our conversation history and the tools are basically everything we're asking it to do so let's just go ahead and let's hook up chat gbt to this so just click the plus here and if you don't see it you can just type in open and go to open a chat model now we have this chat model here and if you don't have an account head over to platform. open.com to get your API key and you need to have like a couple dollars in your account I think $5 is kind of the minimum and these systems really cost pennies to run they're incredibly cheap and basically you're just going to go ahead and click the pencil and paste in your API key here and it's going to connect like almost instantly for you so once you have this connection set up you just go ahead and choose the model this has basically all the opena models in here and I'm just going to stick with chat BT GPT 40 mini because that's really all we need for this uh this is like a really fast model and it's definitely enough for kind of the minimal functions that we're doing today and so now you can see that when we go into here and we type in our hey what's up message now the brain will actually start thinking and we actually get a response so you can see the input you're a helpful assistant hey what's up and if you come down here to the output you can see it in both the chat and the logs here hello I'm here to help you with whatever you need how can I assist you today so basically our system is already working and it's talking to us the other thing we need to do is we want to hook up memory because we can say something like my name is Duncan right and it'll say okay great nice to meet you Duncan how can I assist you today but then if we were to follow up and say what is my name since we haven't given this any sort of memory it's going to say I'm sorry but I don't have access to personal data about users unless it has been shared with me it doesn't remember that we've already talked about this right so we just want to go ahead and hook it up uh so that we have some memory here so go ahead into the memory and just click the plus and windows buffer memory uh this basically just stores this in NN temporarily and you can see the Contex context window length right right now we have it set to five this is how many past interactions the model receives as context five is great for what we need right now uh and this is basically all you need to do to set this up you can change this to 10 it'll take a little longer to go through your message history but it's really not a big deal so if we were to open this chat back up and we can say my name is Duncan and that's going to tell me something like oh great nice to meet you cool and now I can just ask it what is my name and now it should have a hisory of our conversation and now it says your name is Duncan how can I help you today so it remembers everything we set up perfect and so now is really the fun part now is the part where we can actually give this some tasks to do uh we can have it send and draft emails to our contact list and we can have it schedule meetings the only other thing you do need to set up for this uh is we want to have a list of our contacts and I literally just created a list in Google Sheets uh I have two contacts in here I have uh myself uh and Brian Johnson uh B Johnson fake company.com uh this says company let's change this company great and so just set something up in Google Sheets with any contacts that you want to have and so the next thing we want to do is we just want to connect our first tool and so what do we want this thing to do well we want this to be able to draft an email to someone so I'm just going to go ahead and click the plus here and I'm just going to type in Gmail because we want to use the Gmail tool and this is great and so again you're going to need to set up uh Google Drive and uh you know Gmail so that you can interact with nadn but come down here and you'll just go to create new credential and there's a few steps to connecting to oaf uh there's documentation on the web or NN where you can figure out how to do this and just go to sign in I'm going to sign into my account give a permission to uh access everything that I'm going to do today this is great go ahead and click okay and I already have a connection set up so that was really easy I do always tell people that troubleshooting and problem solving is one of the most important skills that you can have when you're getting into Ai and automations these things break all the time it's not always obvious how things are going to work out so being able to find the information is literally one of the most valuable skills because especially if you're dealing with clients or things like that they're going to expect you to have answers and you're going to have to know how to go out there and find them so something simple like being able to log into your Gmail is a really good place to start okay so now we're here back in nadn and so what do we want this thing to do right uh tool description set automatically or set manually and if we come into set manually you can see this is consume the Gmail a API basically we can just give this a little more information this is uh send and draft emails so just give it a little bit more information of what this we want to do so that way when the AI brain is searching for the right tool to use it has this additional information so that way we actually have to give very minimal information to the AI agent we can actually set almost everything just in the name and description of these actual tools this will save you on time and this will save you on cost because the AI agent won't have to spend so much time going over this really long prompt that you've created for it and so what's the next thing we want to do so we can change the Source here from message to draft because I like to have everything go to a draft folder uh because that way then I know I'm not sending it out without me having taken a look at it first and if you're working with clients or doing something professional I highly recommend uh saving everything as a draft before you actually send it the operation is going to be create this is what we want to do we want to write and basically what's really cool now is that we can pipe in our own subject we can pipe in our own message but now what's really incredibly powerful about nadn is these little sparkles here is we can let the model Define this parameter so this means is that based on the message that we send uh to the AI agent it'll actually create the subject and the message copy for us and we actually don't need to do anything at all we don't need to link up any fields we don't need to learn about Json or anything like that we just literally need to send the message to the AI agent and it figures this out for us so I'm just going to click this and I'm going to click this and so now basically the subject line and the message are completely defined by the AI agent so let me show you how this works so we can just come in and open up the chat and we could say draft an email talking about how wonderful Steph Curry is and asking the recipient if they want to go to a basketball game we can just go ahead and send that off now you can see the AI agent is working it's using this open AI model what it's going to do it's going to call this Gmail tool to go ahead and draft a message and literally this just took a couple seconds so we actually can just open up the Gmail tool here and you can see the message here hi there I hope this email finds you well I just wanted to take a moment to share my thoughts on how absolutely wonderful Steph Curry is his skills on the court are unmatched and he truly has a way of making the game exciting to watch again we can kind of like prompt this model a little to speak a little bit differently but this is generally what I'm looking for right so we can just go into my drafts and the subject line is let's catch a basketball game and there just says hi there I hope this email finds you well yada y y all this again and then it has a sign off with my name because now it knows my name right uh pretty incredible so this is really the first step but this actually isn't like sent to anyone right like we this is has no recipients but what want to be able to do is we also want to be able to search our contacts list and so what we need to do now is we need to hook our AI agent up to Google sheet so it can search for our list of contacts and so what we need to do here is we can just move this out of the way and we can click the plus to add a new tool and we can just search for sheets and go to Google Sheets tool and I already have a account connected but again remember you can just go ahead and click the pencil to create a new account it'll have you signed into to Google and you'll be off and running so basically what I want to do now is I just need to find the Google sheet that I have for all my contacts lists and so so I can just go into document and I can go to contact list and the sheet is just going to be the first sheet sheet one right and so there is one more thing that we want to do to make sure the AI agent understands what this tool is for and so this is a good opportunity to set the tool description we can go in from automatically to set manually right now it just says read update and write data to Google Sheets that's not really telling us what this is for specifically so in our case we want this description to say call this tool to get the first and last name and email addresses of contacts so now the AI agent will understand that it needs to call this tool if I ask it to actually search for something so I'm just going to go ahead and I'm going to copy this message again draft an email to Brian asking if he wants to get some pizza this weekend so I'm going to go ahead and send this off the AI agent is thinking great and remember how I said troubleshooting well I forgot a step so it's really helpful to you see that these errors occur all the time and it's helpful to know where to look so what you need to do and I forgot to do this I actually needed to add a property to this Gmail uh tool so that it actually knows to add the recipient's email address so now I have to go into options and we can basically say to email so who is this email going to and so now I can just go ahead and I can let the model Define this parameter as well because it should be able to pull that information from the contacts list and automatically know that this is the email address of the person I'm trying to send the email to and because I don't want there to be any confusion I'm just going to go ahead and I'm I'm going to give the AI agent a little bit more detail of the order of operations basically how do I want to handle these tasks so now is a great time to access the system prompt for the AI agent and we can just really enhance this by adding one single line so if we come into add option and we can just go into system message and right now it says you are helpful assistant type period and we can basically switch this to expression and if I open up uh this a little bit bigger we can just come in and I can paste this in before creating events or sending emails get contact information from the get contact tool so basic is just saying like yo before you go ahead and do anything make sure you're actually getting the information for the contact so I'm going to close this out now and I'm just going to go ahead and right click and rename the Google Sheets tool to the get contact tool so now we can go ahead and click rename so now if I copy and paste this draft an email to Brian ask him if he wants to get some pizza this weekend and I send this off the AI agent is getting to work and now you can see it's actually retrieving the contact information from our Google chats before it goes ahead and drafts the email and so now it went ahead and drafted the email and this says hi Brian hope you're doing well uh let's grab some pizza etc etc and if I come into my drafts folder now and I refresh this we can see now I have this pizza this weekend question mark I was wondering if you'd like to get some pizza this weekend let me know your thoughts best your name so now it's forgotten my name because I've had so many different conversations with it but I can always tell it like my name is Duncan and this is my email address but now you can see it's actually inserted the right email address B Johnson B Johnson fake comp.com uh which is exactly what we want so we could just come back into the AI agent here if we wanted to and we can go to this and we can say sign off on emails with the name and I can just put my name so you can go ahead and put your name in here too and so this is basically all set up to send emails to literally anyone in your contacts list and so the next thing we want to do is we want to go ahead and setep this up so that we can schedule events on our Google Calendar there is one piece of information that's really helpful for the AI agent to have which is the current date and time uh so that way it can kind of SCH you know if we were to tell it like schedule a meeting for Friday it knows which Friday we're talking about uh and it also knows like what time zone we're in so we can just say the current date slash time is colon and if you type curly bracket curly bracket and we can do dollar sign now you can see here this just went green and this means that we have a current date and time and this is the format right here uh we can see this is all set up I don't really understand what this means but I know NN does and the AI agent does so this just is kind of a representation of the date and current time so this agent will now always have access to this information when we need to schedule stuff so really all we need to do now is we're going to save this and we just need to hook up our Google Calendar so I'm just going to go ahead and click the plus one more time and if we type in calendar the Google Calendar tool pops up I'm just going to go ahead and click that go ahead and create a new credential if you don't have one already I'm going to sign in with Google right now this is just giving n8n access to our calendar and I'm going to go ahead and click continue and this connection was successful again this takes a couple seconds so now that you've created your connection all you have to do is just go down to the calendar and you can just go ahead and select your calendar from the list and right now we can see the start time is set to now and the end time is now plus one hour but we can just have the model set this up for us so again we can just go ahead and click these little sparkles and now the AI agent will actually figure out exactly what we're talking about and schedule the proper meeting for us it's actually amazing how incredibly efficient these agents have gotten and how little input you really need to give it and so one other thing we want to add to this is we just want to add the attendees right so again if we're trying to schedule meeting with Brian we need to make sure that he's included in this and we can just go ahead and click the Stars you can see all the other fields that you can add uh if there are other things that you have you know like a location like if you're in the office and there's an office that you know room let you want a book or something like that right or if there's a summary that you want to add to the meeting or description and so we've added the attendees and there's one more field we want to add in is we just want to scroll down and we want to add in the summer which is the title of the event so that we actually know uh what the name of the event is and so we can just go ahead and we can let the model uh kind of fill this into using Ai and so now we can just open the chat back up and we can say schedule a meeting with Brian on Monday at 10 a to discuss baseball so now what it's going to do again it's going to search our contact list right it's going to then kind of find Brian it's going to schedule this meeting in our Google Calendar with Brian to to talk about baseball cool and so you can see this says I scheduled the meeting with Brian Johnson on Monday February 24th 2025 at 10: a.m. to discuss basball that gives me the meeting details here what's also cool these agents are so smart this says I have also sent an email to Brian to inform him about this meeting so not only if I go over to my calendar do I have this meeting scheduled at 10: am uh with Brian to discuss baseball which is great I also have an email drafted that just says hi Brian I scheduled a meeting to discuss baseball on Monday the 24th uh here and then here are the details right so this is like already really incredible we could tell the AI agent to like embed the link to this uh instead of having this big long Google link uh but again you can see how incredibly powerful these systems are so now we can go ahead and we can link this up to telegram so that we can type into telegram or use voice memos uh to basically give this agent instruction from just from our phones or anywhere in the world and so I'm just going to go ahead and I'm going to delete this trigger because we need to add the telegram trigger so if we come in here and we type in Telegram and basically we just want to go down here to where it says on message because when do we want this to trigger anytime we send it a message and now we go need to go ahead and we need to create a new credential and so if you're inside a telgram basically all you need to do is search for this bot called the bot father so go ahead and click into him and you can see I've already done this a couple times but if you want you can just type back slash start and you get a whole list of commands and what we need to do is we need to create a new bot so you can either type Slash new bot or you can just go ahead and click this here so please choose a name for your Bot and we can call this scheduling agent or why don't we call this Communications agent okay let's choose a username for the bot and it must end in bot so why don't we just call this Communications bot that name is already taken so we'll just go ahead with Communications agent bot it's a little long but that's okay and this will give you uh an access key or an API token so just go ahead and copy that and come back into nadn and paste that in go ahead and click save and literally in a couple seconds we've created a credential and now we're all hooked up to Telegram and ready to go so now we're here we're inside our bot and if we come into Telegram and we click test step it's just going to be listening for a new message from us we don't have a message currently but you can see that this is all hooked up we're starting to get some information from it if I come in here and type hey what's up and then I go ahead and click test step again now you can see that if we come into text here we can see this received my message it says hey what's up we're good to go and so there's basically two things we need to do we basically need to send this down two different routes one for text and one for voice and then we need to merge those back together and pass those to the AI agent and so basically what we need to do is we need to decide whether this received a text message or a voice message and so this module or node that you can use is called a switch node if you come in here and you just type in switch this will basically route the items depending on what it's received and so the first thing we're going to do is we're basically going to look to make sure that this text message exists as text and so we can just come down here and we can change this from is equal to go into string and we can go to exists and we can drag this from text and we can say exist so now we're just looking to see is this a text message does this exist and so what I'm going to do now is I'm going to send myself a voice memo just so we have access to that field too so now I can come into Telegram and I can just hold the microphone and I can say test test test test test test test test test and this is going to go ahead and send this off so now I can come back into this telegram trigger and click test step and basically now you can see that this is switched from text to this kind of file ID uh situation which basically means that we've now actually received an audio file and not a text message and basically now what I want to do is I just want to look for a file ID to make sure that this file ID actually exists and so this way I know that we actually have an audio file and what we can do is just so it's really clear we can go ahead and rename these outputs and we can just say text and we can say audio so that now when we come over into here with our switch tool we can basically see we just have these two routes so it's really clear what we're doing so for good measure what I like to do is I'll come into Data transformation and we can go ahead and type in edit fields and so basically this is like a set variable module inside of make.com we can just go ahead we can execute these previous nodes now let's come back in and type something into telegram so we can go ahead and do this test the step I'm going to go ahead and click this pin up top so that we have access to this data same thing here I'll test this step and you can see now we have our text that I just randomly sent now in the edit Fields I can come down here and I can drag in this text field here from the telegram trigger and so now what this is doing this is just storing the text from the message that we've sent and we can just rename this store text and now what we need to do is we need to grab our audio file so if I click this and I click cck p i can unpin that data I can come back to telegram hello hello hello hello hello go ahead send that off come in here test the step you can see we have our file ID again we can pin this data Here and Now what we need to do is we actually need to download this data from telegram so I'm going to click the plus here if I come into telegram we can go ahead and we can go get a file we can just execute the previous node so now it's pulling in all the data from everything before it and basically we need to pipe in the file ID that we grabbed from down here so we can put this in here and so what this is doing now is this is actually getting the audio file and so what we need to do with that audio file and so we can use this with our AI agent is that what we need to do is we need to transcribe this using chat GPT so I'm going to go ahead and click the plus and if I type in open AI what we can do now is we can come down to transcribe a recording and we'll execute the previous node which is great this is downloaded here and the input field is is data and if I go ahead and I can click test step here what this is going to do now you can see hello hello hello hello this transcribed our audio file and now all we need to do is we need to just pipe these back in to our AI agent so that it can kind of execute the task from telegram instead of just the chat bubble here inside of NAD and so in order to do this all we need to do is we need to add what's called a merge node if we click the plus here you can go ahead and click merge and number of inputs is two we can just basically see here we have to store text into one and the other one into to and now we can pipe this into our AI agent so what this is doing is this is basically just a way for us to combine the data whether it's text or whether it's audio and pass along either way to the AI agent so I can go ahead and I can unpin this I can click save and now what I'll do is I'm just going to go ahead and test the workflow and what this is going to do you can see this is now spinning and what it's doing is just looking for a message from telegram to come in so we can say message to Brian asking him how the weather is if we come into n we actually have an error in our AI agent and this is because you can see this is the window buffer memory this was basically before was linked up to our chat node and we don't have a chat node anymore right we're using telegram instead and so what we need to do now is we actually need to hook the text up from our merge node here and we can come in to our Windows buffer memory here and so now instead of this key being from the chat before we can just go ahead and plug in the ID from our chat and so now this will actually remember everything that we're have all the conversation that we're having in telegram instead of from the chat module inside of NAD so now if we go ahead and click test workflow it's listening for something from telegram we can go ahead and copy and paste this message draft a message to Brian asking him how the weather is now you can see this just got sent to our AI agent it's getting our contact list it's sending everything over to Gmail it's remembering our conversation and now if I come into the drafts here we just say draft quick question about the weather hi Brian I hope this message finds you well I just want to check in and see how the weather is on your end thanks me and just to make sure everything's working properly let's go ahead and make a voice request as well so let's just test this workflow schedule meeting with Brian for Tuesday at 9:00 a.m. to discuss how rainy the weekend was so you can see this is coming in this is transcribing the message it's getting passed to our AI agent the open AI chat model is searching it it's looking at the calendar it's schedule of the meeting it's writing Brian an email letting him know so now if I pop over to my calend we can see 9:00 a.m. meeting to discuss weekend weather with Brian as uh the attendee and if I head over to drafts I'm going to draft I can say meeting scheduled hi Brian I've scheduled a meeting for us on Tuesday to discuss how rainy the weekend was looking forward to our conversation F Duncan so there you go congratulations we just built our first AI agent inside of NN if you enjoy this video please make sure you subscribe to the channel and if you want to see how we buil an AI agent inside of.com check out this video right here I'll see you over there