WEBVTT

00:00:00.100 --> 00:00:02.440
Now,
I briefly mentioned it before already.

00:00:02.480 --> 00:00:06.220
When starting a new chat session,
we can also choose background or

00:00:06.420 --> 00:00:09.120
cloud agents,
and we cannot just choose it here.

00:00:09.180 --> 00:00:11.680
We can also choose it in some other
places.

00:00:11.700 --> 00:00:15.280
For example,
we could also choose from different kinds

00:00:15.780 --> 00:00:19.060
when starting implementation based on a
plan.

00:00:19.100 --> 00:00:23.080
But what are these agents about?
A background agent

00:00:23.140 --> 00:00:26.640
is like a regular agent here,
but as the name

00:00:26.720 --> 00:00:28.700
suggests, it runs in the background.

00:00:28.720 --> 00:00:32.259
It's therefore, meant for tasks
that don't need your

00:00:32.340 --> 00:00:36.260
input all the time. So,
where it's not very likely that you

00:00:36.360 --> 00:00:39.400
need to grant certain permissions,
for example.

00:00:39.460 --> 00:00:43.320
So typically, not tasks
that involve a lot of work in the

00:00:43.380 --> 00:00:47.260
command line or web requests,
unless you already allowed all these

00:00:47.280 --> 00:00:49.020
things in your workspace, of course.

00:00:49.040 --> 00:00:52.790
But if you then have a task
that can be done in the background without

00:00:52.900 --> 00:00:56.510
constant input,
you could consider using a background

00:00:56.600 --> 00:01:00.360
For example, here we could say,
for my CLI tool,

00:01:00.380 --> 00:01:04.260
-C, and then I point it at main.py,

00:01:04.300 --> 00:01:07.570
so just as a normal agent,
you provide a prompt, you provide your

00:01:07.620 --> 00:01:11.460
context. And I'll say, for my

00:01:11.480 --> 00:01:14.040
CLI tool, I need a proper

00:01:14.080 --> 00:01:17.880
documentation. Please update

00:01:18.280 --> 00:01:21.440
README and describe the

00:01:21.450 --> 00:01:25.380
tool use and all its options. So,
I want it to

00:01:25.400 --> 00:01:29.370
write some documentation for me.
It will simply need to edit one of

00:01:29.380 --> 00:01:33.100
my project files and
that won't need any special input from my

00:01:33.140 --> 00:01:36.480
side. So,
when you then have a background agent

00:01:36.520 --> 00:01:40.270
selected, by default,
at the point of time where I'm recording

00:01:40.360 --> 00:01:44.300
it has this work tree option enabled,
which means it will

00:01:44.440 --> 00:01:48.280
use the Git work tree feature to
essentially copy your project

00:01:48.620 --> 00:01:52.500
onto a different temporary place on your
system and

00:01:52.600 --> 00:01:56.390
work in it there. And then once it's done,
it will merge that work in that

00:01:56.420 --> 00:02:00.350
other project into your main project so
that you can continue working

00:02:00.380 --> 00:02:03.900
in your main project whilst this
background agent is working on the same

00:02:03.940 --> 00:02:07.910
project in a different place on your
machine so that you don't interfere.

00:02:08.000 --> 00:02:11.560
That's the idea. Now,
you can switch from work tree to work

00:02:11.600 --> 00:02:15.549
space if you want that,
and then it will still work in the

00:02:15.600 --> 00:02:19.360
work in the same project you're in,
and then, of course,

00:02:19.500 --> 00:02:23.470
also start editing those files. So,
that's why work tree is the default and

00:02:23.600 --> 00:02:27.120
typically the better option for these
background agents.

00:02:27.180 --> 00:02:31.020
So, if I now hit enter,
it will go ahead and it will

00:02:31.040 --> 00:02:34.700
start this in the background,
and we can leave this here and keep it

00:02:34.780 --> 00:02:37.280
working. We can always go back to it here.

00:02:37.340 --> 00:02:41.180
And it will do that in its own work tree,
in its

00:02:41.240 --> 00:02:44.700
own folder,
and we can keep on working on our code

00:02:44.800 --> 00:02:48.240
agents. Now, it is worth noting that
if I start a new session here

00:02:49.280 --> 00:02:51.060
and I say something like, explain

00:02:52.540 --> 00:02:56.049
main in the ask agent mode and

00:02:56.280 --> 00:03:00.200
submit this,
I can also leave this session

00:03:00.220 --> 00:03:02.010
So, that's not the main difference.

00:03:02.040 --> 00:03:05.440
This also runs in the background,
so to say, but the

00:03:05.540 --> 00:03:08.820
difference is that this background agent
is meant for tasks that

00:03:09.000 --> 00:03:12.600
are optimized for running in the
background and that it can

00:03:12.660 --> 00:03:16.460
utilize this work tree feature. Now,
as you see here, it actually

00:03:16.580 --> 00:03:20.560
does need my permission for something
and I will grant it.

00:03:20.600 --> 00:03:24.220
So, you can still grant permissions, but,
of course, you should try

00:03:24.300 --> 00:03:28.109
to let it work on tasks
that don't need your input necessarily.

00:03:29.460 --> 00:03:33.320
Whenever such a background agent is done,
you can take a

00:03:33.380 --> 00:03:37.340
look at its result and, as always,
explore that

00:03:37.620 --> 00:03:41.300
code it wrote. So, in this case,
this README.md

00:03:41.440 --> 00:03:45.410
file, and if you then click apply here,
it will

00:03:45.460 --> 00:03:49.360
apply this and merge the work from
that work

00:03:49.380 --> 00:03:53.120
tree,
so from that other project into your main

00:03:53.160 --> 00:03:56.760
here. And normally,
the apply button should then also

00:03:56.800 --> 00:04:00.500
For me, for some reason,
it's still showing up,

00:04:00.520 --> 00:04:04.360
changes here.
Another type of agent you can use with

00:04:04.560 --> 00:04:08.420
GitHub Copilot is the cloud agent,
and the idea behind the cloud

00:04:08.500 --> 00:04:12.020
agent, as the name suggests, is
that it will not work

00:04:12.040 --> 00:04:15.720
here,
neither in your project nor in some work

00:04:15.760 --> 00:04:19.560
instead in the cloud on GitHub,
and it will create a pull request once

00:04:19.620 --> 00:04:23.530
it's done. Therefore,
in order to use this cloud agent,

00:04:23.560 --> 00:04:27.479
to submit your work... Therefore,
in order to use this cloud agent, you'll

00:04:27.580 --> 00:04:31.520
have to link this Git repository to a
GitHub repository and

00:04:31.560 --> 00:04:35.430
then with your GitHub Copilot
subscription,

00:04:35.460 --> 00:04:38.460
cloud instead of on your machine.
