NthLayer core — reliability-critical verdict store, case management, and HTTP API
Project description
nthlayer-core
Tier 1 of the NthLayer ecosystem. Reliability-critical HTTP API server: verdict store, case management, change-freezes, manifest catalogue, heartbeats, component state.
pip install nthlayer-core
nthlayer serve --host 0.0.0.0 --port 8000
What it is
nthlayer-core is the single source of truth for the NthLayer runtime. It owns the SQLite store, exposes an HTTP API, and is the only component that touches the database. Tier 2 workers (nthlayer-workers) and the Tier 3 operator TUI (nthlayer-bench) talk to core exclusively over HTTP — never directly to SQLite.
Core availability = product availability. Worker failure is degradation; core failure is an outage.
- Stateful, no LLM. Pure transport. Decisions live elsewhere.
- Python · Starlette · uvicorn · SQLite (WAL).
- Apache 2.0 licensed.
Why a single API server
The v1.5 architecture moved away from per-component SQLite databases for two reasons:
- Lineage and case state need a single consistent view. A verdict written by the measure module must be linkable from a case opened by the bench TUI without cross-DB joins.
- Workers should be replaceable. Any worker can crash, restart, or be re-deployed without touching shared state. Core holds the state; workers hold cursors.
HTTP API surface
Core exposes the following resources. All responses are JSON. Verdicts are immutable — the outcome_resolution pattern creates a NEW verdict with parent_ids=[original_id] rather than mutating the original.
| Resource | Endpoints |
|---|---|
| Verdicts | POST /verdicts, GET /verdicts, GET /verdicts/{id}, GET /verdicts/{id}/ancestors, GET /verdicts/{id}/descendants, POST /verdicts/{id}/outcome |
| Assessments | POST /assessments, GET /assessments |
| Cases | POST /cases, GET /cases, GET /cases/{id}, PUT /cases/{id}/lease, DELETE /cases/{id}/lease, PUT /cases/{id}/resolve |
| Change freezes | POST /change-freezes, GET /change-freezes, PUT /change-freezes/{name}/lift |
| Heartbeats | POST /heartbeats, GET /heartbeats |
| Component state | PUT /component-state/{component}, GET /component-state/{component} |
| Suppressions | POST /suppressions, GET /suppressions |
| Manifests | GET /manifests, GET /manifests/{service}, POST /manifests/-/reload |
| Monitoring | GET /monitoring/stuck-action-requests |
| Health | GET /health |
Priority derivation
Cases without an explicit priority are derived from blast_radius + has_active_incident:
| blast_radius | active_incident | priority |
|---|---|---|
production |
true | P0 |
production |
false | P1 |
staging |
true | P1 |
staging |
false | P2 |
| dev / ephemeral / unknown | any | P3 |
Configuration
| Env var | Purpose | Default |
|---|---|---|
NTHLAYER_STORE_PATH |
SQLite database path | nthlayer.db |
NTHLAYER_MANIFESTS_DIR |
Directory of OpenSRM YAML manifests | unset (catalogue empty) |
For step-by-step deployment, troubleshooting, and Litestream hardening, see docs/deploying.md.
Schema (v1.5.0)
10 tables, string IDs, JSON TEXT content:
verdicts— immutable records with lineageassessments— non-decision component outputscases— bench domain model with lease managementchange_freezes— RBAC §7 freeze documentsheartbeats— component liveness (upsert per instance)component_state— persistent worker state across restartssuppressions— suppression audit trailrekor_anchors— empty in v1.5; populated in v2 (forward-compat)lineage— pre-computed transitive closure for fast ancestor/descendant queriesschema_meta— schema version
WAL mode + PRAGMA synchronous=NORMAL + busy_timeout=5000. Thread-local connection pool. BEGIN IMMEDIATE for all writes. Retention is policy-driven (verdicts only pruned when old AND no younger descendants AND no surviving case references); rekor_anchors are never pruned.
CLI
nthlayer serve [--host 0.0.0.0] [--port 8000] # start the HTTP server
nthlayer -V # print version
NthLayer ecosystem
nthlayer-core is one of seven repos. Each component works alone; composition happens through OpenSRM manifests + the core HTTP API.
| Repo | Tier | Role |
|---|---|---|
opensrm |
— | The OpenSRM specification |
nthlayer-common |
— | Shared library (verdicts, manifests, LLM wrapper, CoreAPIClient) |
nthlayer-generate |
— | Build-time compiler: specs → Grafana, Prometheus, SLOs, Backstage |
nthlayer-core |
1 | This repo — HTTP API + state |
nthlayer-workers |
2 | observe / measure / correlate / respond / learn worker modules |
nthlayer-bench |
3 | Operator TUI |
nthlayer |
— | Project front door + meta-package (pip install nthlayer) |
Licence
Apache 2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nthlayer_core-1.8.0.tar.gz.
File metadata
- Download URL: nthlayer_core-1.8.0.tar.gz
- Upload date:
- Size: 61.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6da074266f381bb0426f7a89d085974944fe1c526cbbc5de552f365b0792ca0e
|
|
| MD5 |
a4a026efc24f9f1bc18b11e9fd1e5740
|
|
| BLAKE2b-256 |
73898987621214792be5ab9630cb837cf2f43ddf43d10031557607c76b94ff27
|
Provenance
The following attestation bundles were made for nthlayer_core-1.8.0.tar.gz:
Publisher:
release.yml on rsionnach/nthlayer-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nthlayer_core-1.8.0.tar.gz -
Subject digest:
6da074266f381bb0426f7a89d085974944fe1c526cbbc5de552f365b0792ca0e - Sigstore transparency entry: 1879524114
- Sigstore integration time:
-
Permalink:
rsionnach/nthlayer-core@4e5f0156589f5ed2fd4de31d2342a255209b49fd -
Branch / Tag:
refs/tags/v1.8.0 - Owner: https://github.com/rsionnach
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4e5f0156589f5ed2fd4de31d2342a255209b49fd -
Trigger Event:
push
-
Statement type:
File details
Details for the file nthlayer_core-1.8.0-py3-none-any.whl.
File metadata
- Download URL: nthlayer_core-1.8.0-py3-none-any.whl
- Upload date:
- Size: 42.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d525d70e8d515b898c69dd62f09bf93dd703d3c56bef1f08ae5a5f3fedc4f98
|
|
| MD5 |
ac0dd9cb95066914cc1478df5683bad2
|
|
| BLAKE2b-256 |
73785362e84c99c1e2a15c4ea2bef00a9a028f55f5d942d8c7eed98e554440ca
|
Provenance
The following attestation bundles were made for nthlayer_core-1.8.0-py3-none-any.whl:
Publisher:
release.yml on rsionnach/nthlayer-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nthlayer_core-1.8.0-py3-none-any.whl -
Subject digest:
7d525d70e8d515b898c69dd62f09bf93dd703d3c56bef1f08ae5a5f3fedc4f98 - Sigstore transparency entry: 1879524213
- Sigstore integration time:
-
Permalink:
rsionnach/nthlayer-core@4e5f0156589f5ed2fd4de31d2342a255209b49fd -
Branch / Tag:
refs/tags/v1.8.0 - Owner: https://github.com/rsionnach
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4e5f0156589f5ed2fd4de31d2342a255209b49fd -
Trigger Event:
push
-
Statement type: