WEBVTT

00:00.200 --> 00:02.480
And now we move on to tasks.

00:02.480 --> 00:08.560
And here you'll see that there is a research task and a reporting task by default.

00:08.560 --> 00:11.800
But we're going to change this and we're going to have a few different tasks.

00:11.800 --> 00:13.760
We're going to have a task called propose.

00:14.320 --> 00:19.160
This is of course going to be the task which is about proposing a motion.

00:19.400 --> 00:22.280
And so the description what is this task.

00:22.720 --> 00:26.480
It's going to be your proposing the motion and then the motion that gets passed in.

00:26.480 --> 00:30.440
When we do that part come up with a clear argument in favor of the motion.

00:30.480 --> 00:31.760
Be very convincing.

00:32.320 --> 00:36.680
Then we're going to have an expected output, which is going to be quite simple.

00:36.680 --> 00:43.560
The expected output is going to be your clear argument in favor of the motion in a concise manner.

00:44.080 --> 00:44.960
The agent.

00:44.960 --> 00:48.360
So this is where you associate a task with an agent.

00:48.360 --> 00:51.760
And obviously this is going to be associated with the debater agent.

00:52.200 --> 00:55.720
And then there's one other thing we can do here which is an output file.

00:55.840 --> 01:02.120
We want to put this in a subdirectory output and we will call it propose.md.

01:02.120 --> 01:06.310
And so there you have our proposal task.

01:06.310 --> 01:11.510
So now we're going to have another task which I'm going to copy and paste.

01:11.510 --> 01:14.750
And this one is going to be oppose.

01:15.110 --> 01:18.470
This is the debater that's saying no description.

01:18.710 --> 01:27.470
Instead of proposing you are in opposition to the motion, come up with a clear argument against the

01:27.470 --> 01:28.390
motion.

01:28.510 --> 01:29.910
Looks like Kostas can help there.

01:29.910 --> 01:30.910
It does help.

01:30.950 --> 01:32.150
Be very convincing.

01:32.190 --> 01:34.430
Your clear argument against the motion.

01:34.670 --> 01:37.510
And that should be opposed.

01:37.550 --> 01:38.590
It's amazing, isn't it?

01:38.590 --> 01:45.750
So cursive does all the work for us, and now we have our final task, which is going to be called decide.

01:46.350 --> 01:49.230
And uh, the there's a little tip here.

01:49.270 --> 01:54.430
Something which is worth knowing is that you cannot call your tasks the same thing as you call your

01:54.430 --> 01:58.550
agents, or you will have a problem with conflicting names.

01:58.550 --> 02:02.110
So sometimes it's better to call this like proposed task, opposed task.

02:02.430 --> 02:03.270
But I've kept it short.

02:03.270 --> 02:06.790
But we couldn't, for example, call this task judge.

02:06.830 --> 02:09.950
Otherwise that would conflict with the agent that we called judge.

02:10.430 --> 02:11.070
All right.

02:11.310 --> 02:14.550
So description we will say review.

02:14.870 --> 02:15.310
Let me see.

02:15.350 --> 02:18.310
Now review the arguments.

02:18.910 --> 02:19.710
Here we go.

02:20.990 --> 02:25.710
Review the arguments presented by the debaters and decide which side is more convincing.

02:26.110 --> 02:29.950
And we'll just change this to delete all of this.

02:30.790 --> 02:31.870
We don't need any of that.

02:31.910 --> 02:38.150
We just need to say the expected output is your decision on which side is more convincing.

02:38.550 --> 02:41.590
And let's say and why.

02:42.230 --> 02:42.870
All right.

02:42.870 --> 02:47.390
And then the this should go please to a folder.

02:47.430 --> 02:52.950
Outputs and decide for the output.

02:52.990 --> 02:53.350
All right.

02:53.350 --> 02:54.110
That seems good.

02:54.150 --> 02:56.150
So there are our tasks.

02:56.830 --> 02:57.510
Okay.

02:57.870 --> 03:04.430
So the final step really is is the final steps is setting up pi and Main.py.

03:04.710 --> 03:06.180
And then we'll be ready to go.

03:06.900 --> 03:09.820
So this is the default module crew dot pi.

03:09.820 --> 03:13.980
And you can see it's got some stuff in here based on the standard scaffolding.

