How to Setup Background Agents
How to Setup Background Agents
Hey, welcome to this lesson. I'm going to show you now how to set up background tasks. We have already some tasks started. You can see them here, or you can also hit Command, Shift and P for create new background agent. And you can see that these background agents are already working. But now we are looking how we can use them. To enable background agents, just go to the settings and be sure that under general, data sharing enabled. Either you choose your shared data, so you improve scores of everyone, you share your telemetry data. Or you enable privacy mode with storage. No training code stored for background agent and other feature. If you have enabled privacy mode, you can't use background agent. One of these two options enables you to work with background agent. Okay? And by the way, if you don't see this drop-down there, this is a little bug. You just need to hit Command and minus or Command and plus to resize the view. Or you can also do it here with the zoom options. And then you need to go to background agent. First, obviously you need to enable background agents. Since background agents are tightly integrated with GitHub, you get a separate branch and you also get a PR if you want. That means you absolutely need to connect GitHub to work with background agents. I've already done it, so I have here the manage button, but you can click on it. And by the way, you can also enable background agents in your dashboard under cursor.com/dashboard under background agent. And you can also manage them here. And here, the Slack option, which we do in another lesson. Okay, then it asks to install Cursor in your organizations on GitHub or just on your private, then you need to configure it. I'm going to configure it now in Instructa Pro, and then you can decide if the background agents are allowed to read all repositories in this organization or just selected repositories. I'm going to choose select, and then I'm going to search for the macro app under Instructa Pro, macro calculator, and then I'm going to click installing and authorizing and use passkey. Then I'm going to log in. This is a usual error we get, but most of the time it's still connected. You can just try it again. Let's try it again. Then you can already see it's configured. But let's do a double-check. Then you have here only selected repositories, and you can see that we have access now. This is … I don't know if it's a bug or it can't be solved in this way, but if we do it again, it should work. This is almost all we need to do to set up our background agent. We have some more options here. You can click through it. So first we can also create an environment json if we have some different environments. Uh, this is more advanced stuff here. It's interesting that it tells us that usage-based pricing is required to run background agent because within the Pro plan, it tells us that you get access to background agents. And when you go to the dashboard, to the Cursor dashboard, it's within the Pro limit. So if you use background, it will take requests of your Pro limits and it works until you hit read limits. But it seems that you have to enable here usage-based pricing that it works. Maybe it will change sooner or later, but for now, I've enabled usage-based pricing and it works as expected. Okay, then we have GitHub access, which is verified. This is working. Since we have cloned this data kit from GitHub, so the original one was not Instructa Pro, it was under instructor repositories, and we cloned here this data min. That means if you clone here this repository, then be sure that you change the remote URL. Okay, this is fine. Then base environment, configure tools and runtimes for the agents mesh. Here you can define your own Dockerfile or you can also set up your machine to use a custom Dockerfile. This is again, more advanced stuff, which we won't cover now. And then we have a runtime configuration. This is important because if we use, for example, Bun or, I don't know, Yarn, then we need to configure this here. Or maybe if we want to start a dev server not with npm run dev, for example, just with npm run start, then we need to define this here in the runtime configuration. And we can also add here more default terminal commands. And then we have secrets. If you have already worked with Vercel in deployments, or for example, with OpenAI Codex, you need to add your secrets here. For example, if you work with databases or with some API keys like OpenAI or Anthropic keys, then you need to place here your secrets because the container we have talked about before is isolated from your current workspace. That means it has its own environment variables, its own general, its own environment, and you need to fill everything in, which you have also on your local. The same if you do deployments on Vercel, Netlify or AWS or on Cloudflare; it doesn't matter. You need to add there all your environment variables and secrets. Okay, but since we're working just on a landing page and a simple app, we don't need any secrets for now. This would make sense if we add some AI logic to our macro calculator or if we add some chart, then we could add here the API keys. Okay, that's all for configuration … and now you can run your own background tasks. And to run background tasks, you can start it here on the bottom left. You can start it here with the cloud with Command and E, or with Command Shift and P, background agent. Here create new background agent. That's it for the lesson. In this lesson we have learned how to set up our background agents, and that means we need to be sure that data sharing is enabled. You can configure them on the background agents in settings. Be sure that they are enabled. Connect your GitHub repositories, and check all settings here. If you're doing some advanced stuff, you can define your own environment json file, like here. And if you need more information, then go to the docs under background agent, and you can read through here that they fit to your environment. Thank you and see you in the next lesson
Full Course Access
$199
$99
- Unlimited access to all course modules
- Get access to all course updates
- Unlimited access to Guides & Prompts
- Access to the private Discord community