All courses

Steer a running agent session

While an agent works, give evidence-based and neutral feedback, check its claims against tool output, notice drift or looping early, and decide whether to redirect, reset with a fresh session or take over yourself.

Builds on: Feedback with evidence, asked neutrally, When to stop, reset or take over, A confident summary that doesn't match the diff

Read it card by card Start the whole course

Third attempt, same fix, no test run

You asked the agent to fix a failing Go test, `TestGetUser`. Attempt 1 added a nil check. Attempt 2 removed it and edited the test file. Attempt 3 adds the nil check back and says: *'Fixed the lookup, tests should pass now.'* The last `go test` in the transcript ran before attempt 2. You are watching. Do you type 'still failing', let it carry on, or do something else?

Your messages are its main steering input

Each turn, the agent acts on its context: your messages, the files it read and its tool outputs. Its claims are generated text. Only command output shows what actually happened. Vague feedback leaves it guessing, and a leading hint gets agreed with. Every failed attempt also stays in context, so long sessions drift toward repeats and lost instructions. If you steer early with evidence, the session stays cheap. If you steer late, you end up untangling a pile of half-fixes.

At each checkpoint: check, feed, watch, decide

1. **Check**: every claim ('passes', 'fixed') needs matching tool output in the transcript. If there is none, ask it to run the exact command. 2. **Feed**: paste exact errors, and neutrally ask for a diagnosis before a fix. 3. **Watch** for these tells: a repeated fix, a diff growing past the task (unreviewed changes ship with it), suppressions (the warned-about bug ships silenced), self-contradiction or a forgotten instruction. 4. **Decide**: one misstep in a clean context → redirect. A loop, a contradiction or a diff far past the task → revert and start a fresh session. A small fix you already see → take over.

Early drift: a one-line redirect

Python task: add a `--dry-run` flag to `export.py`. Two turns in, the agent writes: *'Also refactored `config.py` for clarity. Tests pass.'* No `pytest` run appears after its edits. The later cost: an unrequested refactor can change behaviour other code relies on, unreviewed. Still, this is one drift and one unbacked claim, and the context is short, so redirect rather than reset. BAD: 'Looks good, but are you sure about config?' BETTER: 'Revert `config.py`; only the flag is in scope. Then run `pytest tests/test_export.py` and paste the output.'

Reset case: the output contradicts the claim

Back to the Go session: you make the agent run the test. It is red with the same failure as attempt 1, despite 'should pass now'. `git diff --stat` shows four changed files for a one-function bug, including `main.go` and the test itself. Editing a test can turn it green without fixing the code, so the bug would ship behind a passing test. A repeated fix, a growing diff and an edited test mean the context is polluted. Revert to the clean commit and start a fresh session with: the exact failure, 'a nil check does not fix it' and 'do not edit the test'.
// Go
$ go test ./store/ -run TestGetUser
--- FAIL: TestGetUser (0.00s)
    user_test.go:41: got "", want "ann"
FAIL
FAIL	example.com/app/store	0.01s
$ git diff --stat
 store/user.go      | 14 ++++++++------
 store/cache.go     | 22 ++++++++++++++++------
 store/user_test.go |  9 +++++----
 cmd/server/main.go |  6 +++++-
 4 files changed, 34 insertions(+), 17 deletions(-)

Steer with evidence, decide early

Back every claim with tool output, and make every correction carry the exact error and a neutral question. Redirect a single early slip. Revert and start a fresh session when the agent loops, contradicts itself or the diff balloons. Take over when you already see the small fix.

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.