I built a $10k/mo AI agent in 20 mins with Cursor AI

I built a $10k/mo AI agent in 20 mins with Cursor AI

Show Video

In the next 20 minutes, I'm going to show  you that how you can build an entire AI   agent end-to-end using just cursor AI. If  you have been following socials lately,   you would have noticed a lot of buzz around  AI agents. Within the span of last one month,   the search for the term AI  agent has already doubled. So it just tells you the amount of  interest that is out there. And if we  

try to evaluate if there is fluff or there  are actual use cases for using AI agents,   then there are so many. This is a thread  within the AI intelligence subreddit. So over here, if I look at some of the examples  where people are mentioning the things that   already agents are doing at their workplaces, this  server project engineer mentions that there are   so many issues like low disk space server down  and all of that happens in their workplace that   can be easily automated through an agent. Then  this other example where a person talks about   how front-end consultants are paid thousand  dollars a day and with Microsoft co-pilot   agents that are recently added into the teams,  the entire task that these guys were helping   out with can be automated using software.  So there are so many use cases out there.

In this video, we would be exploring one of those  use cases. We would be building out a customer   support agent workflow for a mobile service  center. So let me show you how this works. A person sent a message to the service center.  The message says Hi, I dropped my iPhone and I   want the screen replaced. Can you tell me  how much it costs to replace it? And how   long will it take? Also, do you offer any  warranty on repairs? So this is the query.

Let's run this and see that what response we  get from the agent. We got this response from   the service center agent. So it mentions  that iPhone 13 repair would be possible. It mentions you need to pay around  $199 to $299. The replacement would   take two to three hours and there is a  90 day warranty on all the repairs. All  

of these are things that we customized  in the knowledge bank or the backend. So this basically went through the knowledge  base and got those details here. Along with it,   it also mentions that we offer a  free initial diagnosis and there   won't be any charge for it. Overall,  I find the response to be quite good. It tackles all the points that the  customer wanted to know. Let's try   adding a follow up to this. So over here,  the person is asking that can they book  

a slot for Saturday? And what would be the  time available? Let's run our agent again. It has generated a response. Let's go and check   the response that we have got. It tells  that on Saturday, you can book a slot. It mentions that the working hours from  10am to 4pm and it mentions that for Monday,   the availability is present at both 10am and  11am. And at the end, it also signs off saying   Jenny AI agent mobile service center.  So let's get to building this AI agent.

The first step is that we want  to create a workflow for it. So   if we look at our workflow here,  this starts with a person sending   us an email. So this is basically the  email that we were entering over here. Then once the email is received, it processes  the email to understand the intent. Is it for   getting a mobile repaired or is it for  collecting a bile that they might have   submitted earlier? Then it makes a plan to  respond. For this, it uses various tools.

It can use tools like rag, which is  basically a way of saying that it   would be going through the knowledge base,  seeing all the appointments or the cost of   repair for every device. It can also use  search where it can go on Google and find   something that the person would want to  know. Then based on that, it fetches the   response of all the functions and finally it  creates a response based on all the findings. Then it sends the response back to the customer  and finally it monitors the entire conversation   in the future as well. Then it responds to  that as well. So that is entire workflow. This is for the customer support agent for a  mobile service center. Similarly, you can build   agents for anything. You can ingest data from  social media platforms or email or anything else.

So let's get into building it. To start with,   I will open up a new window in my  cursor. I will open up a new folder. So within this, you can create a new folder. You   can use an existing one. I will  open up a my projects folder.

Within this, I created a subfolder  called AI agent. So within this folder,   I will start creating my documentation. So our   plan is to create a PRD that we can follow  for the rest of the process of building. So to start with this PRD, I would need  the documentation for creating this. For   this documentation, I would be requiring  reference documents from the APIs that   we would be using. In this case, that  would be chatGPT or OpenAI and Mailgun.

So we would be using OpenAI for all the reasoning  that goes behind and we would be using Mailgun for   sending the actual emails. So I will start with  creating a folder. I will call it reference docs. Within this folder, I will create a new subfile.  I will call it OpenAI docs. So within this,   I want to put up a reference documentation from  OpenAI that we would be using in this case. So for getting this, I will go to  platform.openai.com to get their   documentation. And within this,  the first thing that we want to  

get is text generation. So I  will just copy this from here. I will paste it in here. Then I would  be getting structured outputs. So these   are basically all the capabilities  that OpenAI provide in their APIs.

