WEBVTT

00:00:00.140 --> 00:00:03.690
So a key part of working with agents
is crafting good

00:00:03.720 --> 00:00:07.250
prompts, and a key part of that
is adding the right context.

00:00:07.260 --> 00:00:10.740
For example,
let's say I wanna enhance my dummy CLI

00:00:10.780 --> 00:00:14.400
application here with another feature
that also allows me to

00:00:14.660 --> 00:00:18.300
generate dummy products, not just users.

00:00:18.340 --> 00:00:21.860
So we could open up a new chat session in
agent mode and

00:00:21.900 --> 00:00:23.260
say, "I want

00:00:25.280 --> 00:00:28.080
to enhance my CLI tool

00:00:29.560 --> 00:00:33.120
to also generate dummy products

00:00:33.700 --> 00:00:37.560
depending on the flags

00:00:37.620 --> 00:00:41.550
with which it was executed." I then also
provide some

00:00:41.580 --> 00:00:45.210
details on how my dummy product should
look like, because again, being

00:00:45.260 --> 00:00:48.940
specific is a good idea.
You can use plan mode, as you saw

00:00:48.960 --> 00:00:52.160
before,
and it will ask for follow-up questions,

00:00:52.220 --> 00:00:56.140
have to hope that it asks for the things
you

00:00:56.280 --> 00:01:00.140
want it to ask. If you already know,
for example, the shape of a dummy

00:01:00.180 --> 00:01:04.160
product, in this case, tell it.
You don't need to hope for the AI

00:01:04.200 --> 00:01:07.730
to guess it or to ask for it. Still,
of course,

00:01:07.820 --> 00:01:10.920
plan mode, but you wanna be as specific as

00:01:10.960 --> 00:01:14.920
possible. And as mentioned,
you wanna add the right context and

00:01:14.960 --> 00:01:18.860
maybe point at some examples.
Here I know that I already have a CLI

00:01:18.960 --> 00:01:22.680
tool that generates dummy users. Now,
as mentioned, in a

00:01:22.720 --> 00:01:26.670
simple project like this,
the chances of the AI detecting that

00:01:26.720 --> 00:01:30.500
other file are almost at 100%, but still,
I

00:01:30.620 --> 00:01:34.320
know that there is this main.py file
which has that other CLI

00:01:34.360 --> 00:01:37.880
program,
so why wouldn't I explicitly point the AI

00:01:37.920 --> 00:01:41.380
it? Now here actually,
it already added main.py as

00:01:41.420 --> 00:01:45.400
context to this prompt.
You can see the context here,

00:01:45.460 --> 00:01:49.000
because that's the editor I now have open,
and the open

00:01:49.160 --> 00:01:52.040
editor window will always be added as
context.

00:01:52.080 --> 00:01:56.030
If you select some text here, for example,
the selected code will

00:01:56.060 --> 00:01:59.040
be the context that's added.
If you don't have a selection,

00:01:59.120 --> 00:02:02.160
file. But let's say this was closed.

00:02:02.200 --> 00:02:05.780
In that case, as you can see,
there's no context here, and you can add

00:02:05.840 --> 00:02:09.400
context with the add context button,
and there's a lot of context you can

00:02:09.460 --> 00:02:13.300
add. You can add files and folders,
you could take a screenshot, you

00:02:13.360 --> 00:02:16.600
can also paste images in here,
and a lot of other

00:02:16.700 --> 00:02:19.920
things. Alternatively, you can also

00:02:21.220 --> 00:02:25.200
use the hash key and then bring up this
menu to

00:02:25.280 --> 00:02:29.160
open context from here whilst typing,
and you can enter

00:02:29.320 --> 00:02:31.360
filenames here too, like main.py.

00:02:31.400 --> 00:02:34.800
So this will now point at that file
and add it as a context here.

00:02:36.360 --> 00:02:39.960
Now again, I wanna make sure
that we also take the official

00:02:40.000 --> 00:02:43.940
account, and therefore I'll go to it here,
copy that URL, and you can

00:02:43.960 --> 00:02:47.920
add that as context too. So we could say,
"Also take a

