WEBVTT

00:00.080 --> 00:00.280
So.

00:00.280 --> 00:01.000
Yes, as well.

00:01.000 --> 00:06.400
You know, the tools we've got left to put on, on our communications tools to send a push notification

00:06.400 --> 00:07.240
and an email.

00:07.240 --> 00:13.160
And you have a whole bunch of these tools in your toolbox now, and you should feel free to use any

00:13.160 --> 00:14.880
of them if you would rather have it slack.

00:14.920 --> 00:18.960
The decisions or telegram you the decisions, then go for it.

00:18.960 --> 00:24.320
But we're gonna stick for what I do with the ones that I picked, which is my favorite pushover.

00:24.360 --> 00:25.880
Let's add in pushover.

00:26.120 --> 00:26.960
Pushover.

00:27.000 --> 00:28.480
The pushover tool.

00:28.720 --> 00:29.880
Here it is.

00:30.120 --> 00:32.880
And we want it to send a push notification.

00:32.880 --> 00:36.880
We're going to let the model decide what message to send us.

00:36.880 --> 00:39.000
That becomes something that is part of this tool.

00:39.000 --> 00:40.960
It gets to say what it's going to put in.

00:40.960 --> 00:43.000
And we have to put in our user key here.

00:43.000 --> 00:45.760
This is the one that's the begins with the letter U.

00:46.080 --> 00:51.680
And obviously rather than reveal it, I'm going to just copy and paste it in right now and I will see

00:51.680 --> 00:52.280
you in a sec.

00:52.320 --> 00:52.840
Okay.

00:52.880 --> 00:55.960
I added that in my my user token beginning with the U.

00:56.080 --> 01:00.240
I also changed the priority to high priority because I think I needed to do that for it to make a noise

01:00.240 --> 01:01.360
on my phone at least.

01:01.640 --> 01:02.080
Okay.

01:02.120 --> 01:04.160
And now the email tool.

01:04.400 --> 01:10.240
So I press tools and I'm going to go to Gmail, consume the Gmail API.

01:10.720 --> 01:16.360
Now this time I'm going to have it actually send an email for reals.

01:16.360 --> 01:20.760
But you remember I was I was a bit hesitant to before because I want to give it too much power, but

01:20.760 --> 01:22.640
this time we're going to fix it.

01:22.640 --> 01:29.280
To send the email to me, I'll use my Gmail address, so it's going to have to send it to me, and we'll

01:29.280 --> 01:30.920
call the subject a fixed subject.

01:30.920 --> 01:39.360
It's going to be, um, equity Rebalancer trading decisions.

01:40.120 --> 01:40.400
Oops.

01:40.400 --> 01:41.160
Spell that right.

01:41.200 --> 01:42.320
Decisions.

01:42.720 --> 01:47.280
And the message we're going to let the model define the message.

01:47.280 --> 01:49.000
It's going to be an HTML type email.

01:49.000 --> 01:51.840
The model will define the message.

01:52.120 --> 01:53.920
And that is how we will do it.

01:53.920 --> 01:55.360
So I will save that.

01:55.760 --> 01:59.120
Uh so that tool is now set.

01:59.560 --> 02:04.000
And now with this I do believe we have all the other all the tools.

02:04.000 --> 02:07.320
Let me press the clean up button, make it nice and tidy.

02:07.680 --> 02:08.840
Uh, okay.

02:09.120 --> 02:12.360
I'm actually I'm also I'm going to zoom out a bit which is the minus button.

02:12.360 --> 02:12.880
There we go.

02:12.920 --> 02:17.200
Maybe press the tiny button again and it makes everything fit a bit better.

02:17.240 --> 02:18.720
Maybe I should do that one more time.

02:20.160 --> 02:20.800
There we go.

02:21.000 --> 02:23.480
Uh, I think it's zooming in every time I tidy as well.

02:23.640 --> 02:26.440
Uh, okay, so we've got everything laid out.

02:26.440 --> 02:27.960
I think we're almost ready to go.

02:28.000 --> 02:29.080
There might be one more thing.

02:29.120 --> 02:31.560
One more thing we can tweak to make it a bit better.

02:31.560 --> 02:37.080
So over here in the portfolio I have added in another row what proportion is fixed income.

02:37.080 --> 02:39.800
So we're now showing the equity and fixed income breakdown here.

02:39.840 --> 02:45.320
And so for example if I put in 100 as the price here for everything it shows the portfolio would then

02:45.360 --> 02:46.400
be 60 over 40.

02:46.680 --> 02:54.480
And if after rebalancing we have uh 3322 then the portfolio would change its makeup a bit.

02:54.480 --> 02:59.240
So this, this shows you how I've improved the spreadsheet to be as clear as possible.

02:59.600 --> 03:03.400
And now along with that, there's a change that we can make to our workflow.

03:03.440 --> 03:10.880
I'm opening up the tool to get the rows of the Google Sheet, and something I've glossed over always

