WEBVTT

00:00.280 --> 00:01.680
Well, I hope you're excited for this.

00:01.720 --> 00:03.200
We're going back to lab four.

00:03.480 --> 00:05.120
We are coming here.

00:05.480 --> 00:07.800
So we've looked through traders Pi.

00:07.840 --> 00:13.360
I remind you again that there is that constant at the top that you need to change if you're using the

00:13.400 --> 00:18.240
paid market provider, or you may be deciding to use a different market provider.

00:18.240 --> 00:21.520
If you've looked for some good MCP tools, it might be worth doing that.

00:21.520 --> 00:24.200
And so now we import trader from traders.

00:24.200 --> 00:24.600
This is it.

00:24.600 --> 00:29.920
This is a running that it's happening now we're going to create an instance of trader.

00:29.920 --> 00:31.960
And we're going to call it Alice.

00:33.240 --> 00:35.280
That seems to work okay.

00:35.760 --> 00:40.480
Now we are going to call init agent, which of course we have to await because it's async.

00:40.880 --> 00:44.560
So this is going to do things like creating all of our MCP servers.

00:46.080 --> 00:47.160
So this takes a little bit of time.

00:47.160 --> 00:51.920
All our MCP servers are creating and getting called done.

00:52.120 --> 00:54.440
So now we have an agent name is Alice.

00:54.640 --> 00:56.720
There are Alice's instructions.

00:57.240 --> 01:00.120
And uh, you can, uh, look through all that.

01:00.320 --> 01:04.320
There's all of the tools that are in there, and it's time for us to kick this off.

01:04.920 --> 01:06.800
So off it goes.

01:07.640 --> 01:14.160
So Alice is now running and there could be a lot of calls involved as before, but this time we are

01:14.160 --> 01:20.920
going through the module now because we have that flag that goes true false true false.

01:20.920 --> 01:24.800
It's going to start by doing trading rather than rebalancing.

01:25.200 --> 01:27.640
But we will let Alice do her thing.

01:27.920 --> 01:34.520
I'm just going to check that we should we should add in here some markdown to look at the of course

01:34.520 --> 01:35.080
to look.

01:36.440 --> 01:37.880
And Alice is finished already.

01:42.640 --> 01:44.080
But we should go and look at the trace.

01:44.080 --> 01:47.400
But first let's look at the results so we can see I'm too eager.

01:47.680 --> 01:48.520
So let's see.

01:48.560 --> 01:49.560
Trades executed.

01:49.600 --> 01:51.240
Bought five shares of Tesla.

01:51.280 --> 01:53.080
Bought ten shares of Nvidia.

01:53.400 --> 01:57.360
Rationale high trading volume indicates potential for short term gains.

01:57.720 --> 02:00.950
Remaining balance is 2.99 and portfolio appraisal.

02:00.990 --> 02:06.630
My portfolio now includes shares which are poised for potential rebounds amidst a volatile market.

02:06.670 --> 02:08.390
This all sounds perfectly sensible.

02:09.150 --> 02:10.830
I'm excited to see the trace.

02:10.830 --> 02:15.750
So as before, we go to, uh, platform OpenAI.

02:17.950 --> 02:22.870
And even though this output looks very legit, we shouldn't get excited until we've done the work to

02:22.910 --> 02:28.470
go and look at the trace and understand what's happening and confirm that this is performing as we would

02:28.470 --> 02:28.830
like.

02:28.990 --> 02:35.550
So there was 11 different tools in Alice Trading, which was what we were hoping to see and what we

02:35.550 --> 02:36.550
can see here.

02:36.790 --> 02:40.270
Okay, so Alice started with, uh, listing a bunch of tools.

02:40.270 --> 02:46.030
It went to the researcher who just did one web search this time, latest stock market news.

02:46.190 --> 02:48.510
And that came back a lot of currents.

02:48.670 --> 02:48.830
Wow.

02:48.870 --> 02:59.230
Lots of lots of, uh, checking of the market prices for Tesla, for Nvidia, for Amazon, for E.M.

02:59.270 --> 03:02.310
and it says unable to fetch current price or no price found.

03:03.030 --> 03:11.550
And PG is that Procter and Gamble and uh okay and then buy shares.

03:11.550 --> 03:12.830
Buy shares for Tesla.

03:12.870 --> 03:14.110
Buy shares for Nvidia.

03:14.470 --> 03:15.950
Buy shares for Amazon.

03:15.950 --> 03:17.750
And that was the response.

03:17.750 --> 03:20.510
So it definitely did did its work.

03:20.510 --> 03:22.030
It got the current stock market price.

03:22.030 --> 03:23.110
It bought the shares.

03:23.310 --> 03:25.870
Uh that is all great to see okay.

03:25.910 --> 03:31.270
And I've now gone through and run run a bunch more times for trading and rebalancing.

03:31.270 --> 03:38.790
It switches each time so we can see a bit of activity going on occasionally I've had MacD tools error

03:38.790 --> 03:40.350
ring as it has done here.

03:40.350 --> 03:42.630
And so that might be a cause for concern.

03:42.670 --> 03:46.510
And we can go and have a look at why of course by looking at the trace.

