WEBVTT

00:00.040 --> 00:03.360
Okay, so I want to add one more element to our workflow.

00:03.360 --> 00:07.240
And I want to add in some sort of traditional workflow elements.

00:07.240 --> 00:13.160
One of the great things about Nan is that it combines the best of the kind of agentic AI, uh, set

00:13.200 --> 00:19.240
up Visual Builder with the kind of traditional workflow tools like Zapier, something which lets you

00:19.400 --> 00:23.120
integrate APIs with some nice workflow capabilities.

00:23.120 --> 00:24.280
And that's what we're going to do.

00:24.280 --> 00:24.640
Now.

00:24.840 --> 00:29.360
Look, the AI agent, its output is supposed to be the word okay.

00:29.880 --> 00:32.480
And that's something that we can test for.

00:32.720 --> 00:38.680
So I'm going to I want it I want I want to set this so that if things go wrong and it doesn't achieve

00:39.160 --> 00:44.120
the right outcome we want, then I want it to alert me, send a push notification with a warning, and

00:44.120 --> 00:48.200
if it goes right, I also want to push notification, but not an emergency one.

00:48.200 --> 00:49.840
Just just a normal one.

00:49.840 --> 00:53.320
So basically we're going to want to have two different notifications.

00:53.320 --> 00:55.000
One of them will be problems.

00:55.000 --> 00:56.560
One of them will be all is well.

00:56.720 --> 00:58.920
And we want it to pick one of those two.

00:59.080 --> 01:04.990
Depending on whether the answer from this AI agent is the word okay or not?

01:05.550 --> 01:06.310
All right.

01:06.350 --> 01:08.670
So that sounds like maybe that's going to need some code.

01:08.670 --> 01:14.270
It sounds like it's something which needs like an if statement of some sort if you are familiar with

01:14.270 --> 01:23.590
coding, but uh, perhaps, uh, there might also be a simpler way, which is to use an if node, there's

01:23.590 --> 01:30.950
a bunch of nodes which are to do with like laying out simple logic visually for people who are low code,

01:30.950 --> 01:36.510
no code, and who would rather be able to visualize the instructions that you're giving your workflow.

01:36.510 --> 01:38.110
And that is what we're going to do right now.

01:38.110 --> 01:44.750
We're going to add an if node right here to say if the agent did what it was told and answered, okay,

01:45.030 --> 01:47.310
then we'll send a happy push notification.

01:47.310 --> 01:50.990
And if it didn't, we'll send an upset push notification.

01:50.990 --> 01:52.150
Let's build that right now.

01:52.190 --> 01:56.950
And by the way, if you're wondering about the UI that we're looking at here, that that logs screen

01:56.950 --> 01:59.550
is the same as it is on the executions tab.

01:59.550 --> 02:02.630
You can open and close the logs by clicking on the word logs.

02:02.630 --> 02:05.690
And it gives you more, more breathing room, more space here.

02:05.690 --> 02:08.050
So I'm going to press the plus button right here.

02:08.050 --> 02:13.370
And I'm going to type if to get the if node routes items to different branches.

02:13.570 --> 02:22.130
And basically you have to put in a condition value one and then like is equal to or some some some comparison

02:22.130 --> 02:23.170
and then value two.

02:23.650 --> 02:24.250
Okay.

02:24.410 --> 02:28.410
Well for value one I'm going to put in an expression.

02:29.050 --> 02:33.170
And that expression I'm going to put in is I'm going to say dollar JSON.

02:33.530 --> 02:40.930
The stuff that's coming in dot output, which is the uh, the, the thing that, that is the output

02:40.930 --> 02:49.450
field, which we know is what the LM produced, that if that is equal to, uh, okay, this I want that

02:49.450 --> 02:49.890
to be fixed.

02:49.890 --> 02:50.810
Just just the text.

02:50.810 --> 02:51.290
Okay.

02:51.610 --> 02:54.810
That is going to be ah our node.

02:54.850 --> 02:55.250
Ah.

02:55.290 --> 03:01.570
If node if the output coming from the LM is equal to okay.

03:02.370 --> 03:03.770
That's the end of describing that node.

