What a Coding Agent Does
So far, the AI has answered you, and you've done the rest: you copied its code into the editor, clicked Run and read the console. A coding agent does the rest too. You give it a task, and it works on the files of your project in steps: it reads them, changes them, runs commands, such as the one that runs your program, reads what they print and decides on the next step, until the task is done or it needs you. There are coding agents in code editors and in AI apps, and some you start by typing a command.
That's why an agent needs more care than a chat. An answer is only text: its code gets into your program when you paste it, after you've read it. An agent's change is in your file before you've read it, and a command it runs does whatever it does, on your computer. And whatever your task doesn't say, the agent decides by itself: asked for a discount, it may also tidy up a function that worked.
So set its limits. Most coding agents can ask you before they change a file or run a command, and you choose what they may do without asking. While you're learning, let it ask before both: then you see every change before it's saved and every command before it runs. And let it work on a copy of your project, not on the only one you have.
The AI in this course's chat isn't an agent: it can't change script.py or click Run. But it can write the plan an agent would follow, and agents often show their plan before they start, which is the best moment to check it. If you have a coding agent yourself, try it on a copy of one of your programs with a small task, and watch its steps.
The program in the editor adds up the prices of Mia's walks this week. Mia is thinking of making her week's discount easier to get: £5 off a week of more than three walks, instead of five or more. The message in the chat box asks for that, as you might ask an agent.
Instructions
- 1
Attach
script.pyand send the message as it is: the AI here can't change your file or run it, so it answers with code. Then ask in the same chat for the plan a coding agent would follow for this task, as numbered steps. Say that an agent can change the file and run the program itself. - 2
As the plan stands, the agent saves its change and runs commands without you. Ask in the same chat to change the plan: before the agent saves a change to
script.py, it shows you the change and waits for your yes, and it asks you before it runs any command, such as the one that runs the program.