03:46.510 --> 03:54.630
But let's first see the final portfolio after rebalancing a Netflix is ten shares Tesla at ten shares.

03:55.030 --> 04:01.780
Uh five were bought and that leaves a cash balance and net profit and loss is down $60 on the trading

04:01.780 --> 04:03.220
activity of now.

04:03.220 --> 04:04.380
So not not the best of times.

04:04.380 --> 04:06.860
But I think the markets are are turbulent.

04:07.180 --> 04:12.300
Um, and so, uh, there's some explanation here of why it did what it did.

04:12.500 --> 04:14.740
But now let's go look at the trace.

04:15.460 --> 04:20.180
So here is the trace and we'll see why, uh, tools were erroring.

04:20.180 --> 04:20.500
You'll see.

04:20.500 --> 04:23.380
I've been doing trading, rebalancing, trading, rebalancing.

04:23.660 --> 04:32.260
Uh, so, um, Alice did, uh, some get company news and that had an error with the get company news

04:32.460 --> 04:38.580
route that is currently that tool, which is one of the tools, the free tools offered by the paid,

04:38.820 --> 04:43.180
uh, financial services, uh, MCP tool that we're using is not working.

04:43.220 --> 04:48.780
And so Alice instead just picked current stock price, which is working and which gave back a good stock

04:48.780 --> 04:49.300
price.

04:49.300 --> 04:56.100
So Alice wasn't perturbed by some, uh, ill behavior from one one API and just switched to other,

04:56.460 --> 05:01.020
uh, areas and then used the researcher tool, which would be a better way to get company news.

05:01.020 --> 05:03.340
And the researcher tool went off and did some research.

05:03.620 --> 05:06.940
Um, and the research tool got some information about Netflix.

05:07.220 --> 05:10.900
Um, but on getting some asking for some information on Apple.

05:11.100 --> 05:15.940
It got an error that the rate limit was exceeded because I've been running this too much, which is

05:15.940 --> 05:18.140
another little problem to be aware of.

05:18.380 --> 05:23.260
Uh, and uh, unperturbed, Alice kept trying, or the researcher kept trying.

05:23.500 --> 05:26.300
Uh, and, uh, in the end, I got another response.

05:26.300 --> 05:29.820
After a while, after doing a big query on some things.

05:30.060 --> 05:35.220
Um, but this may indicate that I need to put in some sort of a pause to make sure that these things

05:35.220 --> 05:39.700
don't, uh, mean that we get rate limits from from the brave web search.

05:39.940 --> 05:44.020
Um, but anyway, after doing all of that, after managing the fact that there were errors, I love

05:44.020 --> 05:49.740
that the fact that the autonomous agent was able to to handle it was retrying itself.

05:49.780 --> 05:52.460
I didn't give any instruction to retry.

05:52.580 --> 05:57.180
And also, when the get company news failed, it flipped over to the researcher instead.

05:57.180 --> 06:03.580
So it's really interesting to see that, to see that the agent is able to handle unexpected outcomes.

06:04.020 --> 06:08.020
And as a result, there has been some trading, there has been some rebalancing.

06:08.020 --> 06:11.300
And this is the the final outcome at this point.

06:11.300 --> 06:18.900
And so that completes the first part of our two parter on our capstone project, on building an autonomous

06:18.900 --> 06:22.220
agentic platform for making trading decisions.

06:22.540 --> 06:24.340
And it was a lot of fun.

06:24.500 --> 06:30.140
The thing to really bear in mind, the main learning point is that these kinds of agent platforms can

06:30.140 --> 06:38.420
be very powerful because by the nature of their autonomy, they are able to do things like handle API

06:38.420 --> 06:43.780
calls that aren't working and just trying out different approaches for getting their information, which

06:43.780 --> 06:49.900
which is extremely powerful and something that we wouldn't have thought possible only a few years ago.

06:49.940 --> 06:53.740
And this is why people are so excited about these kinds of platforms.

06:53.980 --> 06:57.410
Um, and then we're also seeing the power of MCP.

06:57.450 --> 07:03.290
The fact that there are all these different tools for the agents to be using, and that they are experimenting

07:03.290 --> 07:09.290
with using different tools, even saw in the last one how it tried using the get market information

07:09.290 --> 07:14.770
from from one MCP server, and when that failed, it flipped to using its research tool, which ends

07:14.770 --> 07:17.010
up using brave searches.

07:17.170 --> 07:23.770
So it's amazing to see how bringing together these different tools from MCP servers, from different

07:23.770 --> 07:30.970
authors across the world has allowed us to give extra capabilities, integrate capabilities into our

07:30.970 --> 07:33.050
agents really easily.

07:33.250 --> 07:39.130
And so that completes day four of our final week.

07:39.330 --> 07:40.850
I do hope you're enjoying it.

07:40.850 --> 07:48.450
I hope you're taking as much pleasure in this financial services or this autonomous alpha seeking agents

07:48.490 --> 07:49.290
as I am.

07:49.570 --> 07:54.290
And prepare yourself for the grand finale in the last day.

07:54.330 --> 07:55.490
I will see you then.
