Skip to content

Template Backend

The template backend is Sentinel’s default narrative generator. It uses deterministic rules to produce structured assessments from telemetry data — no ML models, no external dependencies, sub-millisecond latency.

The template backend processes the SentinelTelemetryFeed through a rule-based assessment pipeline:

  1. Gamma analysis — computes headroom, trend direction, and proximity to floor
  2. Warning trend analysis — examines the historical window for escalating patterns
  3. Steps-to-impact assessment — evaluates urgency from the escalation context
  4. Risk level classification — combines signals into NOMINAL, ELEVATED, or CRITICAL
  5. Narrative assembly — generates a human-readable summary from structured templates
  6. Highlight extraction — selects the most important metrics for the operator

The template backend classifies risk based on these signals:

SignalNOMINALELEVATEDCRITICAL
Gamma headroom> 25%5–25%< 5%
Warning trendStable or decreasingIncreasingRapidly increasing
Steps to breach> 103–10< 3
Loss event in windowNoNoYes

Multiple signals are combined — a CRITICAL from any single signal elevates the overall assessment to at least ELEVATED.

The template backend constructs narratives from pre-defined sentence templates, parameterized with actual telemetry values:

  • Opening — overall stability assessment based on risk level
  • Gamma state — current gamma, floor, and headroom percentage
  • Warning trend — describes the trajectory over the historical window
  • Urgency — steps-to-breach and escalation type context
  • Recommendation — action guidance based on the escalation type

Example output at CRITICAL:

System stability is deteriorating rapidly. Gamma has dropped to 0.250 against a floor of 0.200, leaving only 5.0% headroom. Warning criticality has escalated from 0.0 to 0.75 over the last 3 ticks, with impact projected in 3.0 steps. Immediate operator review recommended.

Example output at NOMINAL:

System stability is within normal parameters. Gamma is at 0.650 with comfortable headroom above the 0.200 floor. This escalation appears precautionary — no immediate action required.

PropertyValue
DeterminismFully deterministic — same input always produces same output
LatencySub-millisecond (typically < 1ms)
DependenciesNone beyond kairos-engine-core types
Feature flagAlways available (no feature gate)
Backend identifiertemplate in SentinelSummary.backend

The template backend is the right choice when:

  • Determinism is required — you need reproducible assessments for audit trails
  • Latency is critical — sub-millisecond response time
  • No model infrastructure — you don’t want to manage model bundles
  • Deployment simplicity — zero additional dependencies

For richer, more contextual narratives, see the SLM backend.