WEBVTT

00:00.080 --> 00:04.720
So this whole week is about automation, automation of business process.

00:04.720 --> 00:11.640
And a big part of automation when you're using AI agents is positioning an AI agent so it can carry

00:11.640 --> 00:14.520
out your business process in the best possible way.

00:14.520 --> 00:19.680
And a lot of that comes down to what they once called prompt engineering and is now, of course, context

00:19.680 --> 00:20.520
engineering.

00:20.880 --> 00:23.880
And for the time being, we're just going to do pretty simple prompting stuff.

00:23.880 --> 00:27.160
I'm going to double click on the AI agent and up it comes.

00:27.160 --> 00:29.720
And this you'll remember, is the user message.

00:29.720 --> 00:34.840
We're taking the stuff that's coming in here and we're just shoving it in the prompt.

00:34.840 --> 00:38.280
Well, the thing about these expressions is that you can mix and match.

00:38.280 --> 00:41.200
You can put normal English above this.

00:41.240 --> 00:44.680
When we've got this expression right here, you can see that that's the result.

00:44.680 --> 00:45.720
Well look at what I can do.

00:45.720 --> 00:48.480
I can put a couple of lines up here and I can say bananas.

00:49.040 --> 00:51.040
And then this is what the result will be.

00:51.040 --> 00:51.680
Bananas.

00:51.720 --> 00:55.880
That wouldn't be very helpful for our agent, but maybe this would be more helpful.

00:55.960 --> 00:57.720
I just pasted in something I wrote earlier.

00:57.840 --> 01:03.220
Uh, you have access to the users equity portfolio, which is in a Google sheet.

01:03.340 --> 01:05.900
You also have access to market data.

01:05.940 --> 01:12.060
We've got to add that the user has asked you to rebalance their portfolio with this instruction.

01:12.300 --> 01:14.220
And then I've got the expression.

01:14.420 --> 01:18.100
And when we look at the results in the field immediately below look at what's happened.

01:18.140 --> 01:20.020
We've got that text I just typed.

01:20.020 --> 01:23.300
And then we've got the actual contents of this instruction.

01:23.300 --> 01:23.740
Right.

01:24.100 --> 01:26.820
It's kind of obvious when you see it.

01:26.860 --> 01:33.220
So that's a really nice way to make a prompt and add in the user's input as well.

01:33.420 --> 01:35.220
But wait, there's more.

01:35.580 --> 01:39.020
Right underneath this prompt I'm going to put some some more stuff as well.

01:39.020 --> 01:42.780
You can put bananas here too at the end, but that's also not very helpful.

01:42.860 --> 01:45.180
Instead I'm going to pay something else in here.

01:45.180 --> 01:46.660
And this is a bit more wordy.

01:46.700 --> 01:47.860
Let me read this to you.

01:48.060 --> 01:54.420
I'm saying in order to achieve this, number one, reading the portfolio from the sheet, number two,

01:54.460 --> 01:57.060
fetch the latest prices of the positions.

01:57.100 --> 01:59.940
Number three update the table with the prices.

02:00.060 --> 02:04.150
Number four Make decisions on portfolio rebalancing.

02:04.710 --> 02:04.990
Five.

02:05.030 --> 02:07.910
Update the table with the portfolio rebalancing decisions.

02:08.710 --> 02:09.710
Number six.

02:10.030 --> 02:15.630
Read the table again to check that your rebalancing met the objectives.

02:16.030 --> 02:19.590
Make any further changes in number seven like iterate.

02:19.590 --> 02:26.350
And finally send an email with the trading decisions and a concise push notification.

02:26.390 --> 02:28.230
You can see the tools I'm about to add.

02:28.550 --> 02:30.030
Uh, okay.

02:30.750 --> 02:32.310
So so what do you make of this?

02:32.350 --> 02:36.750
Have have a think about what I've done here and and what might be your counterpoint.