03:03.770 --> 03:09.160
We've got the if we've got two branches here, a little true and a false, and we're gonna hook up two

03:09.160 --> 03:10.040
different things to that.

03:10.080 --> 03:12.080
Well, you know exactly what we're going to do for the true.

03:12.120 --> 03:13.000
We're going to press here.

03:13.000 --> 03:14.320
We're going to type pushover.

03:16.400 --> 03:18.200
And we're going to push a message.

03:18.200 --> 03:19.520
That's the action.

03:20.200 --> 03:23.840
And uh, I'm going to paste in my user key in just a second.

03:24.080 --> 03:28.040
Uh, we're going to make this b b b, uh, low priority.

03:28.040 --> 03:29.280
I don't want it to make a noise.

03:29.280 --> 03:34.080
And the message will be, uh, rebalancing successful.

03:35.760 --> 03:40.840
Now, you'll notice that there's no button here to say let the LM choose.

03:40.840 --> 03:42.440
Let the model choose what goes here.

03:42.440 --> 03:44.280
And you might be wondering why is that.

03:44.440 --> 03:46.440
And I'm going to come to that in just a second.

03:46.560 --> 03:47.040
All right.

03:47.040 --> 03:49.680
So I'm going to fill in my user key in here.

03:49.800 --> 03:52.280
I'll come back and do that in a second.

03:52.320 --> 03:55.480
I'm going to put in the false branch of this.

03:55.520 --> 03:57.800
We're also going to use pushover.

03:58.720 --> 04:00.280
You can see it wants an action.

04:00.280 --> 04:01.360
Push a message.

04:01.760 --> 04:02.760
And we're going to say push.

04:02.760 --> 04:03.960
I'm going to put my user key there.

04:03.960 --> 04:05.120
This time we're going to make it.

04:05.280 --> 04:13.390
Uh just say, uh, I guess we'll say emergency priority and we'll make the message be, uh, that the,

04:13.590 --> 04:17.550
um, rebalancer failed.

04:19.270 --> 04:20.110
There we go.

04:20.470 --> 04:22.430
And save that.

04:22.670 --> 04:29.710
And now I will just come in and update with the two, uh, user tokens, and then I will explain something

04:29.710 --> 04:30.510
very important.

04:30.510 --> 04:30.830
Okay.

04:30.870 --> 04:32.230
I've set my user tokens.

04:32.270 --> 04:35.190
The red angry triangles have gone away because this is all good.

04:35.350 --> 04:36.630
Everything is set up.

04:36.630 --> 04:37.110
What is it?

04:37.110 --> 04:38.310
I wanted to explain to you.

04:38.670 --> 04:44.710
Well, I wanted to say, what's the difference between this pushover right here and this pushover right

04:44.710 --> 04:45.190
here?

04:45.670 --> 04:48.830
One of them, this one here is we're using it as a tool.

04:48.870 --> 04:49.230
Right?

04:49.270 --> 04:50.590
It's what I told you before.

04:50.630 --> 04:52.070
It's called a subnode.

04:52.070 --> 04:54.990
And it's in a circle because it's a tool here.

04:54.990 --> 04:56.510
It is just a core node.

04:56.510 --> 04:58.590
It is a node on the workflow.

04:58.590 --> 05:00.390
So what's the difference between those two?

05:00.710 --> 05:01.790
Well, here's the thing.

05:01.790 --> 05:07.580
When it's a core node, it is just a step in the workflow that is being automated at that point, and

05:07.580 --> 05:12.780
no matter what, the push action will always be called the send a message action and it will always

05:12.780 --> 05:14.700
be called with the data that we've put in there.

05:14.740 --> 05:18.820
It's a fixed step on the workflow, and this has nothing to do with LMS.

05:18.860 --> 05:20.540
It's just a step in the workflow.

05:20.540 --> 05:24.900
If you had Zapier and you were controlling different things, you may not be familiar with Zapier.

05:24.940 --> 05:29.500
There are lots of tools like this where you can have steps in the workflow, and it will always be called.

05:29.500 --> 05:33.980
In this case, it won't always be called because we've got an if statement, which is a fixed bit of

05:33.980 --> 05:34.540
logic.

