Now, I briefly mentioned it before already.
When starting a new chat session, we can also choose background or
cloud agents, and we cannot just choose it here.
We can also choose it in some other places.
For example, we could also choose from different kinds
when starting implementation based on a plan.
But what are these agents about? A background agent
is like a regular agent here, but as the name
suggests, it runs in the background.
It's therefore, meant for tasks that don't need your
input all the time. So, where it's not very likely that you
need to grant certain permissions, for example.
So typically, not tasks that involve a lot of work in the
command line or web requests, unless you already allowed all these
things in your workspace, of course.
But if you then have a task that can be done in the background without
constant input, you could consider using a background
For example, here we could say, for my CLI tool,
-C, and then I point it at main.py,
so just as a normal agent, you provide a prompt, you provide your
context. And I'll say, for my
CLI tool, I need a proper
documentation. Please update
README and describe the
tool use and all its options. So, I want it to
write some documentation for me. It will simply need to edit one of
my project files and that won't need any special input from my
side. So, when you then have a background agent
selected, by default, at the point of time where I'm recording
it has this work tree option enabled, which means it will
use the Git work tree feature to essentially copy your project
onto a different temporary place on your system and
work in it there. And then once it's done, it will merge that work in that
other project into your main project so that you can continue working
in your main project whilst this background agent is working on the same
project in a different place on your machine so that you don't interfere.
That's the idea. Now, you can switch from work tree to work
space if you want that, and then it will still work in the
work in the same project you're in, and then, of course,
also start editing those files. So, that's why work tree is the default and
typically the better option for these background agents.
So, if I now hit enter, it will go ahead and it will
start this in the background, and we can leave this here and keep it
working. We can always go back to it here.
And it will do that in its own work tree, in its
own folder, and we can keep on working on our code
agents. Now, it is worth noting that if I start a new session here
and I say something like, explain
main in the ask agent mode and
submit this, I can also leave this session
So, that's not the main difference.
This also runs in the background, so to say, but the
difference is that this background agent is meant for tasks that
are optimized for running in the background and that it can
utilize this work tree feature. Now, as you see here, it actually
does need my permission for something and I will grant it.
So, you can still grant permissions, but, of course, you should try
to let it work on tasks that don't need your input necessarily.
Whenever such a background agent is done, you can take a
look at its result and, as always, explore that
code it wrote. So, in this case, this README.md
file, and if you then click apply here, it will
apply this and merge the work from that work
tree, so from that other project into your main
here. And normally, the apply button should then also
For me, for some reason, it's still showing up,
changes here. Another type of agent you can use with
GitHub Copilot is the cloud agent, and the idea behind the cloud
agent, as the name suggests, is that it will not work
here, neither in your project nor in some work
instead in the cloud on GitHub, and it will create a pull request once
it's done. Therefore, in order to use this cloud agent,
to submit your work... Therefore, in order to use this cloud agent, you'll
have to link this Git repository to a GitHub repository and
then with your GitHub Copilot subscription,
cloud instead of on your machine.