Skip to main content

SentinelRAG

SentinelRAG

CI Supply-chain gate PyPI License: MIT

Triple-gate RAG for CI. Retrieval can look fine in a notebook while a PR quietly tanks recall, ships an ungrounded answer, or lets a poisoned doc into the index. SentinelRAG treats those as three separate checkpoints — and fails the build when any one of them slips — with evidence your existing CI already understands (JSON, JUnit, SARIF).

pip install sentinelrag · sentinelrag-gate CLI · FastAPI + Qdrant reference app · offline mocks in CI · optional Gemini live path


Three checkpoints before merge

Checkpoint Catches How
Retrieve Silent recall / hit-rate / MRR drops Golden corpora + hybrid (+ optional cross-encoder)
Ground Answers that ignore the context Versioned judges on a golden set
Defend Junk / injection / poison at ingest Hygiene scan, ingest filters, red-team ASR probes

Foreign eval scores (promptfoo, Ragas, DeepEval) can feed the same evidence schema — SentinelRAG does not replace those tools; it unifies their numbers with its own gates.

Pipeline

flowchart LR
  A[Corpus change] --> R{Retrieve}
  R -->|pass| G{Ground}
  R -->|fail| X[Fail CI]
  G -->|pass| D{Defend}
  G -->|fail| X
  D -->|pass| E[Evidence · JUnit · SARIF]
  D -->|fail| X

Gate runs offline (no Gemini / GPU / Qdrant required). Optional live stack: FastAPI + Qdrant + bge-small + Gemini for citations.

See it query a corpus

Live preview

Animated walkthrough

Walkthrough: docs/DEMO.md


Install & run the gate

pip install sentinelrag
# from source:
# uv sync --extra dev

uv run sentinelrag-gate run --refresh
uv run sentinelrag-gate demo-poison
uv run sentinelrag-gate scan data/public_corpus --fail-on high

Outputs: .sentinelrag/gate/ · Policy: config/gate_policy.yaml

Plug into GitHub Actions

- uses: prakash888kp/SentinelRAG/.github/actions/sentinelrag-gate@v0.2.2
  with:
    refresh: "true"
    app-bound-check: "true"  # prove harmful chunk-size fails Retrieve

Default run is fixture-bound (bundled corpus + reference chunker). A green MockLLM gate does not by itself prove your app chunker change is safe. Use sentinelrag-gate app-bound-check or an adapter that indexes chunks from your revision — see CI cookbook.

Bring scores from other evaluators

uv run sentinelrag-gate import promptfoo examples/import_promptfoo/results.json -o build/art.json
uv run sentinelrag-gate import ragas examples/import_ragas/evaluation-result-records.json \
  --metric faithfulness --metric answer_relevancy -o build/art.json
uv run sentinelrag-gate import deepeval examples/import_deepeval/report.json -o build/art.json

Recipes: CI cookbook · Mapping: Interoperability


In the box

  • App — FastAPI ingest/query, hybrid + agentic retrieval, complexity router
  • Gate — policy YAML, baselines, SARIF/JUnit, composite Action
  • Security loop — hygiene, provenance SHA, poison benchmark v1
  • Interop — promptfoo / Ragas / DeepEval → sentinelrag-evidence-v1
  • Schemas & examples — schemas/ · examples/

Benchmarks

Committed JSON + plots in benchmarks/. Scripts: docs/BENCHMARK.md.

At a glance

Gate Headline
Retrieve Hybrid recall@5 1.0 (mock CI + real bge-small on mini & public)
Ground Faithfulness 0.83 · relevance 1.0 · trajectory recall 1.0
Defend Ingest defenses block 100% of probes · post-trim poison ASR 0.33 (from 1.0 raw)
Hygiene Scan passed · 0 findings

Quality vs cost

Hybrid hits full recall cheaper than agentic; naive is cheapest but weaker.

Strategy trade-off — quality vs cost

Strategy recall@k USD / query latency
naive 0.83 0.00005 ~14 ms
hybrid 1.0 0.0002 ~5 ms
agentic 1.0 0.0012 ~85 ms

Poison probes vs hybrid α

Ingest defenses stay at 1.0 blocked. Raw retrieval ASR only drops when α → dense (1.0).

Poison ASR vs hybrid alpha

Poison v1 ingest block rate 0.67
After post-retrieval trim ASR 0.33

Retrieval detail

Corpus Embedder naive@5 hybrid@5
Mini (CI) mock 0.83 1.0
Public (CI) mock 0.25 1.0
Mini bge-small 1.0 1.0
Public bge-small 1.0 1.0

Raw files: phase1_retrieval*.json, phase2_eval.json, phase3_trajectory.json, pareto_points.json, asr_vs_alpha.json, poison_benchmark_v1.json, hygiene_report.json, baseline_evidence.json.


Dig deeper

Architecture · Metrics · Benchmarks · Deployment · Poison v1 · OWASP map · Story · Phases · Comparison · Changelog


License

MIT · NOTICE

Metadata

Release files for sentinelrag 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sentinelrag 0.2.2
File Size Uploaded Provenance Actions
sentinelrag-0.2.2.tar.gz 857.7 kB With provenance Details for sentinelrag-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sentinelrag 0.2.2
File Interpreter ABI Platform Actions
sentinelrag-0.2.2-py3-none-any.whl Python 3 none any Details for sentinelrag-0.2.2-py3-none-any.whl

Total release size: 919.7 kB

Release files / sentinelrag-0.2.2.tar.gz

Download URL sentinelrag-0.2.2.tar.gz
Size 857.7 kB
Tags Source
SHA-256 checksum
How to use checksums
54f42952dcc014a31618338310b9f3442995562c6a2686e6f428166c0823bc96
BLAKE2b-256 checksum
How to use checksums
315318c013ae0154407ebbb5c80de7aef9bdcd7b1efc3367db9679072d761127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / sentinelrag-0.2.2-py3-none-any.whl

Download URL sentinelrag-0.2.2-py3-none-any.whl
Size 62.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1cebb2baed65109d6807380e3b9ac7b0b676f1b2d5345fdc5d99d689116cd75
BLAKE2b-256 checksum
How to use checksums
a6885901e5a81831a0f6842dbcf29de36d12f7d606ca0dd1afe04e07fb5be87b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for sentinelrag 0.2.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sentinelrag-0.2.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page