05:34.540 --> 05:38.740
And depending on this logic, either this push will be called or this push will be called.

05:39.020 --> 05:43.180
Similarly, I could I could move, I could put a push node right here.

05:43.180 --> 05:47.140
And then every time you submit the form, there would always be a push notification.

05:47.180 --> 05:48.220
Maybe you should try that.

05:48.460 --> 05:51.180
That is different to what we're doing here.

05:51.340 --> 05:58.300
What we're doing here is a special feature that the push node supports being used as a tool, and only

05:58.300 --> 06:03.580
a subset of nodes are allowed to be used as a tool only if they've been specially set up that way.

06:03.780 --> 06:06.660
And when it's used as a tool, it is different.

06:06.740 --> 06:11.040
First of all, there's a description of it that's given to the LM as we saw.

06:11.080 --> 06:13.400
That tells the LM what does this do?

06:13.800 --> 06:18.680
Secondly, the LM gets to decide whether or not to use that tool.

06:18.720 --> 06:21.240
Details of the tool are put in the system message.

06:21.400 --> 06:27.280
As as we talked about a few days ago, the LM gets to decide in its response whether or not it wants

06:27.280 --> 06:28.320
to call that tool.

06:28.560 --> 06:34.600
And finally, optionally, you can specify that the LM should fill in some of the inputs to that tool,

06:34.640 --> 06:37.800
as we've done for some of these like like the message in this tool.

06:38.000 --> 06:45.160
And so all of those are completely different to when you just slap a node on on your workflow as we

06:45.160 --> 06:47.640
have here, in which case nothing to do with LMS.

06:47.680 --> 06:49.120
It's always called.

06:49.280 --> 06:56.400
So that is the crucial difference between using a node with with an action with the node operation is

06:56.440 --> 07:01.000
action like we have right here, versus using a node as a tool.

07:01.040 --> 07:06.000
As a it's a sub node and it's called at the discretion of the LM.

07:06.320 --> 07:07.360
I hope that's clear now.

07:07.400 --> 07:07.880
Okay.

07:07.920 --> 07:13.350
And with all of this it comes for me to come to the portfolio and clean this out.

07:13.390 --> 07:17.270
We don't want you set there and we don't want you set there.

07:17.590 --> 07:18.750
Come back here.

07:18.950 --> 07:23.710
And now we're going to execute the workflow again with this whole setup.

07:23.750 --> 07:24.750
Up comes this.

07:24.750 --> 07:26.430
We're going to submit this.

07:26.950 --> 07:29.630
And off off it goes.

07:29.670 --> 07:35.990
Action stations uh hopefully in any second now this this whole workflow will kick off.

07:36.270 --> 07:40.150
Uh, and uh, it's waiting for the trigger event.

07:40.550 --> 07:44.630
And it's sometimes, as I say, sometimes I find that it that it lags what's, what's actually happening.

07:44.630 --> 07:49.350
The user interface takes a moment to refresh, but with any luck, it will kick into gear.

07:49.590 --> 07:52.190
Uh, I think this time I won't give you the running commentary.

07:52.230 --> 07:53.990
I'll come back in a sec when it's run.

07:53.990 --> 07:54.790
And there we go.

07:54.790 --> 08:00.870
It has just completed successfully, and I just got, uh, the I got I got two messages, I got one

08:00.870 --> 08:06.670
that's saying portfolio is rebalanced and I got another which is rebalancing successful.

08:06.670 --> 08:08.110
Exactly what I typed out.

08:08.110 --> 08:15.460
And you can see in here the if is ticked and you can see that this arrow here is green because it did

08:15.460 --> 08:16.860
indeed match, okay.

08:16.980 --> 08:20.500
And it went over to push uh, the, the positive message.

08:20.540 --> 08:22.780
It did not push the negative message.

08:22.780 --> 08:26.420
And so are more sophisticated workflow is complete.

08:26.420 --> 08:33.500
And I just wanted to show you here the your first site putting logic on your your workflow and how these,

08:33.540 --> 08:38.620
these nodes can be used just to carry out a more strict business process.

08:39.380 --> 08:39.900
Okay.

