in this step-by-step tutorial we're going to build a very powerful agent that will have the ability to scrape and extract realtime data from popular search engines like Yahoo Google Bing beu and others so this build is going to be very simple but this AI agent is going to be very powerful basically this AI agent is going to be similar to what perplexity does where perplexity provides you the most updated information and gives you real time data and the way this agent is going to grab that real- time data is because we're going to connect it
to Ser API if you're not familiar with Ser API it's basically an API that gives you the ability to get connected to all of the data from the most popular search engines in the world again this is going to be very simple to build uh but this will be a good introductory video on how to build AI agents with Ann the last video that I did was a bit too complicated I think for a lot of beginners because the AI agent that I created was connected to a separate workflow that was connected to an API
but this one we're going to put all of that and combine everything together and connect this AI agent in a large language model like open AI um gbt 4 and then our Sur API so let's get started okay so I'm in my workflow once you log in go to your workflow and create a new new workflow and this time I realized last time I didn't name my workflow so this time I'm just going to say AI agent actually you know what I'm going to name it whoops I can't even spell Ser AI agent there you
go all right so now the first step we're going to add last time our trigger was uh manually um that's how I started but this time because we know what we're building um I'm going to add the first step as a chat so our trigger is going to be chat because again we're building this AI agent that's going to act like perplexity meaning that it'll have access to this real-time data so the way we're going to interact with it is via chat so let's go ahead and add the first step as chat so you can
either click here on the top right hand corner here so I'm just going to go ahead and first add uh first step and on the right hand side on the bottom again these are all the triggers um on the next video I'm actually going to do the trigger as a Gmail where I'm going to um go through a tutorial on how to create labels so that's going to be a really cool video anyways so back to this one um so now for this one we're going to do our trigger is going to be on chat
message you're going to come down and click on chat message uh we're going to leave uh everything as it is all right so now it says when chat message receive all right so this time we're going to add our AI agent right away so because we're not adding a separate workflow so I'm going to click on this plus button and come down here go to Advanced Ai and go down here and select oh actually it's right on top right here so I'm just click on AI agent okay we're going to leave everything as it is
again we're going to say take from previous note automatically and this is connected to our chat um so that's our trigger so I'm going to leave everything again if you you want to change the name here same thing you have the um ability to change the name on top but I'm going to leave it as AI agent all right so I'm going to click outside of this all right cool so let's attach now um our corresponding tools memory and chat model so for chat model I'm going to use um open AI but you're more than
welcome to use whatever large language model you have access to but one thing to remember if you're using a large language model you have to have an API account and you have to have some money on that API account again I've only put like $5 on my open Ai and I've used it a ton and it's more than enough uh but you have access to gr you have access to entropic uh AMA which is integrated with with um meta's large language model Lama so you can use that or the uh obviously open AI chat model
so I'm going to use open a chat model here the first thing you're going to do if your account is not connected this will give you um kind of it will show you like a little error message so you have to connect your account if you're not familiar with um connecting this so what you're going to do is click on your create new credentials and here's where you'll attach your API key and your organization ID the good thing about NN is that it actually gives you um setup guide on a rightand side right here and
you can it has a link to the doc as well so if you click on this link it will take you directly to the docs where it gives you a really comprehensive guide on how to create or attach the credentials for whatever uh tool you using and in this case um attaching your um API account open eyes API account and again you can go to your um open API documentation here and this will take you to that link where you can log in and once you log in you can go to your API page and
grab your API keys and come back and attach it right here and again on the right hand side you can see it gives you a little um summary of how you can do this by logging into your account open your API keys to create API key and the organization ID if you belong to multiple organization then that's where this organization ID would come into play but for now you know just attach your API key all right so once you do that you're going to come back and your open AI account will be attached and since
I've already done that it's there so now I get to choose my model so I'm going to use gp4 because I want to have the most powerful model and obviously you have lots of options here um if you want to further customize uh your gp4 again you can add things like uh the sampler temperature um you can increase or decrease this temperature and if you're not familiar with the temperature of how large language models work again try to Google it because I don't want to go through that explaining right now uh but anyway so we're
going to leave everything as it is and we're going to uh click outside and as you can see now our open AI chat model is attached let's zoom in a little bit there you go okay so now the next step we're going to add our memory of course uh you're going to click on memory here and we're going to choose our Windows buffer memory the buffer memory the easiest way to put this is it gives you it gives your AI agent access to previous data uh while you're chatting with it so it stores the memory
in the windows buffer meaning it can have quick access to your previous information and it allows it to reference and remember the past interactions and the past um chat history that you have done done with that particular model but anyway so I'm just going to click on Windows buffer me and again you don't have to do anything you just click outside of it and now you have this attached so I'm going to bring this over here all right so for tools the first tool I always add is a calculator so you're going to click on
tools and you're going to come down here and click on calculator so what the calculator does again you don't have to really do anything here it change the parameters or setting but a calculator allows your AI agent to perform any mathematical operation while you're chatting with it so if you're chatting with it and the AI agent needs to access or have the skills to do some kind of mathematical operations then that's where the calculator comes in I always add this tool just so it's there even if I don't need it so all right so that's
going to be our first tool the second tool I'm going to add is this is where last time we called a separate n8n work workflow tool in my previous video where that was connected to a separate API and last example it was attached to the open Weather API and I was editing the response that I was getting from my open Weather API tool in a separate workflow and then I was referencing that workflow to this AI agent so but this time I'm going to directly attach my Ser API directly to API to this AI agent
and the way to do that is if you come down one of the tools that NAD is already integrated with is called Ser API and it says uh Google search on the side but again you have um I'll show you in a little what Ser API is I'll explain a little bit and why this is a good integration to have so I'm going to click on Ser API all right so here again you have to have your credential to connect with I got rid of my credential so I could create this live in this video
so let's go ahead and do that and I'm going to walk through step by step so I'm going to come here click on create new credentials and again same thing we have to go ahead and add um our API key and I can click on this open docs right here and this will take me through the step-by-step guide on how I can create an API key and attach but it's a very simple process so what I'm going to do is go to um you're going to go to serp ai.com so this is their uh website
serp ai.com and as you can see right up front here let me zoom in a little bit as you can see they have several Integrations with several languages but the documentation so as you can see all of these documentations they have access to things like obviously most of it is Google related um cuz they have access since Google being the largest search engine in the world they have all these apis that they have access to but they have access to things like beu Bing do Dogo Yahoo eBay YouTube Walmart I mean even Home Depot uh
but anyways this just shows you that this has a huge amount of knowledge that this Ser API has access to and therefore once you connect the Ser API to AI agent that's why I was mentioning in the introduction of this video that you're entially creating a perplexity meaning that you will have the most updated information because it's all coming from these popular search engines and the beauty about Ser API is that it's not limited to the to pre-trained um data that a lot of these large language models like chat GPT or even perplexity and llama
are all trained upon because obviously they have to be trained on a base model and sometimes in in the case of chat GPT for example that data is limited to a certain amount of time and I know they say they have access to the internet but the information that you get from uh chat GPT for example on uh things that require access to realtime information from the Internet is unfortunately not accurate all the time so that's why things like Sur API becomes so relevant and another advantage of um having your agent access the um or
get connected to Sur API is not only does does it provide you the most real data but it also has access to data like organic searches or paid ads that Google or these other search engines already run right so that's what makes it very very different compared to these um existing pre-trained large language Models All right so that's a little bit about Ser API uh so let's go ahead and register for our accounts I'm going to click on register all right I'm just going to sign up with Google all right I'm going to click on
sign up with Google I'm going to give her access to my account it's good to go all right I'm signed in so let's go ahead and subscribe so they have several oh I forgot to mention about their pricing okay so they have several plans right now I'm on the free plan and that's all you need to be honest but just quickly um so here are their different plans they have available so if you want to you know if you are doing 5,000 searches a month then you're going to get on developer production big data but
the free account gives you 100 searches a month and in our case that's good enough because we're just building I'm just building this AI agent for um for this demo purposes anyway but go ahead and sign up for your free account and so when you come here just make sure you're clicking on that free plan and I'm going to click on subscribe let's go ahead and do ah this thing is so annoying all right I need to verify my email all right confirm email email has been confirmed sweet oh I forgot we need to verify
the phone so I'm just going to add a phone number here and verify this all right so now I have my account I don't know why I'm so zoomed in here there you go all right so now I am in my account and as you can see on the top here it says your plan usage for this month 100 searches so on the left hand side again I don't even have to add a credit card so that's good to go okay so now let's go ahead and grab our API case you're going to come on
the left hand side here and click on API key and here's my API key you can always regenerate an API key which is what I'm going to do because after this video I'm going to delete this and regenerate it and you should do that too don't share your API keys with anybody uh so I'm going to go ahead and copy this API key and we're going to come back to our NN account and paste it right here and click on save it says credential successfully created all right cool so we got connected um you can
add properties so for example if you want to specify this to a uh the results to a country to a device or you can have an explicit array that you want to add so all of that option is available for you like I said you can do it even with a country so like if you want to have you limit the searches are just to uh us or some other country you could do that and again this gives you that optionality that things like chat GPT uh or other large language models don't have right because
they're um trained on massive amounts of data that are not specific but with connecting to Ser API you can actually limit to um different options and you can add these things like and even you can actually limit even limit it to a Google domain right so if you only want to have access to google.com's search results you can you can uh specify that and have it um just be Google domain and if you want to for example have it uh in the US or just explicitly train it for English you can add all these parameters
that will give you more of specific data that you're looking for right so again this is what makes this AI agent so great because you can add all these parameters that usually that normally you're not capable of if you're just using things like proxity or uh chat gbt or uh entropic so for now I'm just going to leave it as it is let's just get rid of these and let's test it out and we can always come back and um test it later on to see if we can limit it to a certain country all
right so we're good to go here let's go ahead and test this I'm going to come and save this here it's always good to save okay so let's go ahead and test this I'm going to click on chat here so for the prompt I'm going to try to use something a prompt or ask it something that's going to be relevant to um the most updated information that a search result will have access to versus things like chat GPT right okay so let's say what are the best restaurants actually what are the top rated restaurants in
San Francisco let's say so this should um be able to pull up the most recent rated restaurants right because it should have access to uh Google's search results and all these other search engines that will provide the most updated information all right there you go so it provided the top um restaurants and to be honest I kind of agree with this because you know I live near San Francisco so I'm these restaurants are very popular and as you can see you know this gives it um on the right hand side this gives you that log
so um initially the AI agent um went and updated the windows buffer memory used open aai chat model and use Sur API right and the response as you can see came from Sur API and it updated or it used chat GPT and updated the memory again so as you can see this gives you really uh up to- dat information that's something like a chat GPT won't have right so let's go ahead and see uh maybe today's weather that's a good way to check too what is the weather like today in San Francisco and I can
confirm this on my phone to make sure that it is accurate so it says 65° yep it's 64 65° Perfect all right so all right well hopefully this gave you an idea of how to build this simple AI agent um and as you can see it it even though um is very simple to build but you can tell that it's very very powerful because essentially you create your own local perplexity and again if you want to customize this so let's say you want to add like I mentioned before the country so if you want to
only limit it to for example let's say I don't know this time I want to limit it to Canada right um You can do limited to Google domain um to google.com and you can use or you can use some other domain other Google's domains so let's go ahead and do that and see what we get this time so this time if I ask it so let's save this let's go back to chat okay so now let's ask it what are the most famous what are the top rated restaurants in Toronto this month all right so
let's try that and again we're specifying the time because it should be able to have access to that information via the um search search engines that it's connected to all right perfect there you go so it provided that information so now let's test this to see if it's going to give me um the information related to you a city in the US for example right so let's go ahead and copy this and paste it in San Francisco what are the top eight restaurants in Seattle this month okay so this shouldn't give me an answer now
because we limited the domain to Canada only so hopefully it will work oh there you go see I'm sorry but I don't have the ability to find latest ratings for restaurants it's just giving you an error obviously it doesn't know how to respond because we never specified what to say in an instance that a user is prompting it or asking this AI agent a question that it doesn't have access to that data but so it's just going to say I'm sorry if I don't have the ability to find ratings blah blah blah so you can
see it's really really uh it could really become very powerful if you further customize this right okay so now let's go ahead and get rid of this so let's save it all right well hopefully you found this helpful uh on the next tutorial I'm going to create um an AI agent that will label and organize all incoming emails into our inbox so stay tuned for that one I will see you on the next video thanks for watching