WEBVTT

00:00.800 --> 00:01.440
Welcome.

00:01.600 --> 00:10.120
In this episode, we are going to build our very first agent and it's going to be something super practical.

00:10.440 --> 00:12.040
It will send emails for us.

00:13.040 --> 00:18.800
So this is probably one of the easiest agents you can build, but also one of the most useful.

00:19.440 --> 00:26.200
You will see how quickly it all comes together, and by the end of this tutorial, you will have a fully

00:26.200 --> 00:31.760
working setup that can understand your instructions and send emails automatically.

00:32.520 --> 00:41.520
So we will communicate with our agent via built in open chat and instruct it to send emails for us.

00:43.040 --> 00:46.480
And our agent is going to call tools.

00:46.480 --> 00:49.040
So Gmail Tool and Contacts tool.

00:50.040 --> 00:57.920
So it will retrieve the email address from the Google sheet I've prepared, and then craft an email

00:58.280 --> 01:00.240
and send it to that email address.

01:00.480 --> 01:07.800
We use a simple memory so it will remember the history of our conversation from our open chat, and

01:07.800 --> 01:10.880
we can specify how many messages we want it to remember.

01:12.320 --> 01:18.240
And we will trigger our an agent by this chat message.

01:18.920 --> 01:27.240
But you can easily connect third party apps like telegram, slack, WhatsApp, and you can find how

01:27.240 --> 01:32.880
to set up credentials and connect these nodes in the How to Setup credentials section.

01:33.880 --> 01:39.840
So you can either follow me step by step, or just copy the whole workflow and tweak it to your needs.

01:40.240 --> 01:47.920
And it's totally up to you, but I strongly recommend to learn with me along the way so we fully understand

01:48.240 --> 01:56.240
how it works and how you can build on top of that, and also how to add more tools to your agent.

01:57.000 --> 02:01.470
Alright, so let's start building and Create our agent from scratch.

02:02.510 --> 02:03.990
So let's create the workflow.

02:06.670 --> 02:11.030
First I'm going to add a chat trigger node as a trigger.

02:11.030 --> 02:13.510
So that will activate our agent.

02:16.710 --> 02:18.350
So let's search for chat.

02:20.950 --> 02:22.150
And select this one.

02:24.630 --> 02:25.870
Now let's close it for now.

02:28.390 --> 02:29.830
Now let's add our agent.

02:30.870 --> 02:32.270
So search for agent.

02:34.830 --> 02:35.870
Press on this one.

02:37.630 --> 02:40.470
So this is where we define the brain of the operation.

02:40.950 --> 02:47.670
So now to make the agent actually understand us I'm going to connect chat model.

02:51.950 --> 02:55.990
So we are going to use OpenAI GPT for all model.

02:56.430 --> 03:06.830
But you can choose your favorite large language model such as cloud, Gemini, grok, Mistral and you

03:06.830 --> 03:09.990
can connect to any LLM via operator.

03:10.750 --> 03:17.750
And I'm going to explain how to use operator in the setup credentials section.

03:18.990 --> 03:26.790
So if you are looking for LLM that has a dedicated node in N810, you can use operator.

03:27.830 --> 03:28.190
All right.

03:28.190 --> 03:29.790
So let's use OpenAI chat model.

03:32.670 --> 03:34.190
Now connect to your account.

03:36.110 --> 03:40.230
And from the list choose GPT four mini or GPT for all.

03:40.710 --> 03:43.510
For this particular example you can use GPT four mini.

03:44.070 --> 03:47.150
It will it will work great.

03:54.990 --> 04:02.740
Now next we add a simple memory so it stores in memory, so no credentials are required.

04:04.780 --> 04:05.700
Press on that.

04:07.660 --> 04:10.420
And here you can specify the context window length.

04:10.940 --> 04:16.220
So basically it means how many pass interactions the model receives as context.

04:16.700 --> 04:25.780
So in this setup how many messages it has to remember from the open chat.

04:28.060 --> 04:28.660
Feature.

04:29.340 --> 04:31.740
While we be interacting with it.

04:32.020 --> 04:33.260
So let's close it for now.

04:36.540 --> 04:40.060
And let's say we want it to remember ten messages.

04:43.020 --> 04:43.540
Great.

04:44.340 --> 04:49.540
Now let's connect our agent to a Gmail node.

04:50.340 --> 04:55.580
So we are going to create a tool which will be called by our agent.

04:56.380 --> 04:57.980
So we are going to use.

05:00.060 --> 05:00.940
Gmail node.

05:01.860 --> 05:02.860
So Gmail tool.

05:05.820 --> 05:07.900
And we want to send message.

05:08.420 --> 05:12.660
Just make sure you are connected to the correct Gmail account.

05:13.460 --> 05:15.220
So this is where the magic happens.

05:15.860 --> 05:21.700
So this tool is going to send emails on our behalf as the resource you have.

05:21.700 --> 05:24.700
Message sent because we want to send an email.

05:26.100 --> 05:30.940
So we need to fill in these fields to subject and message.

05:32.620 --> 05:34.420
And let me show you something cool.

