Shift-left reliability for platform teams.
Define reliability requirements as code. Validate SLOs against dependency chains. Detect drift before incidents. Gate deployments on real data.
pip install nthlayerReliability decisions happen too late. Teams set SLOs in isolation, deploy without checking error budgets, and discover missing metrics during incidents. Dashboards are inconsistent. Alerts are copy-pasted. Nobody validates whether a 99.99% target is even achievable given dependencies.
NthLayer moves reliability left:
service.yaml β validate β check-deploy β deploy
β β
β βββ Error budget ok? Drift acceptable?
β
βββ SLO feasible? Dependencies support it? Metrics exist?
Predict SLO exhaustion before it happens. Don't wait for the budget to hit zero.
$ nthlayer drift payment-api
payment-api: CRITICAL
Current: 73.2% budget remaining
Trend: -2.1%/day (gradual decline)
Projection: Budget exhausts in 23 days
Recommendation: Investigate error rate increase before next releaseYour SLO ceiling is your weakest dependency chain. NthLayer calculates it.
$ nthlayer validate-slo payment-api
Target: 99.99% availability
Dependencies:
β postgresql (99.95%)
β redis (99.99%)
β user-service (99.9%)
Serial availability: 99.84%
β INFEASIBLE: Target exceeds dependency ceiling by 0.15%
Recommendation: Reduce target to 99.8% or improve user-service SLOBlock deploys when error budget is exhausted or drift is critical.
$ nthlayer check-deploy payment-api
ERROR: Deployment blocked
- Error budget: -47 minutes (exhausted)
- Drift severity: critical
- 3 P1 incidents in last 7 days
Exit code: 2 (BLOCKED)Understand impact before making changes.
$ nthlayer blast-radius payment-api
Direct dependents (3):
β’ checkout-service (critical) - 847K req/day
β’ order-service (critical) - 523K req/day
β’ refund-worker (standard) - 12K req/day
Transitive impact: 12 services, 2.1M daily requests
Risk: HIGH - affects checkout flowEnforce OpenTelemetry conventions. Know what's missing before production.
$ nthlayer recommend-metrics payment-api
Required (SLO-critical):
β http.server.request.duration FOUND
β http.server.active_requests MISSING
Run with --show-code for instrumentation examples.Generate dashboards, alerts, and SLOs from a single spec.
$ nthlayer apply service.yaml
Generated:
β dashboard.json (Grafana)
β alerts.yaml (Prometheus)
β recording-rules.yaml (Prometheus)
β slos.yaml (OpenSLO)# Install
pip install nthlayer
# Create a service spec
nthlayer init
# Validate and generate
nthlayer apply service.yaml
# Check deployment readiness
nthlayer check-deploy payment-apiname: payment-api
tier: critical
type: api
team: payments
dependencies:
- postgresql
- redisNthLayer also supports the OpenSRM format (apiVersion: opensrm/v1) for contracts, deployment gates, and more. See full spec reference for all options.
# GitHub Actions
- name: Validate reliability
run: |
nthlayer validate-slo ${{ matrix.service }}
nthlayer check-deploy ${{ matrix.service }}Works with: GitHub Actions, GitLab CI, ArgoCD, Tekton, Jenkins
| Traditional Approach | NthLayer |
|---|---|
| Set SLOs in isolation | Validate against dependency chains |
| Alert when budget exhausted | Predict exhaustion with drift detection |
| Discover missing metrics in incidents | Enforce before deployment |
| Manual dashboard creation | Generate from spec |
| "Is this ready?" = opinion | "Is this ready?" = deterministic check |
Full Documentation - Comprehensive guides and reference.
| Guide | Description |
|---|---|
| Quick Start | Get running in 5 minutes |
| Drift Detection | Predict SLO exhaustion |
| Dependency Discovery | Automatic dependency mapping |
| CI/CD Integration | Pipeline setup |
| CLI Reference | All commands |
- Artifact generation (dashboards, alerts, SLOs)
- Deployment gates (check-deploy)
- Error budget tracking
- Portfolio view
- Drift detection
- Dependency discovery
- validate-slo
- blast-radius
- Metric recommendations
- OpenSRM manifest format (
srm/v1) - Reliability scorecard
- Monte Carlo SLO simulation (
nthlayer simulate) - Loki alert generation
- Recording rules generation
- Contract & dependency validation
- Intelligent alerts pipeline
- Identity resolution & ownership
- CI/CD GitHub Action
- Agentic inference (
nthlayer infer) - MCP server integration
- Backstage plugin
nthlayer infer will use a model to analyse a codebase and propose an OpenSRM manifest for it. The model examines the code, identifies services, infers appropriate SLO targets, and generates a draft service.reliability.yaml that NthLayer then validates and generates artifacts from.
This follows Zero Framework Cognition: the model provides judgment (what SLOs does this service need?), and NthLayer provides transport (validate the manifest, generate the monitoring artifacts). Clean boundary between reasoning and deterministic transformation.
NthLayer is one component in the OpenSRM ecosystem. Each component solves a complete problem independently, and they compose when used together through shared OpenSRM manifests and OTel telemetry conventions.
βββββββββββββββββββββββββββ
β OpenSRM Manifest β
β (the shared contract) β
ββββββββββββββ¬βββββββββββββ
β
reads β reads
βββββββββββββββ¬βββββββ΄βββββββ¬ββββββββββββββ
βΌ βΌ βΌ βΌ
ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ
β MEASURE β β>NTHLAYER<β βCORRELATE β β RESPOND β
β β β β β β β β
β quality β β generate β βcorrelate β β incident β
β+govern β β monitoringβ β signals β β response β
β+cost β β β β β β β
ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ
β β β β
βββββββββββββββ΄βββββββ¬βββββββ΄ββββββββββββββ
βΌ
ββββββββββββββββββββββββββββ
β Verdict Store β
β (shared data substrate) β
β create Β· resolve Β· link β
β accuracy Β· gaming-check β
ββββββββββββββ¬ββββββββββββββ
β OTel side-effects
βΌ
ββββββββββββββββββββββββββββ
β OTel Collector / β
β Prometheus / Grafana β
ββββββββββββββββββββββββββββ
Learning loop (post-incident):
nthlayer-respond findings β manifest updates
β NthLayer regenerates β nthlayer-measure
refines β nthlayer-correlate improves β OpenSRM
How NthLayer fits in:
- NthLayer reads OpenSRM manifests and generates the monitoring infrastructure (Prometheus rules, Grafana dashboards, PagerDuty config) that the rest of the ecosystem relies on
- Verdict operations emit OTel side-effects (
gen_ai.decision.*,gen_ai.override.*) that flow into Prometheus. NthLayer generates dashboards for these metrics alongside service dashboards β NthLayer reads from Prometheus, not the Verdict Store directly. - NthLayer exports service topology that nthlayer-correlate uses for topology-aware signal correlation
- nthlayer-respond's post-incident findings feed back into NthLayer as rule refinements (alerts that should have fired earlier or didn't fire at all)
Each component works alone. Someone who just needs reliability-as-code adopts NthLayer without needing nthlayer-measure, nthlayer-correlate, or nthlayer-respond.
| Component | What it does | Link |
|---|---|---|
| OpenSRM | Specification for declaring service reliability requirements | OpenSRM |
| nthlayer-learn | Data primitive for recording AI judgments and measuring correctness | nthlayer-learn |
| nthlayer-measure | Quality measurement and governance for AI agents | nthlayer-measure |
| NthLayer | Generate monitoring infrastructure from manifests (this repo) | nthlayer |
| nthlayer-correlate | Situational awareness through signal correlation | nthlayer-correlate |
| nthlayer-respond | Multi-agent incident response | nthlayer-respond |
# Install uv (https://docs.astral.sh/uv/)
curl -LsSf https://astral.sh/uv/install.sh | sh
git clone https://github.com/rsionnach/nthlayer.git
cd nthlayer
make setup # Install deps, start services
make test # Run testsSee CONTRIBUTING.md for details.
MIT - See LICENSE.txt
Built on grafana-foundation-sdk, awesome-prometheus-alerts, pint, and OpenSLO. Inspired by Sloth and autograf.