02:36.750 --> 02:40.110
What might feel a bit funny about what I've done just here?

02:40.110 --> 02:40.910
Well, here's the thing.

02:41.230 --> 02:45.750
If you were the challenging sword, which I know you're not, but if you were, you might say to me,

02:46.190 --> 02:49.870
look, you've kind of written out a workflow there.

02:49.910 --> 02:52.630
You've got like steps, you've even numbered them.

02:52.630 --> 02:53.990
You've got like steps.

02:54.150 --> 02:57.270
Why would why do we need an AI for this?

02:57.310 --> 03:03.450
If we've got steps to do, we could just lay out a workflow, we could use workflow tools, or there

03:03.490 --> 03:09.090
are a lot of other more simplistic non-ai workflow products where you can just do one step and then

03:09.090 --> 03:14.290
another step and another step and and surely the whole point of Agentic AI is that you're just giving

03:14.290 --> 03:16.410
it a goal and let it figure it out.

03:16.650 --> 03:20.890
To which I would say to you, yes, you're right, very good challenge.

03:21.250 --> 03:24.370
But these are quite loosey goosey steps.

03:24.530 --> 03:27.930
These are not steps that would be easy to turn into code.

03:27.930 --> 03:33.410
Look at this step here is like, uh, read the table again to check you achieved the objectives and

03:33.410 --> 03:36.850
make any further changes to improve the rebalancing.

03:37.050 --> 03:42.890
So this is kind of hand-wavy like rough human like instructions, like you might tell a person and you're

03:42.890 --> 03:46.650
just kind of taking not just one very, very high level goal.

03:46.650 --> 03:48.050
Rebalance the portfolio.

03:48.090 --> 03:53.450
You're giving it some guidance so it knows how to do it, but only in a pretty high level, flexible

03:53.450 --> 03:53.810
way.

03:53.930 --> 03:59.010
That gives it some autonomy, as I like to say, to decide exactly how to achieve this and how many

03:59.050 --> 04:01.860
iterations to do, how to read the spreadsheet.

04:01.900 --> 04:08.540
We're leaving a lot up to the agent, and this is the kind of balancing act that that is all about getting

04:08.540 --> 04:12.700
the most ability, the highest performance out of a genetic AI.

04:12.940 --> 04:17.980
It's about figuring out how to keep the instructions nice and high level, so that it has the flexibility

04:17.980 --> 04:23.900
to be intelligent and nuanced about your instructions and decide how to achieve the goal, whilst also

04:23.900 --> 04:28.500
giving it enough enough sort of rails so that it does stick to what you want it to do.

04:28.620 --> 04:34.340
And you know, there's something of an art to this, and the best way to get it right is by experimenting.

04:34.380 --> 04:35.900
There's no right answer.

04:35.940 --> 04:37.460
The best way is to try.

04:37.660 --> 04:42.780
And originally when I first built this, I did just have a very simple objective rebalance the portfolio.

04:42.780 --> 04:44.740
And I found that it wasn't reliable.

04:44.740 --> 04:47.460
And I've got to this point with some iteration.

04:47.460 --> 04:48.740
And that's what you have to do too.

04:48.780 --> 04:51.300
And certainly I would encourage you to be doing that.

04:51.340 --> 04:56.540
And that's where the real learning happens as you experiment with different levels of detail and find

04:56.540 --> 04:58.380
out what balance works best.

04:58.620 --> 05:04.200
And each model will have a slightly different balancing point to be to be found, and you may find that

05:04.200 --> 05:08.520
if you're using Gemini, that it's able to work with higher level instructions and be very reliable.

05:08.640 --> 05:10.960
So best thing to do is to experiment with it.

05:10.960 --> 05:16.320
But I wanted to give you that that understanding of why one does it this way and how I came up with

05:16.320 --> 05:17.240
these steps.

05:17.560 --> 05:17.920
Okay.

05:17.960 --> 05:18.520
Onwards.