05:35.140 --> 05:40.020
So this new feature lets you autofill those fields using AI.

05:40.340 --> 05:48.020
So instead, instead of writing manual expressions or hard coding anything, you just click the little

05:48.020 --> 05:55.540
purple purple button next to each field and it fills in the right info for you automatically.

05:55.780 --> 06:02.330
So it reads your prompt understands who the email is for what it's about, and write the message.

06:02.530 --> 06:04.250
So it's super fast and super clean.

06:04.730 --> 06:10.530
If you want a bit more control though, you can use the from OpenAI expression.

06:10.930 --> 06:19.690
So just to switch the field to the expression and write the expression programmatically, and I'm going

06:19.690 --> 06:24.610
to show you how to do this in the build your team of AI agents lesson.

06:24.690 --> 06:26.170
So now let's keep it simple.

06:27.410 --> 06:30.930
I'm just going to let the model define the parameter.

06:32.050 --> 06:33.850
So simply simply click on that.

06:34.090 --> 06:37.130
The same for the subject and for the message.

06:37.730 --> 06:39.370
Now let's add another tool.

06:39.930 --> 06:43.650
So Google Sheet to store our email addresses.

06:43.690 --> 06:46.370
We want to email two.

06:46.730 --> 06:52.050
So click on the tool again ad tool search for Google Sheet.

06:58.090 --> 07:03.730
Tool which allows for reading, updating and writing data to Google Sheets.

07:04.970 --> 07:05.810
Click on that.

07:06.650 --> 07:12.250
Now go to your Google Drive and create a simple Google Sheet.

07:15.810 --> 07:21.370
With two columns like Name and Email and enter some data.

07:25.130 --> 07:27.970
Then go back to connect to your Google account.

07:27.970 --> 07:30.610
So just simply click on this drop down.

07:31.330 --> 07:39.250
Create new credential and sign in with Google, which will automatically connect to your Google Sheets,

07:39.450 --> 07:43.610
and it will give your agent access to the Google Sheet you created.

07:44.810 --> 07:45.850
And hit save.

07:49.570 --> 07:50.370
Close it.

07:52.890 --> 07:57.400
So we want set it Automatically, not manually.

07:58.760 --> 08:02.520
So we are looking for a sheet within the document as the operation.

08:02.520 --> 08:04.760
We want to get rows.

08:04.880 --> 08:08.800
And here we want to select a document from the list.

08:09.320 --> 08:17.040
If you have connected to your Google account, the Google sheet you have created should pop up here.

08:17.840 --> 08:21.560
So now I'm going to refresh the connection.

08:42.640 --> 08:51.240
And now when I want to choose the document from the list, you can see I have access to contacts I have

08:51.240 --> 08:51.960
created.

08:52.320 --> 08:56.360
So this is this Google sheet with the context data.

08:59.160 --> 09:02.120
Now we want to choose a sheet within this document.

09:03.160 --> 09:04.480
So it's sheet one.

09:07.120 --> 09:08.920
It should pop up automatically.

09:09.680 --> 09:11.320
Yeah I'm going to choose this one.

09:12.320 --> 09:13.880
And that's it for for this node.

09:13.920 --> 09:15.960
Now let's go back to our agents.

09:19.080 --> 09:20.280
Let's open this node.

09:22.520 --> 09:24.840
And now we want to add a system prompt.

09:25.080 --> 09:29.200
So basically we want to guide our agent.

09:29.560 --> 09:30.840
What we want to achieve.

09:30.880 --> 09:34.200
So we want to provide instruction on what to do exactly.

09:34.800 --> 09:36.080
So click on add option.

09:36.880 --> 09:37.880
System message.

09:39.280 --> 09:41.440
And then switch to expression mode.

09:43.040 --> 09:44.160
And expand it.

09:44.800 --> 09:48.720
And now I'm going to copy and paste the prompt I have prepared.

09:54.040 --> 09:55.790
So this is our very simple prompt.

09:56.430 --> 09:58.590
So we define the role for our agent.

09:58.590 --> 10:01.390
So you are a professional personal assistant agent.

10:01.750 --> 10:06.110
Your primary role is to send emails and you have access to two tools.

10:06.110 --> 10:08.630
So contacts and email tool.

10:09.350 --> 10:11.590
So basically two tools we have created.

10:17.630 --> 10:20.870
And here we are describing how to use these tools.

10:21.430 --> 10:27.510
So contacts use this tool when you need to look up contact information like an email address or phone

10:27.510 --> 10:27.990
number.

10:28.390 --> 10:32.990
You need to use this tool before sending an email or before getting emails.

10:34.110 --> 10:37.310
And email tool you can add two here.

10:38.070 --> 10:44.070
I use this for image related actions like sending emails, reading emails, or forwarding emails.

10:44.350 --> 10:52.350
So basically you can add more tools to this agent if you want your agent to read emails for you and

10:52.350 --> 10:55.950
summarize them, etc. you can just simply.

10:58.030 --> 10:58.750
Add tool.

11:03.430 --> 11:03.870
Again.

11:05.270 --> 11:07.110
And here you just change the operation.