You can see that which one is  required for your own. For example,   if you are looking to build an agent that  takes image as an input, then vision might be   helpful for you. In this case, I'm using text  generation because I want to generate text. I'm using structured output for  storing data and then I would be   using function calling as well. So this  calls required function based on what   your customer request is. So now we  have all the docs from OpenAI ready. Next, I will create a new folder. I will call  this folder Mailgun docs. So within this,  

I want to get all the required  documentation from Mailgun. So I will go to Mailgun's API  documentation. So within their   website, I will go to API reference and to  messages because I want to send messages   using it. So I want to use  Python for creating my apps.

I will choose Python over here in the  request sample and then I will copy the   rest of the page. So let me grab this.  Okay, so I have everything from here. Let's paste this in my documentation. So  now we have the documentation ready. So   the next step is that we want  to create a PRD out of it. So within my app, I will create a  new file. I will call it prd.md. I   will keep it blank for now because this  is the output that we want to generate   using OpenAI. So I will open up  a new chart window over here.

In this chart window, I will select  OpenAI's o1 model because it's the   one when it comes to planning the  entire project for you. And for this,   I would be using a prompt. So this is a prompt  that I've used in a lot of cases in the past. So this includes the guidelines over  here that I've seen work well with o1.  

It directs it in the right direction. You can  get the prompt from the description below. And within this prompt, you  can basically just change the   highlighted part and you will get the  agent you want to build. In our case,   we are trying to build a customer support  agent for a mobile service center service.   So this is based on the initial flow  that we wanted to create for our agent. So I've just gave this flow to ChartGPT  and I asked it to give me the steps for   the implementation. And I put up those steps  of implementation within my PRD prompt. Now I  

will copy this entire prompt from here  and I will drop it in my cursor chart. So I will make sure that the right documents  are added over here. So I will go up here,   I will add the BRD MD here. Then  for the rest of the reference dogs,   I will just go in here and check the name. Yes, it's correct. I want to use Maryman dogs  here. And I want to use open AI dogs here. So now I have the entire prompt,  I will select the o1 model and I   will click submit here so that it can  generate the entire prompt for us. It  

will take some time because o1 in general  takes some time and ingesting all the data.   It is breaking down all the lines from  all the context that we provided it. So let's wait a minute. And then we will  have the PRD or basically the steps that   we want for the implementation. The reason why  I always create a PRD while coding with cursor   is because we have this new model called  o1 which is very good at planning things,   which is very good at thinking in depth. While Sonnet 3.5, the Anthropic model is  very good at writing code. That's why you  

have to use both of these models  in conjugation where o1 is being   used for planning the entire project, which  is basically writing the PRD. And then you   can use Sonnet for implementing  all of these individual steps. So I see that it has created the PRD for us.  Let's click on apply. So I see only a part of   this was copied, I will click on accept,  I will copy the rest of the part as well. So let's click on copy here. Okay, so  let's copy the rest of the part manually.  

So we have created a PRD here. So let's, let's open up a new composer  window. Now we'll start with implementing   all of these steps, we have these steps of  implementation. So I will go in composer,  

I will select Sonnet 3.5. And  I will select the agent mode. And then I will ask it to go through  the PRD and start implementing,   go through PRD and start implementing the plan  execute step. So the first step is setting up   the project. It wants us to also put it on  GitHub, we won't be doing that right now. So I will just ask it to ignore the git command  and execute the rest. So it is creating all the   required folders here. And it is creating  all the necessary JSON files over here,   the ones that we wanted, then it's creating  a new environment for running all of this.

So I see that it has jumped some of the  steps, we wanted to start with step one,   and then come on to the step two, but it has  jumped some of them. So I will just cancel   this generation here. And I will ask it to follow  these steps in the detailed implementation plan. So I will go to the step one, and I will reference   the step that I want it to execute. So  it has created a virtual environment and   it has started installing all the  required files. So let's do that.

Okay, so first step is done. Now let's move on to  step two, I will open up a new composer window,   this is just to make sure that the window does  not run out of context. So by that, I mean that   Claude at one point of time can only process up  to 150k characters, or 150k alphabets at once. So that's why we don't want to overload or run  out of that context limit, I will open up a new   composer window. Within this, I will ask it  to execute step to execute step two from PRD,   I will mark the first step as done here, since  we have already completed it, it is creating   a dot ENV file. Within this file, we would  have to add our API keys and open AI keys. So I will go to mailgun, I will create a  new API key. And same for chat GPT. So I  

will go to my account here, I will click on  API keys, and I will generate a new API key. So we'll call it or test AI agent. Yeah, now we'll  generate this API key, we'll copy it from here.   And I will give it the API key here. This is my API key. Along with it, I will also go  to mailgun. I will also add my mailgun API key. And it's advised that you don't show your API key  like this in the public would be deleting both the   keys that I'm using over here. But if you are if  you are creating an agent, don't share your API   keys on the app itself or any video like this. And  make sure to change them if you are doing that.