03:14.100 --> 03:16.140
It has created a class.

03:16.340 --> 03:19.660
And it's got this crew base decorator around it.

03:19.700 --> 03:23.780
And this class is named the same as the name of our project debate.

03:23.780 --> 03:27.540
So it's set that for us and it called it Debate Crew, which is exactly right.

03:27.780 --> 03:33.460
Now one of the things I dislike a bit is that it does generate all of this scaffolding code, all this

03:33.460 --> 03:37.660
standard code with lots of comments, and you can read some of the comments and follow the links.

03:37.660 --> 03:41.740
And it's got stuff like there's, there's ways that you can add in functions that get called at the

03:41.740 --> 03:43.740
beginning and end and stuff like that.

03:43.740 --> 03:49.180
But I do find that these comments are get in the way a bit, and I usually start by coming through and

03:49.180 --> 03:52.340
deleting everything in these just to keep it nice and clean.

03:52.340 --> 03:58.140
But what you'll see that it's done that is nice is that it brings in the agent's config and the tasks

03:58.140 --> 03:58.820
config.

03:58.980 --> 04:02.980
It just brings them in from the config folder right here.

04:02.980 --> 04:06.380
So those are set as variables for this class.

04:06.380 --> 04:09.460
And you can see how it refers directly to our configuration.

04:09.460 --> 04:13.740
And of course, that means that if you had different configuration files, then you could bring them

04:13.740 --> 04:15.020
in just like that.

04:15.060 --> 04:17.780
Then this is stuff about how you can bring in your own tools.

04:17.980 --> 04:21.740
And then this is where we set up our agents.

04:21.820 --> 04:24.060
So obviously we don't have an agent called researcher.

04:24.060 --> 04:26.140
We have an agent called debater.

04:26.500 --> 04:31.740
And the At agent decorator is telling crew that this is an agent.

04:31.980 --> 04:34.140
It's going to return an agent.

04:34.180 --> 04:37.460
The config we're going to want to change that to debater.

04:37.460 --> 04:38.820
And we'll leave it verbose.

04:38.980 --> 04:39.220
True.

04:39.260 --> 04:42.740
Which means that we'll get a nice sort of print as it's running with what's going on.

04:43.260 --> 04:46.820
And then we'll have another agent and remember the name of this guy.

04:47.060 --> 04:52.220
Well, even if you don't, luckily cursor does and it's filled it in in both places.

04:52.220 --> 04:52.980
There we go.

04:53.020 --> 04:55.180
The judge is our other agent.

04:55.740 --> 04:56.500
All right.

04:56.940 --> 05:00.340
And now I'm getting rid of the comments about tasks.

05:00.340 --> 05:04.940
But it tells you about how you can do things like track outputs and dependencies and the like.

05:04.940 --> 05:07.580
But we're going to go on and define our our tasks.

05:07.620 --> 05:10.410
They have a again the decorator task.

05:10.650 --> 05:13.450
And now we're going to have a task called propose.

05:14.250 --> 05:15.530
And there we go.

05:15.570 --> 05:16.770
Cursor fills it in.

05:16.810 --> 05:19.250
Now it has an output file listed there.

05:19.250 --> 05:23.650
But we don't need that because it's already specified in our config file.

05:23.650 --> 05:25.130
So that's not actually needed.

05:25.450 --> 05:29.890
And you know now that I look at this I do I have to say I think this would be cleaner if we have this

05:29.890 --> 05:32.890
all on one line like this, we don't need to be on multiple lines.

05:33.010 --> 05:37.690
And now you can see how very simple this whole function is going to look.

05:37.730 --> 05:39.330
And look cursor is going to do it for us.

05:39.330 --> 05:40.810
And then we can just delete that.

05:41.250 --> 05:45.490
Sorry I'm tidying this all up when you see how much better it is when this is in JupyterLab.

05:45.490 --> 05:47.290
And you don't have to watch me doing all this.

05:47.650 --> 05:48.690
So don't hate me.

05:48.690 --> 05:52.850
I'll be quick, but I think it's nicer if we have it looking nice and sharp like that.

05:52.850 --> 05:55.290
You see how nice and simple and clean this is?

