WEBVTT

00:00.160 --> 00:03.680
So I'm in the newest LinkedIn documentation on agents.

00:03.680 --> 00:09.720
And we have here a button which is going to allow us to copy this documentation as text.

00:09.720 --> 00:16.320
And this is actually something super innovative and something very useful that the team did, because

00:16.320 --> 00:20.920
it's going to allow us to use all these documentation as context.

00:21.040 --> 00:27.200
We'll be sending to our AI powered code editor like Cursor or Cloud Code, which is going to help us

00:27.200 --> 00:29.720
figure out how to do things with the new docs.

00:30.000 --> 00:36.120
This is a very interesting topic, which is called lm dot txt, which I do actually cover later in this

00:36.120 --> 00:36.600
course.

00:36.600 --> 00:38.360
You can check out those videos.

00:38.480 --> 00:41.880
They are under the MCP section right.

00:41.880 --> 00:49.960
So now I want to go and migrate my code to be using link chain v1 to be using the new interface.

00:50.240 --> 00:52.240
So this is going to be actually very easy.

00:52.480 --> 00:55.920
And the way I'm going to do it is actually with cursor.

00:56.120 --> 01:03.560
Now I'm doing it not because I'm lazy, it's because you can really see the difference with the generated

01:03.560 --> 01:08.150
diff cursor is going to create for us so we can really see everything side by side.

01:08.150 --> 01:09.350
What is being removed?

01:09.350 --> 01:10.750
What is being added?

01:10.790 --> 01:13.630
This is actually easier to understand in my opinion.

01:13.910 --> 01:22.470
So let me just fire up cursor agent and let me prompt it something like migrate the code in Main.py

01:22.630 --> 01:24.910
to the newest create agent interface.

01:24.910 --> 01:26.270
And here is the docs.

01:26.270 --> 01:29.510
And here I'm simply pasting everything from the docs.

01:30.070 --> 01:30.590
All right.

01:30.590 --> 01:36.230
So I'm going to fast forward everything because this query may take a minute or two.

01:37.390 --> 01:40.950
And let me go and wait until we get here.

01:41.270 --> 01:41.870
The diff.

01:43.150 --> 01:43.630
All right.

01:43.630 --> 01:46.430
So this query took us around three minutes.

01:46.630 --> 01:47.870
And let's review the diff.

01:47.870 --> 01:52.550
And it's actually going to match what we saw in the documentation in the earlier video.

01:53.070 --> 01:58.350
So we do not need the prompt hub because we do not need the react prompt.

01:58.390 --> 02:02.630
We do not need the agent executor because this is all going to be abstracted.

02:02.630 --> 02:06.190
And this is all going to be running on a graph under the hood.

02:06.670 --> 02:12.340
We do not need the create react agent we imported instead the create agent function.

02:12.620 --> 02:18.820
We don't need prompt template because we're not writing a custom react prompt, and we do not need a

02:18.820 --> 02:25.260
runnable lambda because we're going to be using a built in argument, which is going to help us accept

02:25.260 --> 02:26.580
structured output.

02:26.740 --> 02:32.500
And you can see we do not need this special react prompt with format distractions, simply because we

02:32.540 --> 02:37.740
are not going to be using a react prompt, because the reasoning is going to happen through the function

02:37.740 --> 02:39.980
calling capabilities of LMS.

02:40.260 --> 02:40.940
Alrighty.

02:40.940 --> 02:47.380
So after we finished with the imports, let's go and discuss the implementation and we can see we still

02:47.380 --> 02:51.300
need the agent response schema and we still need the list of tools.

02:51.340 --> 02:58.740
These haven't changed, but we did remove a lot of code that is around the structured output and is

02:58.740 --> 03:01.060
around the react prompt, which we do not need.

03:01.300 --> 03:06.700
And we simply have here a model variable which is going to be an instance of chat.

03:06.700 --> 03:08.500
OpenAI with GPT four.

03:08.540 --> 03:11.020
Maybe we can edit it later for GPT five.

