WEBVTT

00:00.240 --> 00:03.560
And welcome to crew week three, day three.

00:03.840 --> 00:06.720
It is time for us to build a new project.

00:06.760 --> 00:11.960
The stock picker that I'm looking forward to showing you a quick reminder on the five steps that we

00:11.960 --> 00:16.320
use to build a crew project from last time we use crew, I create crew.

00:16.600 --> 00:24.720
We fill in the YAML files, we complete the crew module, we update Main.py to set any inputs for doing

00:24.720 --> 00:27.760
the run, and then we call crew I run.

00:28.480 --> 00:32.680
This time we're going to be going deeper again in three new ways.

00:32.880 --> 00:36.200
First of all, structured outputs will have a comeback.

00:36.200 --> 00:37.320
We looked at them last week.

00:37.320 --> 00:39.160
We'll do them again with crew.

00:39.680 --> 00:43.480
We'll use a custom tool in addition to the Serp tool that we'll use again.

00:43.520 --> 00:45.640
We'll also build our own tool.

00:45.840 --> 00:53.080
And then thirdly, we will try out the hierarchical process allowing crew to manage the process of what

00:53.120 --> 00:54.160
task goes where.

00:54.200 --> 00:57.160
And as you'll see, we'll have a bit of an adventure with that.

00:57.200 --> 00:57.680
All right.

00:57.680 --> 00:58.760
Let's get started.

00:58.800 --> 00:59.400
Okay.

00:59.400 --> 01:00.800
Here we are back in cursor.

01:00.840 --> 01:04.200
Back in Project Directory three crew.

01:04.520 --> 01:09.400
And let's open this up and we will bring up a terminal window again.

01:09.400 --> 01:15.360
As before, we'll go into that directory and we're going to create our new project which is of course

01:15.360 --> 01:18.040
crew I create crew.

01:18.040 --> 01:25.440
And then the name of the project which is going to be Stock picker, a project to create and recommendations

01:25.440 --> 01:32.720
for investing in the stock market, bearing in mind that this is purely for our own investigatory purposes

01:32.720 --> 01:35.640
and you should not use this to make any trading decisions, please.

01:36.080 --> 01:36.440
Okay.

01:36.440 --> 01:39.880
We're going to select open AI as our provider.

01:40.080 --> 01:42.440
And we're going to choose GPT four and mini.

01:42.440 --> 01:45.240
And we're not going to set up any env variables.

01:45.400 --> 01:48.440
And the crew has been successfully created.

01:48.840 --> 01:49.640
All right.

01:49.640 --> 01:53.520
It's now first of all time for us to open up our stock picker.

01:53.840 --> 01:57.480
And as usual go into source, go into config.

01:57.480 --> 02:01.000
And the first step is to create our agents.

02:01.000 --> 02:03.870
So we will go ahead and do that now.

02:04.350 --> 02:04.790
Okay.

02:04.830 --> 02:07.630
So here we are in YAML.

02:07.630 --> 02:10.790
And we're going to create the agents for this project.

02:10.790 --> 02:12.310
And there's going to be a few of them.

02:12.710 --> 02:16.950
So I'm going to bring them in an agent at a time so that we can talk them through.

02:17.190 --> 02:21.110
So the first agent is called the trending Company Finder.

02:21.110 --> 02:26.910
And it's responsible for looking in the news and finding trending companies in a particular sector.

02:27.030 --> 02:27.990
So you read the news.

02:27.990 --> 02:32.110
You find 2 to 3 companies that are trending for further analysis.

02:32.150 --> 02:33.950
And we'll use GPT for a minute here.

02:33.950 --> 02:37.390
But you can of course substitute in whichever model you'd like.

02:37.390 --> 02:39.510
And it might be fun to play around with different ones.

02:40.070 --> 02:44.270
The next one we will use, and let me make sure I paste this in properly.

02:44.270 --> 02:44.950
There we go.

02:44.950 --> 02:46.990
Is a financial researcher.

02:47.310 --> 02:48.910
The financial researcher.

02:48.950 --> 02:54.030
Given details of trending companies you provide comprehensive analysis.

02:54.230 --> 02:58.550
So financial expert with a proven track record of deeply analyzing hot companies.

02:58.870 --> 03:03.310
Again we'll go with GPT four mini as the backstory.

03:03.750 --> 03:11.990
Okay one more agent that we're going to work with, and that next agent is going to be a stock picker.

03:12.470 --> 03:16.070
So we've done we've we've found trending companies in the news.

03:16.070 --> 03:19.110
We've researched those trending companies.

03:19.190 --> 03:21.350
What's left to do is to pick one.

03:21.550 --> 03:27.510
So the stock picker given a list of researched companies with investment potential, you select the

03:27.510 --> 03:32.710
best one for investment, notifying the user and then providing a detailed report.