11:07.550 --> 11:12.630
So you can add label, delete, get, get many emails and so on.

11:14.430 --> 11:16.390
Now for this tutorial let's keep it simple.

11:16.390 --> 11:21.430
So I'm going to remove it and let's work on our prompt.

11:23.910 --> 11:28.550
So you want keep emails professional and format it nicely.

11:28.550 --> 11:32.030
So the body of the email with the line breaks and clear structure.

11:32.350 --> 11:35.870
And we always want it to sign off as best regards.

11:35.870 --> 11:36.550
And Damon.

11:36.790 --> 11:38.550
And here is the current time and date.

11:39.190 --> 11:44.870
So just to make sure that I will not make mistakes regarding the date and time.

11:45.270 --> 11:47.110
And now this is really important step.

11:47.430 --> 11:48.590
So please don't miss it.

11:48.590 --> 11:57.900
Because otherwise even if you will give very detailed description of the formatting style you want to

11:57.900 --> 11:58.420
get.

11:58.460 --> 12:05.140
Your agent will struggle to send emails properly formatted, so let's close it for now.

12:06.660 --> 12:08.620
And let's go back to our Gmail tool.

12:12.020 --> 12:19.580
And here make sure to switch to the text instead of HTML as the email type.

12:19.780 --> 12:28.860
Now, before we test our agent, we need to make sure that the name of our tools match the naming in

12:28.860 --> 12:29.660
the prompt.

12:30.860 --> 12:35.660
So our agent knows what tools to call.

12:37.260 --> 12:39.620
So we have contacts and email tool.

12:40.780 --> 12:41.980
So let's rename it.

12:43.020 --> 12:44.220
This is the Gmail tool.

12:49.420 --> 12:50.260
And confirm.

12:52.420 --> 12:53.610
Here you have contacts.

13:01.050 --> 13:03.650
Confirm and save.

13:05.370 --> 13:08.090
Now let's go ahead and test our agent.

13:08.530 --> 13:13.370
So open chat by clicking on this button and type something like.

13:15.610 --> 13:15.850
Hi.

13:15.890 --> 13:20.690
Can you please send an email to Damien that I need to reschedule our upcoming meeting, please.

13:21.850 --> 13:23.170
And now let's see it in action.

13:24.010 --> 13:25.690
So I'm going to send this message.

13:28.850 --> 13:33.450
So as you can see the contacts tool gets triggered.

13:33.490 --> 13:35.170
Then Gmail tools get triggered.

13:36.890 --> 13:41.730
And as a response we have I have sent an email to Damien requesting to reschedule your upcoming meeting.

13:42.010 --> 13:44.970
If you need any further assistance, feel free to ask.

13:45.930 --> 13:47.210
Now let's check my inbox.

13:48.570 --> 13:52.330
Yes, I got an email, so request to reschedule meeting there.

13:52.890 --> 13:54.410
I hope this message finds you well.

13:54.450 --> 13:57.930
I would like to discuss the possibility of rescheduling our upcoming meeting.

13:58.450 --> 14:02.130
Please let me know your available times and I will do my best to accommodate.

14:02.170 --> 14:03.530
Thank you for your understanding.

14:04.050 --> 14:04.850
Best regards.

14:04.890 --> 14:05.290
Damien.

14:05.330 --> 14:05.930
Brilliant.

14:06.450 --> 14:11.010
As you can see, this email was sent automatically with N810.

14:11.330 --> 14:13.490
Doesn't look great, so let's remove it.

14:13.890 --> 14:18.250
And we can simply do it by going to our agent.

14:19.130 --> 14:20.970
Let's close the chat for now.

14:21.890 --> 14:23.930
So let's open the Gmail Tools node.

14:26.050 --> 14:27.370
And scroll down.

14:28.450 --> 14:32.330
And here under options click on add option.

14:33.130 --> 14:34.890
Then open Anytime Distribution.

14:36.410 --> 14:37.450
And let's turn this off.

14:39.650 --> 14:46.170
And now when we send the next email this attribution will be removed.

14:47.290 --> 14:49.130
And we will have nicely formatted email.

14:50.050 --> 15:00.010
So yes if you want to interact with your agents via apps like WhatsApp, telegram, slack and others

15:01.210 --> 15:09.970
and ask it to send emails on your behalf to any contact details you store in the Google Sheet.

15:10.250 --> 15:17.010
Go to the How to Set up Credentials lesson, and you can find a separate tutorials where I explain how

15:17.010 --> 15:20.010
to connect different services to your agents.

15:20.210 --> 15:24.050
So this is a perfect starter agent to get hands on with.

15:24.090 --> 15:32.010
And the best part is it's fully customizable so you can build on top of it to write drafts, summarize

15:32.010 --> 15:38.650
emails, delay them, route them to Notion or Slack, or even plug in into your CRM.

15:39.010 --> 15:45.890
So in the next videos, we'll build something more advanced, but for now, try building this one.

15:45.930 --> 15:49.930
Click by click, get familiar with the tools and have fun with it.

15:50.050 --> 15:52.250
Thanks for your attention and see you in the next one.
