Skip to main content

Shared schema, store, and target parsing for the ragradar observability system

Project description

ragradar-core

Shared kernel for the ragradar observability system: the run-record schema, the single SQLite store, and the sNrN target parser. ragradar-capture, ragradar, and ragradar-evaluate all depend on it — it depends on nothing.

You normally do not import this directly. Instrument pipelines with ragradar_capture, evaluate with ragradar_evaluate — both re-export the schema dataclasses. ragradar_core exists so those packages share one store contract instead of three copies of it.

Zero-dependency guarantee

ragradar_core imports only the Python standard library (sqlite3, dataclasses, json, re, pathlib, datetime). This is enforced by a test (tests/test_zero_deps.py) that imports the package in a subprocess and asserts nothing outside the stdlib was loaded.

What lives here

Module Contents
ragradar_core.schema RunRecord and its child dataclasses (ChunkRecord, TokenBudget, TokenUsage, Turn, CacheEvent, ToolCallRecord), all tolerant of unknown kwargs
ragradar_core.store store location, schema + migrations, and every persistence primitive (runs, eval scores, benchmark, policies)
ragradar_core.targets parse_target_id("s4r3") -> (4, 3) — the one sNrN parser

Environment setup contract

ragradar_core.store.connect() guarantees the environment before returning a connection:

  1. ~/.ragradar/ exists (created if missing),
  2. ~/.ragradar/runs.db exists (created if missing),
  3. the schema is at the latest version — fresh databases are created directly at the latest version; databases written by older package versions are migrated in place.

Any entry point — a library call, a CLI command, an example script — works on a fresh machine with no prior CLI invocation.

Schema version + migration story

One constant, ragradar_core.store.SCHEMA_VERSION (currently "3"), recorded in the meta table. The migration chain walks old databases forward on first connect:

  • v1 → v2: adds eval_scores / risk_score / evaluated_at columns to runs; creates the benchmark and policies tables.
  • v2 → v3: creates the runs_fts FTS5 index over run queries (with insert/update/delete sync triggers, backfilled from existing rows) and drops the now-redundant idx_runs_query index.

A database reporting a version this package doesn't know raises RuntimeError rather than guessing.

DB location and layout

The store lives at ~/.ragradar/runs.db (SQLite, WAL mode).

Table Columns
meta key, value — holds schema_version
sessions session_id, title, pipeline, created_at
runs session_id, run_seq, query, pipeline, created_at, run_data (JSON RunRecord), eval_scores (JSON), risk_score, evaluated_at
benchmark pipeline, factor, threshold, correlation, sample_count, updated_at
policies pipeline, policy_data (JSON), updated_at
runs_fts FTS5 index over runs.query

Runs are addressed as s{session_id}r{run_seq} (e.g. s2r3) everywhere — "run" is the data noun; capturing is the verb, and belongs to ragradar-capture.

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

ragradar_core-0.1.0.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ragradar_core-0.1.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file ragradar_core-0.1.0.tar.gz.

File metadata

  • Download URL: ragradar_core-0.1.0.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for ragradar_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4f769c380316d9224f2ce87d15ec1df561f1e5949cd209b8617d26e1533f1c36
MD5 f9f6f000e801bb97d0f501329381308a
BLAKE2b-256 e951ade6fa57cf4459372b973c58feee3237f6008f46de15eedfb127fdcb60bf

See more details on using hashes here.

File details

Details for the file ragradar_core-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ragradar_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for ragradar_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 428ad0e16d2ae70512a0cac7ea9ef9912ab8be80fded36c0569a15910fcc0b8a
MD5 24e09457eaa2b578f6d480cdd9e0e56a
BLAKE2b-256 f5436ec96509a1e4de3b182c6a9959a57cb9551cfcb40a4d3ae7f57332fa4ad4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page