Triage Incidents with LangGraph¶
| Category | AI Solutions Engineering |
| Status | โ Completed |
| Repo | nextwork-triage-incidents-with-langgraph |
| Original NextWork guide | nextwork.ai |
Learning project
Practice work following a NextWork guide, separate from my production projects.
๐ NextWork learning project. This is a practice project I built while working through NextWork's Triage Incidents with LangGraph guide. It is part of my Learning portfolio and is fully separate from my production projects.
Category: Learning โบ AI Solutions Engineering
Status: โ
Completed
Overview¶
An alert fans out to three specialist agents at once using Send. Every step is checkpointed to SQLite, so if one specialist crashes, resume reruns only that one and keeps the others' findings. Each proposed fix belongs to a team, and the graph pauses at that team's interrupt() gate until it approves or rejects. When both teams have decided, a runbook is written.
Summary¶
A LangGraph CLI routes INC-2041 to logs, deploys, and metrics specialists in parallel. In the live run, each specialist is a real model (local Ollama standing in for Gemini) and their completion order varies before the findings merge. A simulated crash resumes with only the failed specialist rerunning (SQLite checkpoints), and each owning team's approval gate pauses the flow until they decide. Then the runbook is published. The secret-mission status page shows every saved incident's findings, decisions, who it's waiting on, and the runbook, straight from the checkpoint and without advancing anything.
The checks behind this are in docs/verification.txt.
Skills & tools¶
LangGraph, Multi-agent orchestration, Checkpointing (SQLite), Human-in-the-loop, Python
What I built¶
triage.py: the graph and CLI (start,resume,approve,reject,status).incidents.json: the fictional INC-2041 evidence.demo.sh: the full story (crash โ resume โ payments approves โ checkout rejects โ runbook).test_triage.py: crash/resume and approval-gate tests.SPECIALIST_MODEL=qwen2.5:3b: each specialist sends its evidence to a local model, which writes the summary and suspect as JSON. If the model fails, it falls back to the rule-based finding, and every finding records which one produced it.status_page.py(secret mission): a live, read-only web page (http://127.0.0.1:8765/, refreshes every 5 s) for every incident in the checkpoint DB. It usesget_stateonly, refuses POST, and the tests prove that rendering writes nothing to the checkpoint.docs/llm-run.txtanddocs/status-page.html: a captured live run with model-written findings and the status page snapshot taken while waiting on both teams.
How to run¶
pip install -r requirements.txt
bash demo.sh
SPECIALIST_MODEL=qwen2.5:3b python triage.py start INC-2041 # live-model specialists (Ollama on :11434)
python status_page.py # secret mission: http://127.0.0.1:8765/
Verification¶
I ran the verification command on 2026-12-02. The full output is in docs/verification.txt.
PYTHON=/workspace/nextwork-portfolio/.venv/bin/python bash demo.sh && /workspace/nextwork-portfolio/.venv/bin/python -m pytest -q -p no:cacheprovider test_triage.py
Notes¶
Model/provider substitution: the guide's starter uses Gemini on Vertex AI in Cloud Shell, which needs a billed Google Cloud project. My specialists call a local open model (qwen2.5:3b through Ollama) with the same evidence. The 3B model gets logs and deploys right but reads the metrics as a checkout problem, missing the dependency-vs-capacity point, so the router reports the suspects it was given instead of claiming agreement. The default mode stays deterministic so CI and the tests don't need a model.
Original project: https://nextwork.ai/projects/99102f24-d8e5-4201-add1-8b6e97e75030 ยท Part of my NextWork Learning portfolio (hub).
Verification output¶
From docs/verification.txt:
$ PYTHON=/workspace/nextwork-portfolio/.venv/bin/python bash demo.sh && /workspace/nextwork-portfolio/.venv/bin/python -m pytest -q -p no:cacheprovider test_triage.py
== start with the metrics specialist crashing ==
[logs] (rules) 2 payment-client timeouts and a retry storm
[deploys] (rules) payments-gateway v2.14.0 deployed at 11:58: lowered connection pool from 50 to 5
!! metrics specialist crashed (simulated). Completed work is checkpointed; run `resume`.
findings from: ['deploys', 'logs']; waiting on: nothing; next: ('specialist',)
== resume: only metrics reruns ==
[metrics] (rules) payments p99 up 17x while checkout CPU is flat: dependency, not capacity
root cause (all specialists agree: payments-gateway); 2 gated fixes proposed
findings from: ['deploys', 'logs', 'metrics']; waiting on: ['payments', 'checkout']; next: ('gate_payments', 'gate_checkout')
== payments approves ==
findings from: ['deploys', 'logs', 'metrics']; waiting on: ['checkout']; next: ('gate_checkout',)
== checkout rejects (prefers its own fix) ==
runbook published: runbooks/inc-2041.md
findings from: ['deploys', 'logs', 'metrics']; waiting on: nothing; next: ()
# Runbook INC-2041: checkout-api error rate above 5%
## Findings
- **deploys** (rules): payments-gateway v2.14.0 deployed at 11:58: lowered connection pool from 50 to 5
- **logs** (rules): 2 payment-client timeouts and a retry storm
- **metrics** (rules): payments p99 up 17x while checkout CPU is flat: dependency, not capacity
## Gated fixes
- [REJECTED] (checkout) Cap checkout retries at 2 with jitter to stop the retry storm
- [APPROVED] (payments) Roll back payments-gateway to v2.13.x (restore pool size 50)
DEMO OK
== secret mission: read-only status page from the checkpoint ==
Resolved: runbook published
.... [100%]
4 passed in 10.84s
[exit code 0]