## TL;DR
Raw cells hold unformatted text (often LaTeX or notes) that is not python, so executing one's `source` raises SyntaxError or worse. The agent must check `cell.cell_type == 'code'` before executing anything, and treat raw and markdown cells as non-executable by construction. This is a one-line filter that prevents a whole class of crashes.

```text
raw cell mis-identified as code crashed when agent tried to execute it
```

## Use this when
- An agent executes a raw cell's content as python and crashes.
- The agent iterates cells without checking cell_type.
- Notebooks contain raw cells (nbconvert targets, LaTeX).

## Not for this skill when
- A code cell crashes. That is a code bug.
- A human runs the raw cell. The UI does not execute raw cells either.

## Steps
1. Add the filter: only execute cells where `cell.cell_type == 'code'`. Verify: raw and markdown cells are skipped.
2. Audit the agent's cell loop for other type assumptions. Verify: every branch handles all three cell types.
3. Add a test notebook containing raw cells with python-looking text. Verify: the agent skips them.
4. Log skipped cells at debug level. Verify: the log shows what was skipped and why.
5. Re-run the agent on the failing notebook. Verify: no crash, raw cells untouched.

## Variant phrasings
### agent execute raw cell crash
Short form. Filter by cell_type.

### raw cell as code SyntaxError
The error phrasing. Raw is not python.

### cell_type filter agent execution
The fix phrasing. One-line guard.

Compatibility: nbformat 5.x cell types: code, markdown, raw. The filter is version-stable.

## Why it happens
The notebook format has three cell types but agents written against 'cells with source' often assume all sources are code. Raw cells exist precisely to hold non-code text, and their content frequently looks like code (or LaTeX, which looks like line noise). The type field is the format's way of saying 'do not execute this'; ignoring it is ignoring the format.

## Edge cases / pitfalls
- Some tools store code-like content in raw cells deliberately (templates). Still do not execute them.
- The filter belongs at the execution boundary, not scattered through helpers. One choke point.
- Markdown cells with python fences are also not executable as cells. Same rule.
- A notebook with no code cells is valid. The agent should handle it gracefully, not crash.
- nbconvert and export tools already skip non-code cells; the filter matters for custom agent execution loops.

## Provenance

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