WEBVTT

1
00:00:00.120 --> 00:00:03.000
<v ->So we talked about the Planning Tool</v>

2
00:00:03.000 --> 00:00:04.680
or To-Do List tool,

3
00:00:04.680 --> 00:00:07.680
and let's talk about another characteristic;

4
00:00:07.680 --> 00:00:11.550
and this is the Sub Agents capability.

5
00:00:11.550 --> 00:00:15.900
So Deep Agents employ the idea of Sub Agents,

6
00:00:15.900 --> 00:00:18.510
which are going to enable us have something

7
00:00:18.510 --> 00:00:22.110
which is called hierarchical delegation.

8
00:00:22.110 --> 00:00:25.200
And this means the Deep Agent itself

9
00:00:25.200 --> 00:00:29.850
can spawn and create new instances of itself,

10
00:00:29.850 --> 00:00:34.850
but those instances are going to be specialized Sub Agents

11
00:00:35.670 --> 00:00:37.950
for focused tasks.

12
00:00:37.950 --> 00:00:41.160
So each Sub Agent is going to be holding

13
00:00:41.160 --> 00:00:44.760
its different system prompt, its own description,

14
00:00:44.760 --> 00:00:47.760
its different set of tools it can use.

15
00:00:47.760 --> 00:00:51.060
And this is actually quite genius I have to say,

16
00:00:51.060 --> 00:00:54.300
because this is exactly like we have in real-life.

17
00:00:54.300 --> 00:00:57.210
Whenever we don't feel like doing something

18
00:00:57.210 --> 00:01:01.080
and we want to delegate a task to another,

19
00:01:01.080 --> 00:01:03.660
then we need to make sure that the other person,

20
00:01:03.660 --> 00:01:07.020
he has the correct skills and the correct tools

21
00:01:07.020 --> 00:01:08.370
to achieve that tasks.

22
00:01:08.370 --> 00:01:09.540
But not only that,

23
00:01:09.540 --> 00:01:13.260
we need to know how to explain to that person what to do.

24
00:01:13.260 --> 00:01:16.020
And let me give you an example from the real-world.

25
00:01:16.020 --> 00:01:20.040
So I personally am not a handyman,

26
00:01:20.040 --> 00:01:22.380
I have no craftsmanship,

27
00:01:22.380 --> 00:01:25.860
and I don't know how to drill a hole in the wall,

28
00:01:25.860 --> 00:01:27.960
and I'm really, really bad at this stuff.

29
00:01:27.960 --> 00:01:30.900
And I've had a really annoying issue in my house

30
00:01:30.900 --> 00:01:33.660
where I have this kind of hatch in the ceiling

31
00:01:33.660 --> 00:01:35.340
of my top floor,

32
00:01:35.340 --> 00:01:37.080
and every time it rains,

33
00:01:37.080 --> 00:01:41.940
then what happens is that the rain hits this hatch,

34
00:01:41.940 --> 00:01:45.660
and it's covered with fiberglass or some kind of material,

35
00:01:45.660 --> 00:01:48.240
and it makes a lot of noise.

36
00:01:48.240 --> 00:01:49.980
And when it's pouring raining,

37
00:01:49.980 --> 00:01:51.390
it's really, really noisy

38
00:01:51.390 --> 00:01:54.510
and it echoes through the entire house,

39
00:01:54.510 --> 00:01:56.670
so I really needed to handle this.

40
00:01:56.670 --> 00:02:00.000
And in order to fix it, I bought some synthetic grass

41
00:02:00.000 --> 00:02:02.310
to simply put over the fiberglass,

42
00:02:02.310 --> 00:02:04.170
so that when the rain drops,

43
00:02:04.170 --> 00:02:06.060
it's not going to hit the fiberglass,

44
00:02:06.060 --> 00:02:08.490
it's going to drop on the synthetic grass,

45
00:02:08.490 --> 00:02:11.160
and then it's going to be much less noise.

46
00:02:11.160 --> 00:02:12.450
And the ceiling is pretty high,

47
00:02:12.450 --> 00:02:14.520
and in order to get up to the roof,

48
00:02:14.520 --> 00:02:16.470
you need to have this kind of special ladder

49
00:02:16.470 --> 00:02:18.780
where it needs to open diagonally,

50
00:02:18.780 --> 00:02:20.670
and you can then climb to the roof

51
00:02:20.670 --> 00:02:24.540
and then assemble this piece of synthetic grass.

52
00:02:24.540 --> 00:02:27.600
Anyways, I don't have the skills even to do it.

53
00:02:27.600 --> 00:02:29.970
So what I did is call my father-in-law

54
00:02:29.970 --> 00:02:31.680
who is really good at this stuff.

55
00:02:31.680 --> 00:02:36.510
And he went in with his own tools, he has a box cutter,

56
00:02:36.510 --> 00:02:39.270
which he used to cut the synthetic grass

57
00:02:39.270 --> 00:02:40.950
into the right size,

58
00:02:40.950 --> 00:02:44.250
and he used his own ladder to climb to the ceiling

59
00:02:44.250 --> 00:02:45.900
and to do all of this.

60
00:02:45.900 --> 00:02:47.910
And I think the analogy of a Sub Agent

61
00:02:47.910 --> 00:02:49.260
is really appropriate here

62
00:02:49.260 --> 00:02:52.500
because I had a message that I wrote to him

63
00:02:52.500 --> 00:02:55.290
that I needed help with doing this task.

64
00:02:55.290 --> 00:02:59.220
I described the task, and then he came with his own tools,

65
00:02:59.220 --> 00:03:02.370
and his own "system prompt," which is his skills,

66
00:03:02.370 --> 00:03:04.020
and he knows how to do these things.