05:55.450 --> 06:01.090
And that's the benefit of using the the config that we don't need to, to have too much here.

06:01.090 --> 06:03.490
And then the other task is oppose.

06:04.250 --> 06:06.970
And obviously it brings in the config for oppose.

06:06.970 --> 06:09.650
And then the final one is decide.

06:09.930 --> 06:11.120
And there we go.

06:11.160 --> 06:13.520
Thank you cursor for filling that in for us.

06:13.920 --> 06:18.080
So those are our two agents and three tasks.

06:18.080 --> 06:20.640
And we are down to the final section here.

06:21.280 --> 06:21.920
Okay.

06:22.160 --> 06:25.920
So now we now create this the crew.

06:26.360 --> 06:29.040
And this is, this is in the the function crew.

06:29.040 --> 06:30.640
And it has the decorator crew.

06:31.000 --> 06:36.120
And I'm going to take out the, the piece there which we will be coming to later.

06:36.160 --> 06:39.520
So we just simply have to create an instance of crew.

06:39.760 --> 06:47.680
We populate the agents with self dot agents and as cry helpfully tells us, this is automatically created

06:47.680 --> 06:49.880
by the agent decorator.

06:50.440 --> 06:53.440
We populate it with the tasks that are similarly created.

06:53.640 --> 06:59.560
This is where we choose to be sequential rather than hierarchical in our process, and that we want

06:59.560 --> 07:00.920
to be verbose.

07:00.960 --> 07:04.880
And then there's some stuff about being hierarchical if you want to.

07:05.160 --> 07:10.600
And uh, look, if you want to use that nice little comment from the crew team in there.

07:11.040 --> 07:11.640
Okay.

07:11.760 --> 07:14.000
that's it for our crew object.

07:14.000 --> 07:15.280
We're almost finished.

07:15.560 --> 07:16.560
That was our crew module.

07:16.560 --> 07:20.520
We're now going to the main module where we finish things off.

07:21.040 --> 07:26.080
So this this is the again there's all of this stuff that you can read.

07:26.480 --> 07:29.840
This main file is intended to run your crew locally.

07:29.840 --> 07:32.920
So refrain from adding unnecessary logic.

07:33.240 --> 07:33.920
Gotcha.

07:34.320 --> 07:41.280
So inputs when we're running the crew, this is where we choose those template values that we put in

07:41.280 --> 07:42.320
our YAML file.

07:42.320 --> 07:44.400
This is where we choose what we want them to be.

07:44.440 --> 07:50.960
And so what we want them to be here is we want to have a motion and we want to give ourselves a nice

07:50.960 --> 07:51.320
motion.

07:51.320 --> 07:52.680
We don't we don't have this.

07:52.720 --> 07:54.840
We only have the one field motion.

07:55.160 --> 07:56.720
And what motion?

07:56.720 --> 07:59.520
What do we think that we would like them to debate?

07:59.600 --> 08:08.960
Let's have the motion is there should be a that was that was where I was heading with this uh, cursor.

08:09.240 --> 08:13.710
I must be super predictable, but it does seem like a good one to have our eyes A's debate.

08:13.750 --> 08:14.830
Let's not say there should be.

08:14.830 --> 08:22.030
Let's say there needs to be strict laws to regulate llms.

08:22.470 --> 08:22.990
There we go.

08:23.030 --> 08:25.870
That's a nice meaty topic for them to debate.

08:26.190 --> 08:29.230
And then we've got our stuff down here.

08:29.230 --> 08:30.310
We will come back to this stuff.

08:30.310 --> 08:31.870
We don't care about any of that.

08:32.030 --> 08:34.310
That is all it should take.

08:34.310 --> 08:39.550
We should now be ready to run our first crew just based on that.

08:40.190 --> 08:46.270
Actually, just before we run, let me make another little change that in this main module.

08:46.270 --> 08:51.710
I'm just going to make sure we print the result to the screen just to be satisfying.

08:51.750 --> 08:53.350
It will be saved to a file as well.

08:53.670 --> 08:55.590
Results equals debate.

08:55.710 --> 08:58.750
And then we will print result dot raw.

08:58.870 --> 09:05.030
That will print the raw output from the final task sent to the final agent.

09:05.630 --> 09:11.510
And then maybe one other little change I'll make is I realize we're right now sending both the debater