03:11.700 --> 03:12.300
All right.

03:12.300 --> 03:19.120
And let's check out the implementation itself, so we do not use any more the create react agent function.

03:19.280 --> 03:26.480
Instead, we are using the create agent which is going to receive an input the model that tools like

03:26.480 --> 03:27.360
we did before.

03:27.640 --> 03:33.440
And this time we're also going to provide it with a response format argument, which is going to be,

03:33.640 --> 03:38.600
um, the schema of the agent response, which we covered in earlier videos.

03:38.600 --> 03:44.440
So that's going to make sure that the answer that the agent is going to return us is going to be a pydantic

03:44.440 --> 03:46.640
object of agent response type.

03:47.280 --> 03:54.200
And we can see we do not need the agent executor so that while loop, we do not need it anymore, we

03:54.200 --> 03:56.600
do not need the extract output lambda.

03:56.600 --> 04:01.800
We do not need the chain to extract the output link chain is going to handle everything for us.

04:01.800 --> 04:02.200
Now.

04:02.200 --> 04:08.040
It's super important to note that I will be showing in this course how this is implemented.

04:08.040 --> 04:08.880
Within Lang graph.

04:08.920 --> 04:14.320
We will actually build everything from zero and you'll know exactly what's the magic over here.

04:14.680 --> 04:17.120
So right now we're just reviewing the interface.

04:17.560 --> 04:23.710
So let's show how to use it and how to invoke it, because there is one small difference.

04:23.910 --> 04:28.910
So now the input we're going to be sending is simply a list of messages.

04:28.910 --> 04:31.350
So it's going to have the role of the user.

04:31.350 --> 04:35.870
And it's going to have the same content as we had in our input key.

04:36.310 --> 04:38.670
And the reason why we do it.

04:38.670 --> 04:43.590
So why we send messages instead of sending in the key of input.

04:43.790 --> 04:46.630
This is something I'm going to leave open right now.

04:46.710 --> 04:49.550
But I promise you, we do answer in this course.

04:49.550 --> 04:54.870
Why this subtle change which actually encompasses within it a lot of depth in it.

04:54.870 --> 04:57.030
So I don't want to give any spoilers.

04:57.030 --> 04:58.430
We will be seeing it later.

04:58.710 --> 05:05.670
And lastly, in order to access the answer of the agent, which is going to be the structured response

05:05.670 --> 05:13.670
as we want it to be, we need to access the key of structured response within the result here after

05:13.670 --> 05:15.070
we invoke the agent here.

05:15.310 --> 05:19.550
Um, so this is simply how long chain is going to structure the answer.

05:19.590 --> 05:20.030
Okay.

05:20.230 --> 05:21.630
So this is it.

05:21.630 --> 05:23.030
Those are all the changes.

05:23.030 --> 05:27.860
And you can see it's actually much simpler now to use the create agent.

05:27.860 --> 05:31.420
And the interface got way more simpler.

05:31.660 --> 05:38.500
And there is actually a reason why I did not start immediately with this implementation, and simply

05:38.500 --> 05:44.700
because I want to show you the evolution for you to really appreciate and for you to understand the

05:44.700 --> 05:51.860
motivation and the architecture decision that the link chain team and the link chain framework made

05:52.100 --> 05:54.460
in order for it to be where it is today.

05:54.700 --> 06:01.380
And in order to see why this create agent function, why it has much more benefits over earlier versions

06:01.380 --> 06:05.060
of the create react agent or create tool calling agents.

06:05.180 --> 06:12.060
And it's going to give us a much more in-depth understanding of the ecosystem and agents in general.

06:12.100 --> 06:17.100
Okay, so I just remind you that up until now we only saw interface.

06:17.100 --> 06:20.820
So we haven't discussed what link chain react is doing under the hood.

06:20.860 --> 06:25.300
And even what is this function is doing under the hood and how it's working.

06:25.300 --> 06:29.460
And this is going to be happening right in the next couple of sections.