67
00:03:04.020 --> 00:03:05.520
He went and did it,

68
00:03:05.520 --> 00:03:07.020
I wasn't even there when he did it,

69
00:03:07.020 --> 00:03:08.520
because he had a key to the house.

70
00:03:08.520 --> 00:03:12.450
And finally the result was I went and everything was fixed.

71
00:03:12.450 --> 00:03:13.890
And when it rains now,

72
00:03:13.890 --> 00:03:16.230
it doesn't echo through my entire home.

73
00:03:16.230 --> 00:03:19.170
And this is really similar to how Sub Agents work.

74
00:03:19.170 --> 00:03:21.450
Now, I want to add on top of that,

75
00:03:21.450 --> 00:03:25.350
that while he was working, I had no idea what's happening.

76
00:03:25.350 --> 00:03:30.000
So as far as context, he was working in context isolation.

77
00:03:30.000 --> 00:03:32.130
I didn't know what was happening,

78
00:03:32.130 --> 00:03:34.233
and I just got the final result.

79
00:03:35.250 --> 00:03:39.750
So let's go back to the discussion on Sub Agents.

80
00:03:39.750 --> 00:03:43.560
The Sub Agents, they're going to do isolated work,

81
00:03:43.560 --> 00:03:45.540
so this means they're going to run

82
00:03:45.540 --> 00:03:47.640
in their own context window

83
00:03:47.640 --> 00:03:51.450
without polluting the main agent's context window,

84
00:03:51.450 --> 00:03:53.940
and they're going to be specialized.

85
00:03:53.940 --> 00:03:57.810
So they can have their own system prompt, their own tools,

86
00:03:57.810 --> 00:04:01.200
which can differ from one Sub Agent to another.

87
00:04:01.200 --> 00:04:05.790
And this gives us the capability to scale our work

88
00:04:05.790 --> 00:04:08.040
and to actually get more quality work

89
00:04:08.040 --> 00:04:10.260
with specialized agents here.

90
00:04:10.260 --> 00:04:12.600
So those Sub Agents are going to execute

91
00:04:12.600 --> 00:04:14.490
on their own tool calling loops,

92
00:04:14.490 --> 00:04:16.980
their own react loops internally,

93
00:04:16.980 --> 00:04:20.580
and they're going to return back only the final response

94
00:04:20.580 --> 00:04:23.160
without those intermediate results.

95
00:04:23.160 --> 00:04:25.560
So this delegation pattern

96
00:04:25.560 --> 00:04:28.770
helps us achieve this context isolation.

97
00:04:28.770 --> 00:04:31.650
And preventing this specialized work

98
00:04:31.650 --> 00:04:34.320
from polluting the main agent's attention,

99
00:04:34.320 --> 00:04:37.350
it's going to enable parallel execution of tasks,

100
00:04:37.350 --> 00:04:40.410
and this is going to dramatically improve the quality

101
00:04:40.410 --> 00:04:43.020
and efficiency and the depth of the results

102
00:04:43.020 --> 00:04:44.790
we can get from our agent.

103
00:04:44.790 --> 00:04:49.080
And let's go back to an example, more techy with cloud code.

104
00:04:49.080 --> 00:04:50.940
And here you can see that cloud code

105
00:04:50.940 --> 00:04:54.840
has found an exploration agent,

106
00:04:54.840 --> 00:04:58.140
which is going to find us authentication patterns,

107
00:04:58.140 --> 00:05:00.180
and it's going to do some searching,

108
00:05:00.180 --> 00:05:03.870
and it's going to run while the main agent is running

109
00:05:03.870 --> 00:05:04.890
as well here.

110
00:05:04.890 --> 00:05:07.740
So the point here is that cloud code

111
00:05:07.740 --> 00:05:10.830
is implementing this kind of architecture as well,

112
00:05:10.830 --> 00:05:13.800
and he has this capability support for Sub Agents,

113
00:05:13.800 --> 00:05:16.500
which is super powerful and super useful.

114
00:05:16.500 --> 00:05:18.900
Now, a quick disclaimer over here.

115
00:05:18.900 --> 00:05:22.350
I know that by now I've been very theoretical,

116
00:05:22.350 --> 00:05:24.000
I've been waving my hands,

117
00:05:24.000 --> 00:05:26.820
and I've only been talking about concepts,

118
00:05:26.820 --> 00:05:28.680
not about implementation.

119
00:05:28.680 --> 00:05:29.760
So, don't worry,

120
00:05:29.760 --> 00:05:32.460
I promise you the implementation part will come,

121
00:05:32.460 --> 00:05:35.940
and we'll see exactly how we can go and implement

122
00:05:35.940 --> 00:05:38.550
all these kinds of beautiful magic here.

123
00:05:38.550 --> 00:05:41.670
But I just want to continue and review the concepts

124
00:05:41.670 --> 00:05:43.110
and the interface

125
00:05:43.110 --> 00:05:46.950
and how those capabilities of Deep Agents are looking

126
00:05:46.950 --> 00:05:49.680
in our day-to-day lives with the common tools

127
00:05:49.680 --> 00:05:50.910
that we use here.

128
00:05:50.910 --> 00:05:54.000
So the implementation part will come soon.

129
00:05:54.000 --> 00:05:55.440
And in the next video,

130
00:05:55.440 --> 00:05:59.160
I want to dive deeper into the context flow

131
00:05:59.160 --> 00:06:00.450
when using Sub Agents,

132
00:06:00.450 --> 00:06:03.540
and I want to show you how using Sub Agents

133
00:06:03.540 --> 00:06:07.260
is going to prevent us from bloating our context

134
00:06:07.260 --> 00:06:09.900
and achieve context isolation,

135
00:06:09.900 --> 00:06:12.063
and eventually better results.

