Get an agent back on track
An AI agent might misunderstand the goal, repeat an unsuccessful action, change more files than expected, or lose track of an earlier decision. Intervene as soon as you recognize a mismatch. Early corrections preserve useful work and reduce the number of changes you need to review or undo.
This guide helps you choose the least disruptive recovery action. You learn how to redirect a running request, correct completed work, recover unwanted changes, reset conversation context, and diagnose repeated failures.
Choose a recovery action
Start with the symptom you observe:
| Symptom | Recovery action |
|---|---|
| The agent appears idle or blocked. | Check the current state for a pending question, approval request, or running terminal command. |
| The agent is still running, and the current approach is safe but incorrect. | Steer the request with a focused correction. |
| The agent is about to perform an unsafe, destructive, or irrelevant action. | Stop the request immediately and state what it must not do. |
| The response is complete, and most of the work is useful. | Send a focused follow-up that identifies the specific mismatch. |
| An ambiguous earlier prompt caused the agent to take the wrong approach. | Edit the earlier request and resend it. |
| File changes after a known point are unwanted. | Restore a checkpoint. |
| You want to compare another approach without losing the current conversation. | Fork the conversation. |
| The conversation contains too much irrelevant or conflicting context. | Compact the context or start a new session. |
| The agent follows your instructions but repeatedly encounters the same error. | Diagnose the failure before it retries. |
If the agent is about to run a destructive command, deploy a change, expose sensitive information, or modify an external service, stop the request before you investigate further.
Assess the current state
Before you ask the agent to continue, identify what happened and what you want to preserve:
- Check whether the agent is waiting for an answer or approval, or is tracking a terminal command that is still running.
- Find the earliest point where the agent's work diverged from your intent.
- Review the changed files, recent tool calls, terminal output, and error messages.
- Separate correct work from changes that need revision or removal.
- Check whether completed actions affected only workspace files or also affected the terminal, network, deployments, or external services.
- Write down the expected result, constraints, and validation that the agent missed.
Use these facts in your correction. Avoid prompts such as "try again" or "fix it," which don't tell the agent what needs to change.
Redirect a running request
While a request is running, type your correction in the chat input box. The Send button menu becomes available after you type a message. Open the menu and choose how the new message should affect the current request:
-
Select Steer with Message when the current actions are safe, but the agent needs a different approach. The agent finishes the active tool call, stops the current response, and processes your correction.
-
Select Stop and Send when the agent should not continue the current request. VS Code cancels the request and sends your new message immediately.
For example, steer an agent before it makes more edits: