SentinelRAG
RAG supply-chain CI — fail builds when retrieval, grounded answers, or poison / hygiene defenses regress. Includes an adaptive FastAPI + Qdrant reference stack.
Author: PRAKASH KUMAR K (@prakash888kp) · Support: GitHub Issues
Narrative: docs/STORY.md · Security map: docs/OWASP_RAG_CI_MAP.md
Install
pip install sentinelrag
# or
uv add sentinelrag
Dev clone:
git clone https://github.com/prakash888kp/SentinelRAG.git
cd SentinelRAG
uv sync --extra dev
cp .env.example .env
Out of the box (no API keys)
uv run pytest
uv run sentinelrag-gate run --refresh
uv run sentinelrag-gate demo-poison
uv run sentinelrag-gate scan data/public_corpus --fail-on high
| Command | What it does |
|---|---|
sentinelrag-gate run |
Policy gate → evidence.json, JUnit, SARIF, summary |
sentinelrag-gate collect |
Anchor baseline evidence |
sentinelrag-gate compare |
Metric deltas between evidence files |
sentinelrag-gate scan |
Pre-ingest hygiene (injection / secret-like / PII-like) |
sentinelrag-gate demo-poison |
Poison ASR story (ingest + post-retrieval) |
Artifacts: .sentinelrag/gate/ · Policy: config/gate_policy.yaml
Drop into any GitHub repo
- uses: prakash888kp/SentinelRAG/.github/actions/sentinelrag-gate@v0.2.0
with:
refresh: "true"
What problem this solves
Teams on Reddit / LocalLLaMA / RAG ops repeatedly ask for:
- Golden-set retrieval regression (recall / hit-rate / MRR) separate from generation
- CI that fails on quality drops vs a committed baseline
- Pre-ingest hygiene before vectors land in the index
- Poison / indirect injection probes in the same pipeline as eval
- Audit artifacts (JSON evidence, JUnit, SARIF) — not log spam
SentinelRAG ships that stack offline by default (MockLLM / MockEmbedder).
flowchart LR
CORPUS[Corpus] --> HYG[Hygiene scan]
HYG --> PROV[Provenance manifest]
PROV --> ING[Ingest defenses]
ING --> RET[Naive / Hybrid / Agentic]
RET --> TRIM[Post-retrieval trim]
TRIM --> GEN[Generation]
RET & GEN & HYG --> GATE[sentinelrag-gate]
GATE --> ART[Evidence · JUnit · SARIF]
Results (mock, seed 42)
Committed under benchmarks/:
- Mini + public corpus: hybrid recall@k = 1.0 (also hit-rate + latency)
- Phase 2 mock judges: faithfulness / relevance gated
- Poison v1 + red-team defense probes
- Hygiene report + corpus SHA-256 manifest
Layout
src/sentinelrag/
api/ FastAPI service
ingest/ loaders, chunking, hygiene, provenance, filters
retrieval/ BM25, hybrid, agentic, stores
router/ complexity + cost policy
eval/ metrics, judges, golden I/O, latency
redteam/ attacks, defenses, post-retrieval, harness
gate/ evidence, policy, CLI, SARIF/JUnit
generation/ MockLLM + providers
observability/ cost + OTel
benchmarks/ reproducible JSON + plots
config/ eval_thresholds.yaml · gate_policy.yaml
data/ mini_corpus · public_corpus · golden.jsonl
API demo
docker compose up --build -d
curl -s http://127.0.0.1:8000/health
curl -s -X POST http://127.0.0.1:8000/query \
-H "Content-Type: application/json" \
-d '{"query":"What is triple-gate RAG?", "strategy":"auto"}'
Docs
CONTRIBUTING · SECURITY · CHANGELOG · COMPARISON · POISON_BENCHMARK_v1
License
MIT
Metadata
Release files for sentinelrag 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sentinelrag-0.2.0.tar.gz | 345.3 kB | Without provenance | Details for sentinelrag-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sentinelrag-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for sentinelrag-0.2.0-py3-none-any.whl |
Total release size: 398.9 kB
Release files / sentinelrag-0.2.0.tar.gz
| Download URL | sentinelrag-0.2.0.tar.gz |
|---|---|
| Size | 345.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5182c3a9cffb7f9583351ee4751701a0ecd8912c45db8e3f1533b8d55c973f7b
|
|
BLAKE2b-256 checksum How to use checksums |
d87d3dccfb1d38bf96d84009dc56cc505acbd2e1242630a3990c60b88adf8aa6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / sentinelrag-0.2.0-py3-none-any.whl
| Download URL | sentinelrag-0.2.0-py3-none-any.whl |
|---|---|
| Size | 53.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f220d839338b2d32f90985fb45958c84770ca79254f7fd3215895278eb6a6d43
|
|
BLAKE2b-256 checksum How to use checksums |
ac490af6f65bc431b2bc9d0a8a7745853505eee693b2d5abb2be251a6c04c14e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for sentinelrag 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.