09:11.510 --> 09:15.950
and the judge to be OpenAI, but it would be more interesting to switch this one up.

09:15.990 --> 09:16.950
Let's let's flip it.

09:16.950 --> 09:18.030
As cursor suggests.

09:18.070 --> 09:21.270
Let's use Claude 37 sonnet latest.

09:21.310 --> 09:27.950
The latest Claude 3.7 model so that we have anthropic judging OpenAI's debates.

09:27.950 --> 09:34.110
And this also means that we'll be using anthropic this time, which was harder for us last time.

09:34.550 --> 09:37.670
Okay, so with that now I think we should be ready.

09:37.710 --> 09:39.790
We can bring up a terminal.

09:40.030 --> 09:40.830
Here it is.

09:41.070 --> 09:47.350
We will want to change into the directory for crew and then the directory for debate.

09:47.590 --> 09:49.590
And now we simply type crew.

09:49.590 --> 09:52.870
I run to kick off the run.

09:52.870 --> 09:56.630
And the first time you do this, it's going to do some UV stuff to build the environment.

09:56.630 --> 09:58.870
But I've already done it, so it's running right away.

09:59.030 --> 10:01.150
You can see it's executing tasks.

10:01.390 --> 10:05.430
The debater, each of the agents is running it's debate right now.

10:05.430 --> 10:10.630
It's the the debater for the proposer has already said the against is now debating.

10:10.950 --> 10:15.830
And now we're deciding on the winner of the debate based on the arguments.

10:15.830 --> 10:16.900
It is anthropic.

10:16.940 --> 10:17.860
That is thinking.

10:18.340 --> 10:24.860
And with any luck, we will soon see whether anthropic decides for or against the motion.

10:25.260 --> 10:25.900
Here we go.

10:25.980 --> 10:26.820
Let me see.

10:27.500 --> 10:33.220
In evaluating, I found the arguments in favor of the motion to be more convincing.

10:33.420 --> 10:39.100
So the view is that there should be strict laws to regulate large language models, such as the very

10:39.100 --> 10:41.420
one that is making the judgment here.

10:41.780 --> 10:42.380
Okay.

10:42.420 --> 10:43.020
So that ran.

10:43.020 --> 10:46.180
And look, that's quite a wordy response that came from anthropic.

10:46.220 --> 10:50.500
There you get to see in here the trace of the thinking that happened.

10:50.500 --> 10:53.700
And you'll see that an output directory has been created.

10:53.700 --> 10:59.220
And if we open this up and if I close this terminal so it's not in the way we can go into the output,

10:59.220 --> 11:05.580
and you'll see that there is weighty argument in favor of LM law regulation that you can read about

11:05.580 --> 11:12.740
about the ethical, safety and social challenges necessitating strict regulatory frameworks and then

11:12.740 --> 11:15.300
the opposing thinking as well.

11:15.780 --> 11:19.020
It's no doubt going to be about hindering creativity.

11:19.260 --> 11:19.900
Yes.

11:19.940 --> 11:20.580
Very good.

11:20.620 --> 11:23.540
And I'm sure there's some compelling arguments there, too.

11:23.780 --> 11:28.900
And then the decision is the thing that we already saw printed a moment ago that came from anthropic.

11:29.100 --> 11:33.460
And so that is our first experiment into the world of crew.

11:33.500 --> 11:35.180
We set up our yamls.

11:35.180 --> 11:40.820
We set up our overall our our module for crew, the crew module.

11:40.980 --> 11:47.620
And then the main.py was where we set the motion, which was the thing that was templated in the various

11:47.620 --> 11:48.260
YAML documents.

11:48.260 --> 11:57.580
And we actually ran our debate with debate crew kickoff passing in the inputs this dictionary of the

11:57.940 --> 12:00.820
templated keys with their values.

12:01.300 --> 12:07.660
So I hope you enjoyed our first foray into crew AI, and I very much encourage you to do the same thing.

12:07.700 --> 12:12.740
Well, of course you will actually see this debate project in there, but you can go and make a second

12:12.740 --> 12:16.860
one or just run this by typing query run and get a handle.

12:16.900 --> 12:20.140
Get a good sense for how crew AI works.
