Build your first NO CODE AI Agent in n8n (for beginners)

Dr. Violet Howard builds a no-code AI agent in n8n with two workflows: one that fetches weather from OpenWeatherMap and formats it with OpenAI, another that handles chat messages and can search Wikipedia or call the weather tool. The agent uses a memory buffer and system prompts to decide which tool to use.
Chapters
Today I'm going to be walking through step by step how to build this AI agent in N8N. No prior coding experience is needed. You'll be able to get this agent up and running within 15 minutes. So by the end of it, you'll have a great idea of how to build tools in N8N and how to have agents call different tools in order to be as effective as possible. So I wanted to start off this video with a quick demo of what this agent looks like and what it's going to do. Here's what it looks like. It's okay if this doesn't make sense. By the end, it all will. You can see the tools we have access to are Wikipedia and the Get Weather tool. This is one that we create in N8N. But let's just chat with this agent to see how it works. So let's ask it, what is the capital of Florida? We get the capital of the US state of Florida is Tallahassee. If you need any information about Tallahassee or anything else, feel free to ask. So let's say, what is the weather like? There. Oops, misspelled there, but it should be able to be fine with that. The weather in Tallahassee is currently partly cloudy with scattered clouds. Temperature is warm, 80.56 degrees Fahrenheit, bit humid, blah blah, gentle breeze blowing, and blah blah blah, enjoy your day. Okay, awesome. So that's sort of how it works. Now let's go and get into actually building this thing. So the resources needed here are going to be N8N, the weather API, and OpenAI API. So this is just how we're going to build the workflows, how we're going to access current weather information, and then OpenAI is just how we're going to— how the agent is going to think and get the information and formulate a response for us, pretty much. So the workflows we're going to be building today, just two of them. The first one is the tool, the get current weather tool. and then we'll be giving the agent access to that tool. And so the second workflow is the AI agent. Yeah, let's just hop right into this one. So the first thing I would advise you do is set up the OpenWeather account. Um, just type in OpenWeather Map, I think it might be, but you're going to want to set this up and sign in or sign up as soon as possible because your API key takes 5 to 10 minutes to actually process as valid. So once you make your account, you'll go right in here, click on my API keys. I'm going to disable this one after the video because I'm exposed now, but your key will be right here. Or once you verify your email, they'll email, email you your key. And they say within the next couple hours, but I've found it usually takes about 10 minutes. So get that set up and then we can hop into actually building this thing so you don't have to be sitting around waiting. Okay, so back to N8N. Okay, so we're gonna add a new workflow. We're going to add the first step. So you always need to add a first step when you build a workflow in N8N. There's a lot of things that can trigger workflow. You can trigger it manually, it can be on a schedule, you can chat with it. We're going to do when called by another workflow. We're doing this because when we talk to the agent and it thinks, oh, I need to get weather information, it's going to call this tool. In order to do that. So that's how this one's going to execute. Now we're going to add a set field, edit field set. We're going to leave it as manual mapping, and then we're going to add a field here. So let's call this one city. We can leave it as string, and then the value for now will go Chicago, just so that we can test if the weather API is working. But in the end, we're going to come back and fill this in as a variable because the city we're searching for is going to change based on what we ask the agent. Okay, so we're good there. Now we need to add the weather app. So open weather map, we can either return current weather data or return data for the next 5 days. So this could be useful if we wanted to build an agent that can do a bunch of stuff with weather data, but let's just do current data for now. This is where you're going to put in your API key. So this access token is just the API key, like I said, in here. Go right there and paste that in. So I already did that, obviously, so not going to do that. Current weather, I'm going to go imperial format. We can select a location from this weather app based on different things, but we're just going to stay with city name. And then right here is— this is what city we're searching for within the app. So we're going to execute this previous node, and as we can see from the set fields node that we just made we have the field of city with the value of Chicago. So if we drag this into city, this is going to change the search— the search in OpenWeatherMap based on what we typed into this field. So we can test this step, and now we can see this data that came back. So let's just go to table format so it's easier to view. Oops. So we have weather, clouds, description. We have the temperatures We have the wind, we have all this information, and then we have the name of the city that we searched for. So just really quickly looking at the data, but we know that this node worked. So the next node we need to add is an OpenAI node. Lots of options here with an OpenAI node that we can take, but we're going to go with message model. Okay, so you're gonna have to connect your OpenAI if you haven't done that with a credential. Same exact thing as OpenWeather, just needs an API key. So you'll go into OpenAI. If you haven't made an account, make one real quick. And then you'll just go to your API keys over here on the left, create new key, name whatever you want, and then create key. And it will just give you the option to copy your key and— sorry, paste it right into here. Super simple. All right, so we're gonna keep it as text, messenger model. We're going to choose the model. So I'm going to choose 4.0. And now we need to give this a message. So what is this OpenAI node going to do? So let me just paste this in here real quick. So what we want to do is we want to put the parameters below into a single query field, ensure it is a string. So this is the data that's coming back from OpenWeatherMap. And now we need to put all of this into one field so that the next node can sort of interpret it and make it into plain English. And so we have troubles with this because a lot of these are, as you can see, main, for example, is a string because it has an A, but weather is a block or an object, and main is an object. So we need to make sure that these are all strings. So the first thing I'm going to do is we're going to start making these parameters. So weather description, and then all we want to do is drag in right here the description. Okay, actually let's go, let's make this full screen so you guys can see this either. So we've got the description and then over here it's saying that weather description is overcast clouds, overcast clouds. Wow. Okay, so we've got description. What else do we want? We want the temp. And same thing, we'll find temp over here, drag that right in so it knows it's temp. As you can see over here, it came in as 62.5. Okay, so I'm just going to do this with a couple more variables here and then I'll see you guys in a sec. Okay, so I only ended up doing 3 more, just a really concise look at what the weather's like. We've got weather description, temp, humidity, wind speed, and then what city we're in. So we're going to go here and now we just want to test this step to make sure that it came out correctly. Okay, so we've got it in a simple field, although it came in a little weird because it was called content, but this should work fine. It's got all the stuff we need and it's in a string, so we'll be good here. Let's add another OpenAI node. We're going to do the same thing, Messenger model. All this is going to be the same. We're going to use 4.0. Once again, and then this time we're going to say convert the content field, which is going to be this one right here. So convert the content field into simple English in a friendly tone. We want to use— oh, sorry, I cannot type today. Use emojis to describe the weather. Okay, so this one is going to be a system prompt because this is telling the OpenAI node what to do. We're going to add another message. This is where we're going to drag in content. And so this sees like what exactly is going on down here. Sees the weather description, everything we just set up last node. We'll keep it as user and let's test the step to see what comes out. So we get, hey there, here's the weather update for Chicago. It's mostly cloudy with overcast skies. The temperature is around 62, blah blah blah. So it gave us the weather and it put some emojis in there. It's very friendly. Let's just throw in here, include a joke. Test it again. It's going to say, looks like we're in for some cloudy skies. We've got a bit of a breeze going on too. Don't fight skeletons. Why don't skeletons fight each other in the wind? They don't have the guts. Okay, we'll leave that in there. Just fun example. So that threw in a joke. So we're pretty much done here because it got what we needed as far as the weather. We parsed it through, and now we need to add another set field because we need to communicate back to the agent, hey, we grabbed this information and now here it is, so you can give it to the user that asked you the question in the first place. So manual mapping, once again we're setting a field. We're going to name this one response. It's going to be left as a string, and then for value we're going to grab content and put that right in there because this is just telling us exactly what the agent— or exactly what we just read, right? So awesome. And now we can save that. Let's call this, um, get weather. So this is our get weather workflow. And now we can go make the agent. So we're going to go back, add new workflow. This is going to be the Weather agent demo. Okay, so first step, back to the triggers I was talking about earlier. This one is going to be triggered by a chat message because we'll be talking to the agent. So we've got this. Next, we want to add an AI agent. So you can click on Advanced AI, and then you've got the agent right here. So we're going to leave this as a tools agent because it's going to be calling in different tools. Prompts will take it from the previous node and then system message, we will come back here in a sec and prompt this agent exactly what to do. So the chat model, we need to use OpenAI. That's just the one I always go with. And I'm going to use 4.0 once again. We're going to give it memory. So if you remember in the example, I asked the agent, what's the capital of Florida? And then it came back and said the capital of Florida. And then I said, can you get me the weather for there? Or what's the weather like there? If we didn't put in this buffer memory, the agent wouldn't have remembered that we just asked what the capital of Florida was, so it wouldn't know what there was. So I can show an example of that near the end, but this is important just to give the agent some context of what's going on. And so that's what this means. This is like context window length. You can make it how many past interactions. Does the model receive as context. We're going to give it a quick Wikipedia tool. Super simple. You don't even have to really set anything up. This is just giving the agent the ability to search through Wikipedia. And then finally, we want to use call N8N workflow tool. This is where all the magic happens because this is the tool that's going to— we're just going to call this one weather. Once again, weather. So you have to give it a description of when to use this tool. So very, very basic. Call this tool to access current weather information. I'm going to go there. We can leave this as database workflow from list. You can either do from list by ID, but it's super nice that they let you just choose from a list of the workflows you've made. So we're going to use— this is the one I just made get_weather, and then the field to return is response. So if you remember at the end, we made that set field where we dragged in the response from that last OpenAI node, and the field was called response. So that's how it knows what to say back to us. So we've got that there, all good to go. So let's actually not prompt this one because I want to show you guys what it does when we just leave it as helpful assistant. It should be fine because this is a pretty simple workflow, but let's just go ahead and give it a try. So what is the weather like in Denver? We can see what's going on here. It grabbed the weather, then it talked to the model. Let's see what it said. Weather is currently cloudy with a temperature of 62, blah, blah. So as you can see, you might want to wear a light jacket if you're heading out. Okay, so gave us the weather. But it didn't give us the emojis that we asked for. So we can see exactly what happened here. If we go to all executions, save that real quick, we can see what happened in the get weather tool. We can see exactly how the data moved through to see if the workflow was doing what we wanted it to do. So give us a second here as it loads up. Right here we see Oh, I know exactly what happened, exactly what I was worried about. We didn't change this back to a variable. So let's go back into that workflow and make that a variable to make sure that this is actually working correct. So get weather. Now we need to change this to a variable. So if we put this in here as json.query and make it an expression Then it knows that it's going to take whatever we chat and it's going to put in the city here. Okay, so let's save this and try that again now. All right, so what is weather like in Denver? Weather in Denver is currently clear with a temperature of 69, the humidity is 39%. Okay. So now let's make sure it's working. What is the weather like in Hawaii? Just to make sure that it's actually using different city names or state names. Currently experiencing light rain. Okay, so it's working here. Here's a little joke to brighten your day. Why did the weather bring a ladder to work? Because it wanted to rise to the occasion. Oh wow. Okay, um, so now let's test out the Wikipedia node. So what is capital of Hawaii. So the capital of Hawaii is Honolulu. Now let me show you guys if we get rid of this memory buffer, save that. Um, what is the capital of Utah? So remember earlier I was able to say what's the weather like there? What is The weather like there. And now it shouldn't— yeah, see, can you please specify the location they want to know the weather? Because it can't remember that we just talked about this. So, um, yeah, let's add that back in here. Okay, so I want to try one more example so I can show you guys how the data is moving through. So let's just go like, what is the weather in San Diego. So we've got the weather in San Diego is currently experiencing scattered clouds, humidity level, breeze. It's a great day to be outdoors. Okay, so we're going to go into all executions, and this is how we're able to see exactly what happened in that getWeather tool. So we can see here the city came in as San Diego because it was a variable. It came through here, got the weather, we parsed it, it came out here. And if you've noticed, this content is not exactly the same that we got what the agent said to us. So this is probably because of the way we prompted it. So let's go back in here. And I don't think it pulled up. Okay. So the prompt right now was just, you're a helpful assistant. If we prompted a little more, a little heavier, it'll be better with its response. So this is not the way that I would recommend prompting, especially when you get more tools. You always want to give it good background, good context. You want to give it specific instructions of how to use each tool, what the parameters in each tool might be. But for now, let's just say you are an assistant used to access weather information anywhere around the world. And so what we want to do is make sure that it's giving us all those emojis and the joke that we asked for when we originally gave that OpenAI node instructions. So please return the response from the getWeatherTool. Okay, so we'll save that and see what happens. Actually, let's go in here and just call it the weatherTool since that's what we called it right here. So what is the weather like in Tokyo? The current weather in Tokyo features broken clouds with a temperature of 72. There's a brisk breeze with wind speeds around 17. Okay. So if you guys notice, that's still not giving us exactly what would be coming out from here. So let's just refresh this. We'll get that most recent execution. Um, yep. Okay. So this is what the tool was giving us at the end. As you can see, there's more emojis. There's a little cloud or a little joke at the end about clouds. And then here we didn't actually get that full— we didn't get the joke, we didn't get all the emojis. So this has to do with prompting. Okay, so I finally got it working the way that we want it to be working. I asked how the weather is in Spain. Hey there, here's the weather update for Spain. It's a brief update. It ends with a joke. Why did the weather bring an umbrella? Because it wanted to be a little shady. Stay comfy, have a great day. So I found that it was actually better to prompt the agent to do the jokes and the simple English and the emojis in the actual agent prompt rather than prompting it in the weather tool itself. Not sure exactly why that is, but prompting is super, super interesting. And like I said, this isn't the way that you really should be prompting a complicated agent. So if you guys are interested in a video more about prompting, let me know and I can definitely try to work on that. But yeah, that's pretty much what this agent is going to do. Like I said, you have the ability to ask information about different, different countries, cities, whatever it may be, and then ask about the weather there. So it's a simple agent, but it should open up your eyes to the capabilities of agents being able to call different tools, being able to search the web for different things, and just sort of how you can combine all of that into one agent or multiple agents that are able to call each other. And yeah, I'm sorry for sort of the interruptions in there in the middle, or sort of me forgetting to do things, but, um, I like to build these live so you guys can sort of see the way that I think through the flow of the data. So I'm going to continue to make sort of step-by-step tutorials like this and try to explain everything to the best of my abilities. So if you enjoy this type of content, please let me know. And yeah, that's it for now. So thanks, guys.