03:10.880 --> 03:15.720
up to this point has been this field tool description that we've left it set automatically.

03:15.720 --> 03:18.600
If I change that to set manually, I'll show you what this is.

03:18.600 --> 03:24.240
By default, this just says get rows in sheet in Google Sheets, which is information that goes to the

03:24.240 --> 03:26.960
LM when it's deciding whether to use this tool or not.

03:27.000 --> 03:28.600
Well, we can do better than that.

03:28.680 --> 03:34.240
We paste in something I wrote earlier which says this tool provides details of the user's portfolio

03:34.240 --> 03:35.280
in a Google Sheet.

03:35.320 --> 03:38.480
It includes the positions the equity fixed income breakdown.

03:38.520 --> 03:43.120
Use this tool to retrieve the Google Sheet to see the positions before updating the price and making

03:43.120 --> 03:44.760
rebalancing decisions important.

03:44.760 --> 03:50.720
You must also use this tool after rebalancing to check the breakdown achieves your goal.

03:50.880 --> 03:53.040
If not, keep iterating.

03:53.040 --> 03:59.760
So just being crystal clear about what we want the LM to do and using the tool description as a means

03:59.760 --> 04:00.200
to do it.

04:00.200 --> 04:03.120
And this is all part of good context engineering.

04:03.320 --> 04:08.480
And I've also gone in to the AI agent, and I've gone to this user message prompt.

04:08.480 --> 04:11.520
And I've just added in a little bit in here about important.

04:11.560 --> 04:13.400
You must confirm you've achieved your goal.

04:13.600 --> 04:18.960
And at the very end I've said it only respond okay when your mission is complete.

04:19.200 --> 04:23.240
Uh, just just to, uh, really try and be be very concrete with it.

04:23.240 --> 04:26.120
And this is the kind of thing that one keeps iterating on.

04:26.320 --> 04:30.480
So, you know, you may be able to do better by changing this a bit more.

04:30.720 --> 04:31.560
Um, okay.

04:31.600 --> 04:34.000
But that seems like it's it's in a good place.

04:34.320 --> 04:37.320
There is one more thing that I want to do to this AI agent.

04:37.320 --> 04:39.320
I want to go down here to the options.

04:39.440 --> 04:42.720
Click here and change max iterations.

04:42.720 --> 04:48.320
This is how many times it's able to use tools and things before it says, okay, I've done enough.

04:48.320 --> 04:51.080
I'm stopping here and it's by default at ten.

04:51.120 --> 04:52.760
And that might not be enough for us.

04:52.760 --> 04:54.600
So I'm going to bump it up to 30.

04:54.600 --> 04:58.800
So there's plenty of iterations for it to be thinking through what it needs to do.

04:59.040 --> 04:59.440
Okay.

04:59.480 --> 05:01.920
And without further ado, we should give this thing a try.

05:01.960 --> 05:06.720
Let's check that our portfolio is in good shape and press Execute Workflow.

05:06.960 --> 05:10.520
And you know this this whole week is all about automation.

05:10.520 --> 05:13.120
It's all about automating business process.

05:13.120 --> 05:16.280
And this is a classic example of an automation.

05:16.280 --> 05:22.990
We are taking something that is manually intensive today, and we're running an agent workflow to take

05:22.990 --> 05:29.590
care of it for us, uh, automating a process which which, as I say, manually intensive, um, at

05:29.590 --> 05:36.390
the moment and something which is ripe for this kind of solution for ten plus, uh, AI agent.

05:36.590 --> 05:39.590
So it's often it's running and it's thinking about what to do.

05:39.590 --> 05:44.710
And this is a moment where I might show you the executions tab, which is something which shows you

05:44.830 --> 05:48.110
this detailed trace of what's happening in each of the executions.

05:48.150 --> 05:50.230
And it's taking a minute to refresh.

05:50.470 --> 05:52.110
Um, meanwhile, let's just come over here.

05:52.110 --> 05:53.230
It's already though.

05:53.430 --> 05:54.510
It's ahead of itself.

05:54.550 --> 06:00.870
The, uh, the traces are catching up, but it's already come in and set all of the prices of everything

06:00.870 --> 06:03.350
and is now thinking about the rebalancing.

06:03.390 --> 06:04.390
Let's come back over here.

06:04.390 --> 06:04.670
Here.

06:04.670 --> 06:05.750
It shows that it's running.

06:05.750 --> 06:07.750
It's been running for 50s.

06:07.750 --> 06:10.430
It's not yet ready to show us the detail of what it's doing.

06:10.630 --> 06:13.830
Um, we come back here, it's now updating rows.

06:14.030 --> 06:14.950
Let's come back here.

06:14.950 --> 06:17.190
We can see it's done some rebalancing.

06:17.390 --> 06:18.710
It's just changed everything.