05:18.680 --> 05:21.920
So in order to achieve all of this, we now need to add in some tools.

05:22.120 --> 05:24.480
And have you been paying attention to what we need to do?

05:24.520 --> 05:25.320
Let's go back.

05:25.360 --> 05:27.160
Maybe you could have a shot at this before.

05:27.160 --> 05:28.120
Before I do it with you.

05:28.160 --> 05:29.040
See if you can do it.

05:29.200 --> 05:30.360
Uh, but let's move.

05:30.400 --> 05:33.160
Give ourselves a bit of space and add in the first tool.

05:33.160 --> 05:33.760
What should we do?

05:33.800 --> 05:36.040
Well, let's go for the market stack.

05:36.480 --> 05:37.960
Add in market stack.

05:38.040 --> 05:38.960
Here it is.

05:39.000 --> 05:41.440
We're going to get end of day data.

05:41.440 --> 05:42.440
We want to get many.

05:42.480 --> 05:46.080
We let the model choose which ticker.

05:46.320 --> 05:48.760
And we just say here what was the other thing.

05:48.760 --> 05:51.600
We have to add a filter and say latest.

05:51.600 --> 05:53.480
And that is all set.

05:53.720 --> 05:55.880
That is market stack configured.

05:56.200 --> 06:00.600
I should confess that I believe you get 100 free lookups.

06:00.930 --> 06:06.610
Uh, and I exceeded my 100 free lookups, and I have just upgraded to the paid plan.

06:06.650 --> 06:10.650
You should be able to stay well within the 100 lookups for this project, but if you get into.

06:10.690 --> 06:14.090
Experimenting like I did, you might end up going above that number.

06:14.090 --> 06:16.010
And then you can choose what you want to do.

06:16.170 --> 06:20.850
Uh, but I decided it was worth it because I'm really enjoying this.

06:20.850 --> 06:24.050
So that is the the next tool, the market stack.

06:24.050 --> 06:27.450
One back to an old friend added to our agent.

06:27.450 --> 06:28.130
All right.

06:28.170 --> 06:29.010
Two more tools.

06:29.010 --> 06:34.410
Now they are both going to be about updating the sheet updating the Google sheet.

06:34.410 --> 06:38.170
There's two ways in which the sheets might need to get updated.

06:38.170 --> 06:39.570
So let's do them right now.

06:39.850 --> 06:42.610
So this is going to be using Google Sheets.

06:42.650 --> 06:45.650
This time we want it to be an update row.

06:45.890 --> 06:51.850
And we're going to update that that same spreadsheet so that it can update the prices.

06:51.850 --> 06:54.570
This tool will allow it to update the prices.

06:54.770 --> 06:59.930
So I've selected my Google Doc portfolio from from the documents for the sheet I'm going to select sheet

06:59.970 --> 07:02.940
one, which I think is the only sheet in that document.

07:02.940 --> 07:04.420
Document is right over here.

07:04.420 --> 07:05.620
Remember, this is what it looks like.

07:05.660 --> 07:10.100
It has a price column and a new quantity after rebalancing column.

07:10.100 --> 07:10.900
Here we go.

07:10.900 --> 07:11.540
What am I doing?

07:11.580 --> 07:13.380
It's still thinking.

07:13.740 --> 07:20.620
Um, and so then what we're going to have to do is to set it so that it can filter on the, on the ticker

07:20.620 --> 07:22.180
and set the price.

07:22.900 --> 07:24.660
It's a very slow for me.

07:24.700 --> 07:25.780
Hopefully it'll be faster for you.

07:25.820 --> 07:26.900
Sheet one there we go.

07:27.180 --> 07:35.260
Uh, so we're going to select on the uh ticker the ticket.

07:35.260 --> 07:36.860
We'll let the model decide.

07:37.180 --> 07:40.860
And we want it to be able to set the price.

07:40.900 --> 07:43.700
We will let the model define the price.

07:43.980 --> 07:44.940
There we go.