08:40.500 --> 08:42.740
Well, there is one more step left.

08:42.900 --> 08:45.580
Uh, let me tell you the final thing we're going to do.

08:45.620 --> 08:46.380
All right.

08:46.380 --> 08:52.140
Well, the last thing to do, you may have guessed, is to deploy to production, to publish.

08:52.460 --> 08:56.620
Uh, and the first thing we want to do is just go into this form submission, and we'll just want to

08:56.620 --> 09:03.620
go over here to this production URL and just copy that, uh, because, uh, that is, uh, that's where

09:03.620 --> 09:06.420
we want to go when, when we've deployed to production.

09:06.420 --> 09:08.740
So I'm just going to go out here and make sure it's saved.

09:08.740 --> 09:09.820
You've probably been doing this.

09:09.820 --> 09:15.240
I always automatically press command s all the time, but hopefully you've done that and then it's going

09:15.240 --> 09:18.680
to be time to press the publish button to publish this.

09:18.680 --> 09:21.560
So it becomes a live workflow.

09:21.760 --> 09:22.680
Got it.

09:22.800 --> 09:24.240
Now we're going to open up.

09:24.440 --> 09:27.360
First go to the portfolio and I'm going to wipe this out.

09:27.400 --> 09:36.400
We want to start from a nice and empty portfolio and open up that URL right here, which is hopefully

09:36.400 --> 09:39.680
going to take us to a form that we can submit.

09:39.960 --> 09:44.080
Uh, and then we will use that to trigger our workflow.

09:45.360 --> 09:45.920
Here we go.

09:45.960 --> 09:47.000
Portfolio Rebalancer.

09:47.000 --> 09:50.240
This is like a live web page out there on the internets.

09:50.600 --> 09:52.880
And I'm now going to say submit.

09:53.240 --> 09:56.120
And it says your response has been recorded.

09:56.120 --> 09:59.080
So that is now off and running.

09:59.280 --> 10:04.840
And I'm going to be waiting and hoping to receive a bunch of push notifications, I guess.

10:04.840 --> 10:08.840
I mean, I'm going to be hoping, well, it's already before I can even flip over there.

10:08.840 --> 10:10.560
It's already filled in the prices.

10:10.560 --> 10:12.840
So it is indeed running in production.

10:12.880 --> 10:18.910
It's now thinking about how it will rebalance, hopefully, and I imagine that very shortly it's going

10:18.910 --> 10:21.830
to come back and start doing putting in the quantities here.

10:22.030 --> 10:27.750
Uh, and then I will get my notifications and what it's doing that let me tell you your, your assignment,

10:27.750 --> 10:29.030
I can see it's doing it right now.

10:29.230 --> 10:30.430
Uh, amazing.

10:30.470 --> 10:31.590
I'm not touching anything.

10:31.830 --> 10:35.550
Uh, which is to improve this, to come on in.

10:35.550 --> 10:37.790
One of the things you'll notice is that it's not very stable.

10:37.830 --> 10:42.990
I can see it's tweaking and updating things here, figuring out how you can improve this so that it's

10:42.990 --> 10:47.310
more accurate, more dependable is there's the message.

10:47.630 --> 10:49.830
Uh, fantastic.

10:50.110 --> 10:52.110
And, uh, that's very cool.

10:52.110 --> 10:54.310
Let me let me go into my push notifications.

10:54.430 --> 10:55.390
I got two messages.

10:55.390 --> 10:58.790
You only heard one noise because the second one was low priority.

10:58.790 --> 10:59.910
So it doesn't make a noise.

10:59.910 --> 11:00.870
But there it is.

11:00.870 --> 11:01.990
Deal successful.

11:02.070 --> 11:07.390
Uh, so, uh, we were able to to complete this flow in production.

11:07.390 --> 11:08.950
It's been successful.

11:09.110 --> 11:12.230
That is our deployed workflow running.

11:12.230 --> 11:16.940
And of course, uh, you want to see that the email arrived and it did arrive.

11:16.980 --> 11:17.820
There it is.

11:18.100 --> 11:20.980
Uh, the the portfolio balancing email.

11:21.220 --> 11:24.380
And so it does appear to have been successful.