06:18.710 --> 06:21.630
So it's now got to a 60 over 40 kind of breakdown.

06:22.030 --> 06:27.390
Uh, and, um, I just got the push notification.

06:27.390 --> 06:29.830
I just unlocked my phone in time for you to.

06:29.870 --> 06:30.710
To hear that.

06:30.710 --> 06:31.550
Here we go.

06:31.710 --> 06:35.710
We've got the portfolio rebalanced to 6040.

06:35.830 --> 06:37.270
That has been successful.

06:37.510 --> 06:38.870
Our agents have all run.

06:38.870 --> 06:41.750
It happened in a flash faster than the traces.

06:41.790 --> 06:42.550
Everything ran.

06:42.550 --> 06:44.230
It sent the message to pushover.

06:44.230 --> 06:45.750
And now let's look at the results.

06:45.750 --> 06:51.350
So here I am over on the executions page, and we can see that everything ran.

06:51.350 --> 06:52.430
There's a tick by everything.

06:52.430 --> 06:53.870
You can see these numbers here.

06:54.070 --> 06:57.230
Uh, the OpenAI chat model was called ten times.

06:57.430 --> 07:02.030
It used the tool to collect the sheets four times.

07:02.030 --> 07:07.790
It used market stack to get share prices four times and it updated rows several times.

07:07.830 --> 07:11.590
It, uh, both of the updates tools were used multiple times.

07:11.590 --> 07:14.030
This is the the rebalancing.

07:14.030 --> 07:18.990
And then and then again to uh, to there was one time to set the prices and then against rebalance,

07:19.030 --> 07:21.230
then one more time to fix the rebalancing.

07:21.230 --> 07:23.750
And then it sent the push notification and the email.

07:23.750 --> 07:26.230
And here just for the proof of it is the email.

07:26.230 --> 07:31.990
So I got the email with the rebalancing instructions and everything seemed to work nicely.

07:32.270 --> 07:36.150
This is quite the sophisticated workflow that we had running here.

07:36.350 --> 07:37.590
A lot happened.

07:37.710 --> 07:44.990
Uh, we've been able to to show, um, how rich it is to describe these workflows, uh, and to get,

07:45.030 --> 07:49.710
get something that that is able to run and achieve a task that is quite sophisticated.

07:49.830 --> 07:55.470
Uh, and the proof, of course, is over here in our Google sheet showing the new quantity after rebalancing,

07:55.470 --> 08:01.910
showing that it achieved the 6040 split that we wanted after rearranging our portfolio and keeping the

08:01.910 --> 08:03.670
total value pretty, pretty close.

08:03.790 --> 08:07.110
Uh, so that I'd say, is an excellent outcome.

08:07.270 --> 08:10.390
I think we can declare victory on this.

08:10.390 --> 08:13.590
And there's just a couple more ways that we can improve this a little bit.

08:13.630 --> 08:13.870
Sorry.

08:13.910 --> 08:14.110
Wait.

08:14.110 --> 08:18.030
Just before we improve it, I want to show you a little bit more about this executions page.

08:18.030 --> 08:20.990
So again, I went from the editor to the executions page.

08:20.990 --> 08:23.710
I'm looking at the most recent execution, which is this good one.

08:23.710 --> 08:27.350
You'll see I had some errors in the past running this as I fixed a few things.

08:27.470 --> 08:28.990
Uh, and you may have done as well.

08:29.190 --> 08:33.470
Uh, so the one other thing I wanted to show you, which is very helpful in finding errors, is that

08:33.470 --> 08:36.750
you could see this visual like this of everything running with the numbers.

08:36.750 --> 08:38.510
You can also click where it says logs.

08:38.510 --> 08:43.190
Just there and up comes these logs that show each of the different calls that happened.

08:43.190 --> 08:46.510
And then there's over here this overview or details tabs.

08:46.510 --> 08:53.110
If you flip to details, you get to see at each point in this kind of trace exactly what happened,

08:53.110 --> 08:56.270
what was called with what prompts and what it did.

08:56.670 --> 09:00.590
So you can see here, for example, that that it gets it gets the row.

09:00.910 --> 09:06.150
This is why it's, it's, it's making sure that the, the 6040 split was achieved.

09:06.150 --> 09:12.590
And then it makes one more change to the quantity to the BND ticker to make sure that it achieves the

09:12.590 --> 09:13.270
target.

09:13.270 --> 09:19.190
So you can look through this and see what it's doing, why it's doing it with at each point with the

09:19.190 --> 09:23.350
inputs and outputs at every, every point in, in this workflow.

09:23.350 --> 09:26.310
And so this is very powerful debugging tools.

09:26.310 --> 09:29.390
And if you're not getting the behavior that you want this is where you go.

09:29.430 --> 09:33.470
You read your logs and then you come back and you tweak the prompts.

09:33.470 --> 09:39.350
And it can be very iterative to get to a point where it's reliably getting you to the right outcomes.
