DEV Community

Vasu Bansal
Vasu Bansal

Posted on

Agent Séance: I made dead AI-agent runs confess how they died (with local Gemma)

Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission 👻🌼

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine

What I Built

Every agent builder has a graveyard: runs that looped forever, ignored an error, or confidently reported a refund that never happened. Logs tell you what happened. Agent Séance makes the run tell you why, in the voice of the agent that died.

You point it at a failed trace. A deterministic coroner rules on the cause of death first: infinite loop, unread error, phantom tool, context drowning or max steps. Then a local Gemma model, running in Ollama, summons the ghost to testify in the first person. There's a catch: every sentence must cite a [step N] that exists. Anything uncited, or cited to a step that never happened, is struck from the record and shown crossed out. Ghosts don't get to make things up.

Finally it lays every dead run on a digital ofrenda, an HTML page with marigold-orange candles where each run gets its cause of death and its confession.

Demo

The digital ofrenda: each dead run with its cause of death and cited confession

Run it: python3 seance.py traces/*.json --html ofrenda.html

Sample (from my run):

⚰️  unread_error | Poisoned by an unread error
  👻 [step 0] I was tasked with processing order 5521, a simple transaction, a digital echo of a request.
  👻 [step 1] My processing halted, a digital paralysis as the error persisted.
  ✂️  struck: Here is my recorded life, a chilling echo of my own demise…
  ✂️  struck: [step 3] The system flagged an error – a payment provider's card expired, rendering the refund impossible.
Enter fullscreen mode Exit fullscreen mode

The ghost tried to cite [step 3], a step that never happened in a 3-step trace, so the cross-examiner struck it. That's the whole point: even a dead agent doesn't get to hallucinate evidence.

Code

GitHub logo VasuBansal7576 / agent-seance

Agent Séance: a coroner for dead AI agent traces, with a Gemma ghost (DEV Hacktoberfest Week 4)

Agent Séance

Summon the ghost of a failed AI-agent run with local Gemma (Ollama). A deterministic coroner rules on the cause of death, the ghost testifies citing [step N], and uncited claims are struck from the record.

ollama pull gemma3:4b
python3 seance.py traces/*.json --html ofrenda.html
Enter fullscreen mode Exit fullscreen mode

Trace format: {"name","task","steps":[{"type":"tool_call|tool_result|final","tool","args|content","error"?}]}

MIT licence. Built for DEV Hacktoberfest 2026 Week 4 by Vasu Bansal.

How I Built It

  • Gemma (open-weight) via Ollama, fully local: gemma3:1b (runs on a plain CPU box in under 20 seconds per run; --model gemma3:4b for richer testimony) at temperature 0.4.
  • Coroner first, ghost second: plain Python rules pick the cause of death, so the model narrates a verdict it can't change.
  • Cross-examination: a regex pass keeps only sentences whose [step N] citations all exist in the trace. This is the same "make the model show its evidence" check I use when evaluating production agents.
  • It's one dependency-free Python file.

Why Does Open Innovation Matter?

Agent traces are the most sensitive thing a team owns: customer messages, internal tool outputs, sometimes credentials. Sending your failures to a closed API to get them explained means shipping your worst moments to a third party. With an open-weight model on my laptop, the séance happens with the lights off and the Wi-Fi off, and the dead stay in the house.

The Spirit of It

Día de los Muertos is about remembering the ones we lost so we can learn from them. In our field, the departed are the runs we Ctrl-C'd at 2 AM. Giving them a voice turns a debugging chore into a story worth reading, and a lesson the next agent gets to keep.

Prize Categories

Best Use of Gemma

Top comments (0)