All courses

Interrupting and redirecting mid-task

Stop the agent as soon as it heads the wrong way and give a one-line correction. Explain why early redirection is cheaper than reviewing and undoing a long wrong run.

Builds on: Following the agent while it works

Read it card by card Start the whole course

It's heading for the wrong folder

You type: "The cart total is wrong. Fix it." The agent reads `src/cart.py`, then searches the `db/` folder and asks to edit `db/schema.sql`. You know the bug is in the discount math in `cart.py`, and the database is fine. You can see it going the wrong way. You could let it finish and sort things out afterwards, or step in right now. Which is better, and what exactly do you type?

Wrong turns compound

Each action builds on the one before it. If the agent decides early that "the database is the problem", every later read, edit and command assumes that. Stopped at step 3, it costs you seconds. Left for 30 steps, you have many edits to find, sort into wrong and right, and undo. The agent can't tell it's wrong: you know things it doesn't. One sentence from you at the right moment saves all of that.

Stop, note, correct, watch

1. **Stop it.** Many terminal agents stop on `Esc`, and editor-based agents have a Stop button. Check your tool. At an approval prompt, answering *no* also stops that action. 2. **Note what's done.** Stopping prevents future actions. It does **not** undo edits already made. 3. **Correct in one line:** what's wrong, what to do instead, and any boundary ("don't touch `db/`"). 4. **Watch the next few actions** to confirm it changed course.

Redirecting at the approval prompt

Here the approval prompt is the natural place to step in. You say *no*, then give a one-line correction that names the right place and fences off the wrong one. The next actions show it took the correction.
▸ You: The cart total is wrong. Fix it.
⚙ Read: src/cart.py
⚙ Search: "price" in db/
⚙ Read: db/schema.sql
⚙ Edit: db/schema.sql
[Approve? yes / no / always]
  no
▸ You: Wrong place. The bug is in the
  discount math in src/cart.py.
  Don't touch db/.
⚙ Read: src/cart.py
⚙ Search: "discount" in src/

When it already changed files

Same cart task, but suppose you had approvals set to *always*. You only notice after `⚙ Edit: src/utils.py` and `⚙ Edit: src/api.py` have run. You press `Esc`. Those edits are still in your files, so the correction must mention them: ▸ You: Undo your edits to `src/utils.py` and `src/api.py`. Only change the discount math in `src/cart.py`. Then watch for new edits to those two files that put the old code back. Don't let it move on until you've seen them.

Interrupt early, correct briefly

The moment the actions show a wrong turn, stop the agent and give one line: what's wrong, what to do instead, and what to leave alone. Early correction is cheap because nothing has been built on the mistake yet. Stopping doesn't undo edits already made, so name those in your correction.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.