03:32.750 --> 03:34.590
Don't pick the same company twice.

03:34.950 --> 03:40.310
You're a meticulous, skilled financial analyst with a proven track record of equity selection.

03:40.550 --> 03:44.710
These are all great ideas for well crafted prompts to be using.

03:44.910 --> 03:50.950
And again, we'll use GPT four mini for now and let's save that.

03:51.430 --> 03:53.910
I'm going to add in one more agent as well.

03:53.950 --> 03:56.830
A new agent for us to be exploring this time.

03:56.830 --> 03:59.630
And the new agent is going to be a manager.

03:59.830 --> 04:01.990
But I'm going to keep this manager very simple.

04:02.270 --> 04:06.870
The role is a manager, and I'm saying you're a skilled project manager who can delegate tasks to.

04:06.910 --> 04:12.190
In order to achieve your goal, which is your goal is to pick the best company for investment.

04:12.630 --> 04:13.550
And that's it.

04:13.550 --> 04:17.390
So very simple vanilla description of that agent.

04:17.390 --> 04:21.110
And therein there is our four agents for this project.

04:21.550 --> 04:22.470
So far so good.

04:22.510 --> 04:23.590
You like those four agents.

04:23.590 --> 04:25.990
It's time for us to define the tasks.

04:26.390 --> 04:31.150
And when defining tasks the trick is to be very clear, very simple.

04:31.350 --> 04:36.430
And so the first task is a find trending company's task.

04:36.670 --> 04:43.150
Find the top trending companies in the news in this sector by searching the latest news.

04:43.350 --> 04:49.150
Find new companies that you've not found before and the output, a list of trending companies in that

04:49.150 --> 04:49.790
sector.

04:50.190 --> 04:54.390
And we are going to say that assign it, of course, to the agent.

04:54.390 --> 04:59.630
The trending company finder is the agent that will work on this, and it will put it in an output file.

04:59.670 --> 05:05.590
Trending companies in, uh, output that you may be wondering why that says JSON.

05:05.590 --> 05:07.110
It will become clear in one second.

05:07.630 --> 05:08.390
Okay.

05:08.430 --> 05:11.750
So then going to have our next task.

05:11.790 --> 05:18.550
And our second task is going to be a research trending companies task.

05:18.710 --> 05:23.310
The description is given a list of trending companies provide a detailed analysis of each company in

05:23.310 --> 05:24.030
a report.

05:24.390 --> 05:27.590
And the agent of course will be the financial researcher.

05:27.630 --> 05:29.510
The second agent that we made.

05:29.510 --> 05:32.950
So this this 1 to 1 correspondence between a task and an agent right now.

05:33.510 --> 05:36.230
And we're giving it we're telling it to have some context.

05:36.230 --> 05:39.950
And the context is the find trending companies task.

05:40.350 --> 05:43.790
And we're asking it to put it in an output as well.

05:44.750 --> 05:48.590
And you can see that already cursor is one step ahead.

05:48.590 --> 05:51.030
But we're going to ignore cursor.

05:51.230 --> 05:53.310
And I'm going to put it in myself.

05:53.550 --> 05:57.390
The pick best company task is the final task in the list.

05:57.390 --> 06:03.470
It's of course assigns to the stock picker agent, and it is to analyze research findings, pick the

06:03.470 --> 06:07.630
best company for investment, then send a push notification to the user.

06:07.630 --> 06:08.580
That's a new one.

06:08.580 --> 06:12.300
You can imagine that it's going to be the tool that we will add, a tool that we've used before.

06:12.300 --> 06:18.820
But the first time in crew and we'll, we'll ask for a one sentence rationale and then respond with

06:18.820 --> 06:23.140
a detailed report on why you chose this company and which companies were not selected.

06:23.540 --> 06:26.860
And then the agent I just said was a stock picker.

06:27.020 --> 06:31.660
And the context is of course, the research trending companies.

06:32.140 --> 06:33.540
So there we have it.

06:33.580 --> 06:35.500
We've now defined our tasks.

06:35.780 --> 06:41.940
And again, it's worth noticing how I've made these prompts very instructive, very crisp.

06:41.940 --> 06:45.420
I've used consistent language with things like trending companies.

06:45.660 --> 06:51.220
All of these, these are all small steps that help make sure you get coherent responses.

06:51.260 --> 06:54.540
Although as you'll see, it's not going to be perfectly coherent.

06:54.540 --> 06:55.980
But it definitely helps.

06:56.020 --> 06:58.180
And I've experimented with this a fair bit.

06:58.220 --> 07:03.740
And in previous versions, when I was iterating on this, I had inconsistent language between agents

07:03.740 --> 07:07.380
and tasks and definitely causes less stability.

07:07.420 --> 07:09.580
So I think that's a that's a pro tip for you.
