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.1
  with:
    refresh: "true"

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.1

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.1
File Size Uploaded Provenance Actions
sentinelrag-0.2.1.tar.gz 842.6 kB With provenance Details for sentinelrag-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 900.0 kB

Release files / sentinelrag-0.2.1.tar.gz

Download URL sentinelrag-0.2.1.tar.gz
Size 842.6 kB
Tags Source
SHA-256 checksum
How to use checksums
743b5ce525b100b59e13809d4bf2dd89f17a4ca8d71771269ea6b70420493bc5
BLAKE2b-256 checksum
How to use checksums
eb2d828196e3a3a447c1836bc3d80b8c2b41d6d4f9659ed4900cb2a549a8249a
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 8, 2026.

Transparency log

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

Download URL sentinelrag-0.2.1-py3-none-any.whl
Size 57.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b239c31ceb8e852e9f0afd4b910f55c90d43ed2d870c3faee6f3b6f33a5083c
BLAKE2b-256 checksum
How to use checksums
befa8dee27dac58290029fded1295f2f6a312ac85438eb1581c33f209350a623
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 8, 2026.

Transparency log

Security for sentinelrag 0.2.1

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.1.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 8, 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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files Full provenance

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