07:45.300 --> 07:50.220
Uh, so this this is what the, the this will be able to do to set the price.

07:50.620 --> 07:51.060
Okay.

07:51.100 --> 07:53.140
That is one of our tools added.

07:53.140 --> 07:54.980
And now we're going to do exactly the same thing.

07:54.980 --> 07:55.940
We're going to have another tool.

07:55.980 --> 07:57.220
Let me press the clean up button.

07:57.220 --> 07:57.780
There we go.

07:57.820 --> 07:59.180
We're going to add another tool.

07:59.460 --> 08:05.440
And it's also going to be Google Sheets, and this time it's going to allow it to change the portfolio.

08:05.800 --> 08:09.400
The rebalancing decisions will will add that to it as well.

08:09.400 --> 08:12.240
So we're going to be uh, update row again.

08:12.760 --> 08:13.920
Uh, update row.

08:14.040 --> 08:17.000
And I'll choose that document and we'll get that set up okay.

08:17.040 --> 08:22.160
So I've chosen portfolio I'm going to choose sheet one which there it is.

08:22.520 --> 08:29.720
And this time we're going to say uh that uh we're going to want to, to be able to again filter on the

08:29.720 --> 08:33.400
ticker, but we're going to want to be able to change the portfolio.

08:33.600 --> 08:37.880
Uh, the, um, this column here, new quantity after rebalancing.

08:37.880 --> 08:42.280
So it is filtering on ticker and then it's going to set column G.

08:42.800 --> 08:43.840
So it will work.

08:44.120 --> 08:45.680
Still fetching the columns.

08:47.720 --> 08:49.240
Let it finish that off hopefully.

08:49.240 --> 08:51.320
And it's going zippier for you.

08:51.600 --> 08:57.080
Uh, but uh and of course in week three will be self-hosting, so we'll be able to run at our computers

08:57.080 --> 08:57.600
speed.

08:57.960 --> 09:00.600
Uh, it's still fetching the columns.

09:01.010 --> 09:01.970
Uh, okay.

09:02.890 --> 09:05.170
Well, I will see you in a second when that's refreshed.

09:05.170 --> 09:06.890
And then we will set this up.

09:06.930 --> 09:07.290
Okay.

09:07.330 --> 09:09.690
So it says select column to match on.

09:09.690 --> 09:14.010
So we say the ticker using that to match.

09:14.410 --> 09:19.010
And we will set the new quantity after rebalancing.

09:19.010 --> 09:21.210
That is our other tool.

09:21.690 --> 09:22.410
Okay.

09:22.810 --> 09:24.250
We have now set up.

09:24.250 --> 09:25.810
So let's let's let's take stock.

09:25.850 --> 09:26.930
Let's clean up.

09:27.330 --> 09:29.730
We have tools for our agents.

09:29.730 --> 09:30.650
We have a tool.

09:30.930 --> 09:31.130
Wow.

09:31.170 --> 09:32.130
It hasn't cleaned up enough.

09:32.130 --> 09:33.770
We've got too much too many tools.

09:33.890 --> 09:35.170
Uh, this is cool.

09:35.370 --> 09:40.370
So we're going to be, uh, we have a tool that will will get the contents of the sheet.

09:40.370 --> 09:42.250
We will be able to look up market data.

09:42.250 --> 09:48.130
We'll be able to update rows in the sheet for pricing and update rows in the sheet for the the rebalance

09:48.130 --> 09:48.810
this column here.

09:48.810 --> 09:54.730
The new quantity after rebalancing the update to this after it's rejiggered the portfolio.

09:55.050 --> 09:55.970
All right.

09:56.010 --> 09:57.410
This is all pretty exciting.

09:57.410 --> 09:57.930
One more tools.

09:57.930 --> 09:59.090
Do we have any more tools.

09:59.250 --> 10:00.170
Do you remember the tools.

10:00.170 --> 10:01.650
Let's go and do those final tools.
