## TL;DR
When the agent's run diverges from the interactive run, the two runs were not actually the same: different kernel environments, different execution order, or different starting state. Diff the three: compare `pip freeze` between the agent's kernel and yours, confirm the agent ran strictly top to bottom on a fresh kernel, and check for external state (files, env vars, randomness without seeds). Fix the divergence, not the symptom.

```text
agent's notebook run crashed with different results than the interactive run, execution failed
```

## Use this when
- The agent's run and the human's run of the same notebook disagree.
- The agent crashes where the human succeeds.
- The notebook works 'on my machine' but not in automation.

## Not for this skill when
- Both runs fail identically. That is a notebook bug, plain and simple.
- The runs agree. There is no problem to diagnose.

## Steps
1. Diff the environments: `pip freeze` from the agent's kernel vs yours. Verify: you see the version skew.
2. Confirm the agent's execution: fresh kernel, strict top-to-bottom, no skips. Verify: execution counts prove it.
3. Check external state: files, env vars, database contents, random seeds. Verify: both runs saw the same inputs.
4. Fix the divergence (align envs, fix order deps, seed randomness). Verify: the runs now agree.
5. Lock it in: the agent records its env and inputs per run. Verify: the next divergence is diagnosable from the log.

## Variant phrasings
### agent run differs from interactive
Short form. Diff env, order, state.

### notebook works manually fails automated
The classic phrasing. The runs were never identical.

### agent execution different results
General phrasing. Fix the divergence.

Compatibility: Any agent runner vs interactive Jupyter. The diff discipline is universal.

## Why it happens
'Same notebook' is doing a lot of work in that sentence: the interactive run had your kernel env, your execution order, your files, and your warmed-up state. The agent's run has its own of each. Divergence means one of those differed, and guessing which one wastes hours. The three-way diff (env, order, state) finds it in minutes.

## Edge cases / pitfalls
- Unseeded randomness makes runs differ spuriously. Seed everything before diffing.
- Timestamps and 'today' in code make runs differ by design. Freeze or parameterize them.
- The agent's kernel may resolve packages differently (user site, extra paths). Compare sys.path too, not just pip freeze.
- Fixing the symptom (tweaking the agent's run) without fixing the notebook leaves the next human hitting the same wall.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_ueLTRSi_ZfoUyQbIwTx4Kw
