Alert Triage (local)
The alert-triage
example is the capstone (L5) of the getting-started
golden example. It is a Temporal-driven incident-triage app: an alert comes in,
a phased workflow classifies it, gathers context, proposes a remediation, pauses
for human approval when the change is risky, applies it (a clearly-stubbed step),
then notifies. chant synthesizes the
Kubernetes manifests; the triage workflow itself is hand-written Temporal — the
“Raw Temporal + chant” split.
This tutorial runs the whole thing locally with no cloud and no cluster — just a Temporal dev server.
Prerequisites
Section titled “Prerequisites”- Node.js and
npm. - The Temporal CLI (
temporal) for the dev server.
Run it
Section titled “Run it”cd examples/alert-triagenpm installnpm run devnpm run dev starts a Temporal dev server, the triage worker, and the webhook
receiver, then sends one demo alert. Open the Temporal UI at
http://localhost:8233 — you’ll see an alertTriage workflow. The demo alert
is high-severity, so it’s risky and pauses at the approval gate.
Approve it:
temporal workflow signal -n default \ --query "WorkflowType='alertTriage'" --name approve-remediationThe workflow completes, and the worker logs the outcome (… — applied after approval). A low-severity alert skips the gate and applies directly.
Two event sources
Section titled “Two event sources”Both feed the same triage workflow:
npm run alert # external alert via the webhook (POST /alert)npm run drift -- --demo # a drift event (the WatchOp/lifecycle counterpart)The webhook is the receiver the WebApp manifest deploys. The drift source runs
chant lifecycle plan --json and triages each drifted resource — out-of-band
cluster changes go through the same triage as external alerts. --demo injects a
sample drift so you can see the pipeline without making a real change.
The agent (optional)
Section titled “The agent (optional)”proposeRemediation is a deterministic stub by default — no key, runs offline.
Set ANTHROPIC_API_KEY (and npm i @anthropic-ai/sdk) to have it call Claude;
override the model with ANTHROPIC_MODEL (default claude-sonnet-4-6). The first
run shows chant, not an LLM.
Deploy the manifests
Section titled “Deploy the manifests”The app’s Kubernetes surface is typed chant in src/:
npm run build # → k8s.yaml (plain Kubernetes)npm run lintkubectl apply -f k8s.yaml # e.g. to a local k3d clusterHow it fits together
Section titled “How it fits together”| Piece | What it is |
|---|---|
src/ | chant manifests — webhook (WebApp) and worker (WorkerPool) |
activities/triage.ts | the triage activities (the agent — stub + Claude opt-in) |
activities/workflow.ts | the Temporal workflow (classify → context → propose → gate → apply → notify) |
activities/worker.ts | the worker that registers them |
app/ | the event sources (webhook, drift) and the demo alert |
A time-skipping test (activities/workflow.test.ts) covers the gate behaviour in
CI. See the example README
for the full layout.