So I will add my open I will add both  the API keys in the system. But it's   also asking for a mailgun domain, I  don't think so that is required. So   I will just click on except for now,  we have all the required API keys.

Now let's move on to the next part, I will open up  a new composer window for that. And we will mark   the last step being done. So come on the step  I will mark this as now I will go to the new   composer window and I will ask it to execute  step three, execute step three from the RD.

So it has created all the required files.  Now, let's move on to the next step,   I will mark this step as done. The  next step it want to create functions,   functions in reference to the mailgun API. So along with the PRD, I would also reference  the documentation that we have for mailgun.   So I will also add mailgun docs here,  please also check. So I will go up here,   I will ask it to execute step  four, for reference the syntax.

So it is creating all the required  books based on the input. So I see   that it has implemented all the  all the four API routes here,   which is to see the incoming email.  Okay, I will accept these changes. And now we will move on the next step. So  before going into it, I will go through I   will verify the step by step flow once again.  So what it does is that it checks the emails  

and it would be checking the incoming dot json  file for any unprocessed new messages if found,   pass the raw email content to the  parse email hook, and parse email   hook identifies the email metadata, and it  saves it in data dot json, then it detects. So then it has a function to identify  the intent of the request, then it,   then it goes through the knowledge base  to see that if we have a custom response   for this kind of query, or if a new response  needs to be created, if it's a custom response,   then it sends that it use the open AI hook, and  then it goes through the knowledge base and goes   through the question. Okay, the flow looks fine  to me. Now let's look at edge cases as well. Okay, so also add a step seven here. For this,  I wanted to add test data to the files that we  

have created. So this would be files like incoming  email, knowledge dot json, and schedule dot json. So data dot json would be populated based on what  response we get an incoming email dot json. So   we don't have to add test data for that. So now  that we have all these steps already implemented. Now that we have executed all  the steps until step four,   now I will ask it to implement a step five  from the BRD. I think not much is done,  

it has already created all the files.  Apart from that, I will also ask it to   check the reference files if it needs that will  select folder has any documentation health. So now let's go to step five, I  will open up a new terminal window,   I will open up a new composer window again,  I will ask it to implement step five,   implement step five from BRD and verify if we  have all the files correctly configured. So  

another new thing that comes up with the agent  is that it can read files that you don't even   reference. In this case, open AI docs was  something I did not reference in my prompt. But still, it looked for the documentation  around open AI. And it went in that file and   got the required documentation from there. And  basis that it is now creating the new files.

Right now, these models are not that smart.  But my prediction is that in the future,   once we have strong enough models that you  just have to link the right documentation   within within the app that you're  using, for example, in this case,   cursor. And from there, you can, you  know, just tell it what you want to build. And it will just pull up the right API is  the right documentation and start creating   for you. It is also test adding test data  to files. It was a part of the next steps,  

but right now it wants to add  some of these for the testing. So let it add some of this  data. And in the next step,   we will add these data points in more  depth. So it has added test data as well. So now that we have made all the  changes, let's test this ones. Can   we test our service and I will give  my email for the test data so that I   can receive the response on my email.  This is the response that I received.

So this email says, Hello, john,   the name that I mentioned in the email.  Thank you for reaching out. Sorry to hear   about the damage that it mentions that  what would be the range for the repairs,   it mentions how long will it take for the repairs  to be done, and the warranty associated with it. And then it also mentions that you can pay with  a credit card payments, you can do a walk in,   but we recommend you to book an appointment if you  want priority service, if you don't want to wait,   let's say if we even want to add a  follow up message to this. So in the   case where a person sends a follow up message  to this email, we are stimulating that case,   let's run our script again. So in the follow up,  we are asking that if 2pm tomorrow is available. Also, he's asking that do we need to  backup his data before coming into the   service center. So we got the response, it  mentioned that 2pm tomorrow is available,  

it went, it went through the entire schedule  for the day, it looked up the slots that   are already booked. And then it gave a  response that which slot is available. So that was the entire video making an AI   agent end to end. Thanks a lot for  tuning in. See you in the next one.

2025-01-21 02:39

Show Video

Other news

AUTONOMOUS MOBILE HOMES YOU CAN LIVE IN FOR YEARS 2025-02-12 07:08
Demonstrating Microsoft Dynamics 365 Sales - 2025 2025-02-09 13:11
China’s New AI Model DeepSeek Shocks ENTIRE Tech Industry...American CEOs in Shock! 2025-02-09 15:01