Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Steer a running agent session
card 4 of 6
Early drift: a one-line redirect
builds on: Feedback with evidence, asked neutrally, When to stop, reset or take over, A confident summary that doesn't match the diff
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.'
Terms on this card
- context
- Everything in the model's input for the current step: your messages, instruction files, files it has read and tool outputs.
- drift
- An agent gradually moving away from the task or its instructions as a session grows: extra changes, repeated attempts, forgotten constraints.
- pytest
- The most common Python test runner; prints passing and failing tests and the failing assertions.
- --dry-run
- A common command-line flag meaning 'show what would happen without actually changing anything'.
- redirect
- Correcting the agent within the same session with a specific, evidence-backed instruction.
Lesson goal: 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. ·
the whole lesson