00:02:47.980 --> 00:02:51.890
look at the official docs," and

00:02:52.000 --> 00:02:55.940
paste that link in there, and
if we wanna improve our chances of it

00:02:56.100 --> 00:03:00.000
really making that request to the docs,
you can use the fetch

00:03:00.820 --> 00:03:04.000
context tool here, and then add the link

00:03:04.020 --> 00:03:07.769
here. This gives it an extra hint
that it should fetch this

00:03:07.900 --> 00:03:11.040
page and send a request to it
and get the content.

00:03:11.049 --> 00:03:14.960
And now if I hit enter,
it'll therefore go ahead

00:03:15.000 --> 00:03:18.850
this prompt and all the context I included
in there, and that includes

00:03:18.940 --> 00:03:22.900
a request to these docs hopefully.

00:03:22.940 --> 00:03:26.540
Yeah,
it asks me if I wanna allow it sending

00:03:26.580 --> 00:03:27.930
do.

00:03:30.600 --> 00:03:34.470
I also don't wanna review the results
here, the results of that request.

00:03:34.500 --> 00:03:38.140
It should just go ahead.
Same for this request.

00:03:38.160 --> 00:03:41.940
And now based on all
that information it gathered

00:03:42.020 --> 00:03:45.100
spits out that plan it wants to implement.

00:03:45.160 --> 00:03:48.340
It also has some follow-up questions here,
and I'll provide my

00:03:48.420 --> 00:03:51.600
answers. Hit enter to get a refined

00:03:51.720 --> 00:03:52.420
plan,

00:03:54.500 --> 00:03:58.480
refine it again with another answer to
another question, and then just

00:03:58.520 --> 00:04:02.340
as before,
I'll press start implementation,

00:04:02.400 --> 00:04:06.260
this. And now it'll, just as before,
go ahead

00:04:06.360 --> 00:04:10.100
in agent mode now and edit my files
or maybe create some new

00:04:10.140 --> 00:04:12.590
files to implement this new feature.

00:04:12.620 --> 00:04:16.450
So here it now edited this main.py file
and it wants to run it with

00:04:16.480 --> 00:04:20.370
the help command to see if that works,
and I'll allow this command, and

00:04:20.399 --> 00:04:24.220
it can indeed also execute terminal
commands, as you see here.

00:04:24.260 --> 00:04:26.660
But as always,
it asks for permission first.

00:04:26.720 --> 00:04:30.090
Now it wants to run the command to
actually generate some products,

00:04:30.120 --> 00:04:33.980
of course carefully take a look at these
commands so that it doesn't do

00:04:34.060 --> 00:04:37.720
anything you don't want it to do.
But I'm fine with this command here.

00:04:37.740 --> 00:04:41.580
I can see that this works,
and you therefore see this agent is really

00:04:41.660 --> 00:04:45.500
testing its own program. And of course,
I could also in general

00:04:45.540 --> 00:04:49.350
allow all these UV commands so
that I'm not

00:04:49.400 --> 00:04:53.350
constantly asked again and again
and again for it here with

00:04:53.440 --> 00:04:57.360
that specific command line tool,
which I'm fine with when the

00:04:57.400 --> 00:05:01.340
AI uses it. So it now tested it, it
was able to

00:05:01.420 --> 00:05:05.180
see that terminal output,
that's another feature this agent mode

00:05:05.240 --> 00:05:08.640
has, and with that, it wrote the code
and on its own

00:05:08.700 --> 00:05:11.160
validated that it works correctly.

00:05:11.200 --> 00:05:15.080
Of course,
you still should also review the code on

00:05:15.120 --> 00:05:18.830
own, take a look at it, and see
if it's in line with your expectations and

00:05:18.900 --> 00:05:22.500
requirements before you then accept
or deny it.

00:05:22.540 --> 00:05:25.990
You can, of course, by the way,
also ask for follow-up edits or

00:05:26.040 --> 00:05:29.180
improvements. It's not just accept
or decline.

00:05:29.220 --> 00:05:33.140
You can also ask for improvements,
but here I'm fine with it

00:05:33.180 --> 00:05:35.160
it.
