Join us and get access to thousands of tutorials and a community of expert Pythonistas.
This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.
Implementing the Plan
00:00
Once you have a plan you’re happy with, you’re ready to tell the agent to implement your code. Go ahead and press Tab to switch to Build mode. And now if you’re interested, you could try, for example, running /models and switching to another model for the implementation task.
00:17 For example, let’s pick Gemini 3.5 Flash and then let’s pick the default variant. And now once you’re in Build mode, if you’re happy with your model selection, you can go ahead and type something like “Implement your plan”.
00:32 When you press Enter and you tell it to build, depending on the model you pick, the provider, the variant you choose, and the level of thinking of reasoning that you have, OpenCode might show you different terms of blocks of code where it’s running intermediate steps that the agent determines will be helpful in achieving your final results. You may have to wait from a few seconds to a couple of minutes, and once the model is done, you’ll have your final output, which may look something like this.
01:09
In this instance, on your screen is going to say that it took almost 12 minutes, but that’s because there were some API issues throughout the process. Regardless, after the implementation is done, go ahead and run the command /diff that opens a diff viewer, where you can inspect the changes that were implemented.
01:30 You can use the arrow keys to navigate, scroll through the code, take a look at the changes, and if they look reasonable to you, then you should go ahead and test the application.
01:43 If you spot anything that doesn’t look right, you can prompt the model right away to fix the problems. Now once you’re happy with the diff, press Esc to quit the diff.
01:55
You’re going to run /exit, and you’re going to use uv run rpcontacts to open your application. Now you’re going to test that the buttons work.
02:07 So there’s two contacts here, you can go ahead, click Clear All, confirm, and if the contacts were deleted properly, you should be able to quit your application by pressing Q, confirming, and then running the application again, and the contacts should still be gone, naturally. Now if you press A to add a couple of test contacts, you can also check whether the Delete button is working or not.
02:34
So go ahead, let’s try adding two contacts to make sure that deleting doesn’t delete all contacts, only the one that’s selected. Highlight one of the contacts, press D, for example, confirm, and then the contact should be removed from the table. Now go ahead and press Q to quit, confirm, and run uv run rpcontacts again to double check that the change persisted.
03:02
Now if everything is alright, then that’s perfect, and if there are any issues, you can go ahead and open OpenCode again to fix the problems. For example, you might say that while it does make a lot of sense to ask whether you are sure if you want to delete all your contacts, you may think this is too much ceremony for the Delete button. So if you want to refine your changes, you can go ahead and open OpenCode by typing the command opencode, but this time using --continue, which will open your previous session to allow you to keep working. And at this point you might say something like “Tweak the button ‘delete’ so that the user doesn’t have to confirm the deletion of a single row”. And you press Enter, you give it some more time, and the model eventually produces the response.
04:03
Once the model is ready, go ahead and exit, type uv run rpcontacts, and you can try pressing D, and you can see it deleted the contact right away without the confirmation dialog.
04:17
So that should be good to go. Once you’re happy with the changes, you want to go back to your terminal, run git status to check what files were changed, and then you’ll add those files and you’ll commit them to say that you’ve implemented the Delete and Clear All buttons.
04:39 Whenever you finish implementing a feature, make sure you commit the code so you keep track of the history of your projects and all of its working versions.
04:49 When you’re happy with the state of your Python project, you can move on to the next lesson where you’ll learn about some of the unique characteristics of OpenCode.
Become a Member to join the conversation.