cd /news/ai-agents/nights-watch-a-runtime-resilience-la… · home topics ai-agents article
[ARTICLE · art-74411] src=promptcube3.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Nights Watch: A Runtime Resilience Layer for AI Agents

A developer has built Nights Watch, a runtime resilience layer for AI agents that uses a local SQLite checkpoint manager for rollbacks and SigNoz for decision support, ensuring the system degrades gracefully if SigNoz is unreachable. The architecture treats OpenTelemetry as a load-bearing component by implementing correlated tracing, mid-run context queries, and dynamic explanations via MCP to enable real-time intervention during agent execution.

read2 min views1 publishedJul 26, 2026
Nights Watch: A Runtime Resilience Layer for AI Agents
Image: Promptcube3 (auto-discovered)

The Architecture of Resilience #

The core philosophy here is that the safety net cannot be a point of failure. If your resilience system depends on an external API to perform a rollback, you've just added another way for the system to break.

I structured the deployment using a strict split:

Local Critical Path (SQLite): I used Node'snode:sqlite

for a Checkpoint Manager. Every agent step—including the plan, budget consumed, and completed actions—is written as a durable checkpoint to disk. Rollbacks pull from here exclusively.Decision Support (SigNoz): I integrated SigNoz for context and explanation. The Policy Engine queries the SigNoz Query API for prior-run context to score severity, and the Explanation Layer uses the SigNozMCPserver to ground natural-language explanations in actual trace data. If SigNoz is unreachable, the system degrades gracefully rather than crashing.

Turning Observability into Action #

Most people treat OpenTelemetry as a post-mortem tool, but for a real-world AI workflow, it needs to be load-bearing. I implemented this in three ways:

1. Correlated Tracing

Instead of simple logs, every meaningful event is a child span under a parent run.execute

span. This ensures a complete audit trail of the agent's logic.

const SpanNames = {
 RUN_EXECUTE: "run.execute",
 EXECUTOR_STEP: "executor.step",
 CHECKPOINT_CREATED: "checkpoint.created",
 POLICY_EVALUATION: "policy.evaluation",
 POLICY_EXPLANATION: "policy.explanation",
 CHECKPOINT_RESTORED: "checkpoint.restored",
} as const;

2. Mid-run Context Queries

The Policy Engine doesn't judge steps in isolation. It queries SigNoz during the run to see if previous scores have already crossed a threshold, escalating the severity if the agent is repeatedly failing.

if (prior.queried && prior.previousScores.some((s) => s >= config.Threshold)) {
 // escalate — this isn't the agent's first warning this run
}

3. Dynamic Explanations via MCP

When a policy violation occurs, the system performs a JSON-RPC tools/call

to signoz_search_traces

. This replaces canned error messages with actual data from the trace.

[signoz-mcp] INVOKING tools/call signoz_search_traces run=run-872ac2d2 endpoint=http://localhost:8000/mcp

By shifting from "monitoring after the fact" to "intervening during execution," we can actually deploy LLM agents in production without worrying about them quietly spending the entire budget on the wrong task.

Next Agents-Concerto: Orchestrating Claude Code for PRs →

── more in #ai-agents 4 stories · sorted by recency
── more on @nights watch 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/nights-watch-a-runti…] indexed:0 read:2min 2026-07-26 ·