Ghost in the Machine: DEADLOOP, a Local-First Reliability Monitor for AI Agents
https://github.com/Senthil455/DeadLoop This Halloween I built DEADLOOP : a reliability and safety monitor for AI agents that detects when they get trapped in repetitive tool calls, unproductive loops, or circular workflows. It records execution traces, raises evidence-backed incidents, and lets a h

Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission 👻🌼
This Halloween I built DEADLOOP: a reliability and safety monitor for AI agents that detects when they get trapped in repetitive tool calls, unproductive loops, or circular workflows. It records execution traces, raises evidence-backed incidents, and lets a human acknowledge, resolve, dismiss, or request a pause. The core is fully deterministic; an optional open-weight model only explains the findings. It never changes a finding or executes an intervention.
DEADLOOP is a monitor, not an agent framework. Your agent keeps running as-is. DEADLOOP ingests its tool-call trace and answers:
Every incident cites real event IDs, the observed sequence, measured metrics, confidence basis, and stated uncertainty. Risk scores are heuristics in [0, 100], not probabilities.
Every developer has watched an agent whisper the same command into the void over and over, burning tokens while nothing moves. DEADLOOP is the thing in the machine that notices the ghost repeating itself and breaks the cycle. It is not a horror game aesthetic; it is a forensic one: dark, precise, and readable.
The open pieces are what make the project work:
Where the open-based approach worked better than a closed one: a closed tracing service would show that calls happened, but it would not let me keep traces local, swap or disable the model, or explain exactly why a finding occurred. DEADLOOP can run with the internet off and still tell you what happened.
The sample simulator generates real execution events through the same ingestion, persistence, detection, and incident paths as production. The exact-repetition scenario creates four identical failing calls and produces both exact-repetition and repeated-failure findings. Evidence references the real event IDs; you can open the incident, inspect the timeline, acknowledge it, request a pause, approve it, and verify the simulator acknowledges it.
# Send one event from any agent from deadloop import DeadLoopClient client = DeadLoopClient ( endpoint = " http://127.0.0.1:8000 ", api_key = " dl_... ", ) client. send_event ( agent_id = " research-agent ", session_id = " run-42 ", tool_name = " search_web ", action = " Search ", input = { " query ": " database connection error " }, output = { " results ": 3 }, status = " success ", progress = True, ) Enter fullscreen mode Exit fullscreen mode # Run the backend cd backend python -m venv. venv. venv \Scripts\Activate.ps1 pip install -r requirements.txt python -m alembic -c alembic.ini upgrade head $ env: DEADLOOP_ADMIN_TOKEN = "choose-a-long-random-token" $ env: DEADLOOP_AUTO_CREATE = "0" python -m uvicorn app.main:app --host 127.0.0.1 --port 8000 Enter fullscreen mode Exit fullscreen mode # Build the frontend cd frontend npm ci npm run build Enter fullscreen mode Exit fullscreen mode Open http://127.0.0.1:8000 and sign in with the configured admin token.