Skip to main content

RagSentry

Regression testing and evaluation CLI for Retrieval-Augmented Generation (RAG) systems.

RagSentry connects to your RAG application through a thin adapter, evaluates retrieved contexts and generated answers against a dataset, tracks runs over time, diffs runs to catch regressions, and gates CI builds.


Table of Contents


Installation

pip install ragsentry

Optional PostgreSQL storage support:

pip install "ragsentry[postgres]"

Quickstart

1. Initialize the project

ragsentry init

This scaffolds two files in the current directory:

  • ragsentry_adapter.py — a starter adapter stub
  • evalset.jsonl — a starter evaluation dataset

2. Connect your RAG application

Edit ragsentry_adapter.py to call your RAG pipeline and return the required contract:

from my_rag_app import ask_rag

def query(question: str) -> dict:
    result = ask_rag(question)
    return {
        "answer": result["answer"],
        "contexts": result["contexts"],  # list[str] of retrieved passages
    }

See the Adapter Contract Guide for all supported adapter forms (Python callable, HTTP endpoint, shell subprocess).

3. Run an evaluation

Unscored generation pass (no LLM required):

ragsentry run -e evalset.jsonl -a ragsentry_adapter:query --no-scoring

Full evaluation with an LLM judge:

ragsentry run -e evalset.jsonl -a ragsentry_adapter:query -p openrouter -m openai/gpt-4o

4. Diff runs and gate CI

Diff two evaluation runs:

ragsentry diff run_2026-09-27T10-00-00_a1b2c3d4.json run_2026-09-27T11-00-00_e5f6g7h8.json

Quality gate in CI (exit code 0 on pass, non-zero on failure):

ragsentry ci \
  --candidate <candidate_run_id> \
  --baseline <baseline_run_id> \
  -t faithfulness=0.80 \
  -t context_recall=0.85 \
  --max-regressed-questions 1 \
  --pr-comment-out pr_comment.md

Key Features

  • Plug-and-Play Adapters. Supports Python callables (pkg.mod:func), REST APIs (http://localhost:8000/query), and CLI tools (shell:python rag_cli.py).
  • Provider-Agnostic Judge Scoring. Works with OpenAI, Anthropic, Gemini, Groq, xAI, Ollama, DeepSeek, OpenRouter, or any custom OpenAI-compatible endpoint.
  • Dual Storage Backends. Local JSON file store or PostgreSQL (--storage postgresql://...).
  • Rich Terminal Diffs. Colorized diff tables highlighting improved, regressed, and unchanged questions per metric.
  • CI Quality Gates. Strict threshold enforcement and regression limits with exportable GitHub PR Markdown summaries.
  • Agent-Usable Scaffolder Skill. Includes skills/adapter-scaffolder so AI coding assistants can inspect unfamiliar RAG repositories and scaffold adapters automatically.

Agent Skill: Adapter Scaffolder

RagSentry ships a skill file (skills/adapter-scaffolder/SKILL.md) that AI coding assistants can read to automatically inspect an unfamiliar RAG codebase and generate a working ragsentry_adapter.py.

Install the skill into your agent's configuration with a single command:

# Install to local workspace (.agents/skills/adapter-scaffolder)
ragsentry install-skill

# Install for a specific agent
ragsentry install-skill --agent claude
ragsentry install-skill --agent cursor
ragsentry install-skill --agent windsurf

# Global install (available across all workspaces)
ragsentry install-skill --global

See the Agent Skill Installation Guide for full details.


Documentation

Guide Description
Adapter Contract Supported adapter forms and their required contracts
CI/CD Integration GitHub Actions, GitLab CI, and generic pipeline setup
Configuration Reference Judge providers, storage backends, and all CLI options
Agent Skill Installation Installing the adapter scaffolder skill for AI agents
Adapter Scaffolder Skill The skill specification read by AI coding assistants

License

MIT. See LICENSE for details.

Metadata

Release files for ragsentry 0.1.4

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

Source distribution (sdist)

Source distribution for ragsentry 0.1.4
File Size Uploaded
ragsentry-0.1.4.tar.gz 30.0 kB Details

Built distribution (wheel)

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

Total release size: 60.4 kB

Release files / ragsentry-0.1.4.tar.gz

Download URL ragsentry-0.1.4.tar.gz
Size 30.0 kB
Tags Source
SHA-256 checksum
How to use checksums
92552de2a5a8ed227f45e4b0bed2ea1795c00280498c62537048a79966b96238
BLAKE2b-256 checksum
How to use checksums
f068ce6a5a779f41c018556582f8b3aca3bd4976ed66aa5bed1f46d74ecbecfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 4, 2026.

Transparency log

Release files / ragsentry-0.1.4-py3-none-any.whl

Download URL ragsentry-0.1.4-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
536bbad6ffdda5ede75df689f1ea6fa90f32413f5d90b5a4b8cdc8c3e90226df
BLAKE2b-256 checksum
How to use checksums
8801a19853d3a2dc97a64b04fa41c520d2465bd5592d87432bb036d056b14bf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 4, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.6

2 release files

0.1.5

2 release files

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

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