Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Building With an Agent & Resolving a Merge Conflict

00:00 Okay, so I’ve used two different models to build two different plans and then took the architectural decision of which of the plans I want to use. I could also go in here and change the plan directly before submitting it, but I’m pretty happy with this outline that Sonnet provided for me, and now I can go ahead and build this plan.

00:17 So this essentially switches me away from the Plan mode into the Agent mode where the agent is then going to actually create the files and implement the plan that it created beforehand.

00:28 For now, if you switch over to the Editor view, you’ll see that you don’t have any files in here yet because the agent didn’t do anything yet. You were just in plan mode.

00:35 But now once I go ahead and click on “build” for this plan, then those files are going to start popping up.

00:42 I can do this here, either in the agent view or also let’s stick with the editor. You can see the chat also carried over here, but I need to make sure that I’m looking at the right one.

00:51 Yeah, those are the six TODOs on the Sonnet. All right, so here’s the GPT-5 Codex one. This is the one that I decided not to follow, and then here’s the Sonnet plan that I like, and I’m going to build it with the Composer model.

01:03 So this is the model that the Cursor company built or trained, and it’s very fast and generally gives quite good results. So now I’m switching over to a different model than the one that I used to create the plan.

01:16 But that’s fine because the agent is just going to get the whole history and continue running with it and has all the context that it needs to build out the plan.

01:25 Sometimes it can make sense to choose the model that you want to use based on price, availability and also what they are specifically good at.

01:34 So I click on build here. You can see that this down here changed to Agent mode,

01:41 and now Composer 1 is creating this project for me. So you will see in the Editor tab, and now it’s just starting by initializing the project.

01:51 Let’s switch over to Agent so that we can have a bigger view on what’s happening.

01:58 I don’t really need that plan right now,

02:02 but I want to follow what the agent does. Well, I’m not fast enough to actually follow what the agent does, but I can scroll around a bit and see how it’s creating different files.

02:13 So it’s implementing the CRUD operations at the moment, and in the editor you can also check up on those. I should see those files coming up.

02:23 All right, these files aren’t showing up here because my agent’s actually working on a different Git branch, so I will still first need to merge into main before I will see the files pop up here.

02:42 I created the files. I’m going to say Apply All

02:45 Oh, and now I get a merge conflict. That’s actually interesting because we don’t have any Git commits on this repo yet, so this is likely happening because of some internal version control mechanism that Cursor implements when it goes off doing changes on separate branches.

03:03 But anyways, resolving something like this works the same as when you run into a Git merge conflict. So it’s a good example to show how version control workflow can and should be part of developing with AI-assisted code generation.

03:16 Let’s go ahead and look at this likely Cursor internal merge conflict and resolve it.

03:23 What are the issues that we’re getting… Here you see that you got a bunch of new files, these were created in this agent run. But back to the merge conflict: Let’s inspect.

03:34 It looks like Cursor created an empty pyproject.toml file somewhere along the way, and the background agent that executed the plan created another one with project-specific content.

03:47 Having your project under version control gives you more insight and control into the code changes that you or the AI agents implement. If you’re familiar with Git, then you’ll know how to resolve a merge conflict like this.

04:01 Okay, so I do want to have all that information, so I will just resolve that merge conflict and say, yes, I want a proper pyproject.toml file with the description and all the dependencies I need.

04:13 And with that, I’ve resolved the merge conflict and we should be able to continue. Viewing merge conflicts right inside of the editor is a nice feature that’s not specific to Cursor, but it also works here.

04:25 A good next step is going to be to also commit these changes to have a state of the project that works and that you can continue with. But before doing that, I want to go ahead and test whether the code actually works and maybe go ahead and review a couple of files to see whether it works in a way that I wanted it to work.

04:43 Let’s do that in the next lesson.

Become a Member to join the conversation.