11:24.580 --> 11:32.020
Uh, and we can go to, to, uh, to executions, um, to see the, the, uh, the results of the run,

11:32.180 --> 11:35.220
uh, and that, that, that as I say, it was it was successful.

11:35.220 --> 11:36.340
And there we have it.

11:36.340 --> 11:41.900
And we can, of course, look in at the logs and go through all of the details of what it did, that

11:41.900 --> 11:46.420
that is our workflow running in deployed state.

11:46.420 --> 11:53.780
And if you hover over here in this, the logs, you can see how many tokens this used up with the AI

11:53.820 --> 11:54.140
agent.

11:54.180 --> 11:58.620
The prompt is the number of input tokens, the completions, the number of output tokens.

11:58.620 --> 12:03.260
You can see there's a lot of inputs there, because all of the tool use was like packing information

12:03.260 --> 12:07.140
into the context, which is where context engineering can be helpful.

12:07.420 --> 12:08.140
And indeed so.

12:08.140 --> 12:13.860
So the deficiency with this that you'll quickly discover if you do this yourself is that it does start

12:13.860 --> 12:17.850
to lose coherence with larger portfolio sizes.

12:17.850 --> 12:21.170
So this can handle the portfolio size we just had with with ease.

12:21.290 --> 12:24.090
But larger portfolios it can't keep up.

12:24.210 --> 12:25.690
And there are solutions to that.

12:25.690 --> 12:29.210
There are solutions from adding in more information in the sheet.

12:29.210 --> 12:34.370
That gives it a better clue as to how everything balances, to equipping it with a calculator so that

12:34.370 --> 12:40.010
it can make calculations as it goes to improving the tools so that they're able to help it figure out

12:40.010 --> 12:40.930
how to rebalance.

12:40.930 --> 12:45.010
Because the actual rebalancing calculation itself is something that could be quite trivial.

12:45.010 --> 12:53.370
So that that really the mission for you is to make this more reliable and more industrial strength by

12:53.370 --> 12:58.770
improving the prompts, potentially improving the tools, and improving the spreadsheet so that you

12:58.770 --> 13:05.130
equip the AI agent with the most possible information in the simplest way so that it can still be autonomous,

13:05.130 --> 13:10.810
still make its own decisions, but it's quite easy for it to make the right decisions quickly and then

13:10.810 --> 13:11.810
notify you.

13:11.810 --> 13:17.590
And then you will have your your running portfolio rebalancing agent.

13:17.590 --> 13:19.670
And that's a wrap on our first project.

13:19.710 --> 13:25.190
What I loved about this is that it's so real world that this really does map to something that happens,

13:25.230 --> 13:26.710
and now you've automated it.

13:26.710 --> 13:32.030
And you can also think about changing that trigger from being a web form to being one of the scheduler

13:32.070 --> 13:32.350
things.

13:32.350 --> 13:37.390
That means that maybe once a day it gets kicked off and just automatically runs and then sends you the

13:37.390 --> 13:40.190
notification with how you should rebalance your portfolio.

13:40.190 --> 13:42.990
And again, that just feels so real world.

13:42.990 --> 13:48.910
You've just automated a business process, and that is a fitting way to wrap up the first week of this

13:48.910 --> 13:52.110
program, which was headed automate with workflows.

13:52.110 --> 13:53.190
That's what we did.

13:53.390 --> 13:54.550
And that's a wrap.

13:54.550 --> 13:55.870
It was it was a big week.

13:55.910 --> 13:56.790
You learned a ton.

13:56.830 --> 13:59.430
There's lots of definitions and terminology and I'm sorry about that.

13:59.430 --> 14:03.710
But it's great that we've got that out of the way because we can focus on really juicy stuff.

14:03.750 --> 14:08.070
Next week is voice agents and 11 labs, which is such fun.

14:08.270 --> 14:09.590
I can't wait to show you this.

14:09.950 --> 14:15.710
But first, take a moment to celebrate that you are 33% of the way through the program, a third of

14:15.710 --> 14:17.470
the way through next week.

14:17.470 --> 14:18.110
So much fun!

14:18.110 --> 14:19.110
I'll see you then.
