Skip to main content

A single agent that answers from your compiled corpus — every claim cited.

Project description

reigner

A single agent that answers from your compiled corpus — every claim cited.

PyPI Python CI License: MIT

📚 Documentation: https://construct-lab.github.io/reigner/

Reigner is a toolkit for building citation-faithful question-answering agents over a knowledge corpus. You compile your sources into bounded, schema-aware artifacts once, then a single retrieval agent answers over them — every factual claim traced back to its source. It is a library first: not a chat app, not a coding-agent harness, not a multi-agent orchestrator.

One core, three surfaces

You meet the same agent core — the harness, the artifact store, and a single REIGNER.md instruction file — at three points in its lifecycle:

  • Build — define a per-project agent as a library: a schema, @tools, an extractor, a recipe, plugins. This is what you ship.
  • Test — iterate from the CLI: ingest, chat, then session fork / replay and eval to A/B/C variants of your REIGNER.md, tools, or model.
  • Ship — serve the same agent over HTTP (FastAPI + SSE) so your apps consume it with no rewrite. (MCP export is planned; see status below.)

Features

  • Compiled artifacts — ingestion compiles raw documents into a bounded, schema-aware store. The agent queries the compiled graph, never your raw files.
  • Bounded, self-describing tools — every tool result reports has_more, truncated, and available_keys, so a finite-context model always knows whether it got everything.
  • Citations are first-class — numeric and factual claims register a CitationEvent with provenance; the eval suite fails answers that make uncited claims.
  • Forkable sessions — durable JSONL sessions on disk that you can fork and replay to compare variants without re-running from scratch.
  • One typed event protocol — CLI, HTTP, and MCP all consume the same typed events.
  • Provider-agnostic — Anthropic, OpenAI, and Gemini adapters behind one interface.

Quickstart

uv add 'reigner[anthropic,ingestion]'      # model adapter + PDF/URL loaders

reigner init mydocs --recipe document_qa   # scaffold a project
# drop your PDFs/text into mydocs/, then:
cd mydocs
reigner ingest                             # compile documents into artifacts
reigner chat                               # ask questions, get cited answers

reigner chat answering a question with per-claim citations

The full walkthrough — every command with real output and a per-feature status flag — is in the usage guide.

Install

uv add reigner

Reigner ships a thin core; each capability is an opt-in extra:

Extra Purpose
reigner[anthropic] Anthropic model adapter
reigner[openai] OpenAI model adapter
reigner[gemini] Gemini model adapter
reigner[server] FastAPI HTTP server with SSE
reigner[mcp] MCP server export (planned — not wired yet)
reigner[ingestion] PDF/URL loaders for the ingestion pipeline
reigner[otel] OpenTelemetry metrics plugin
reigner[all] Everything above

License note

Reigner itself is MIT-licensed. The [ingestion] extra pulls in PyMuPDF, which is AGPL-3.0. Downstream projects that distribute or network-serve a closed-source product on top of reigner[ingestion] must comply with AGPL or obtain a PyMuPDF Pro commercial license. To avoid the AGPL entirely, override LLMExtractor.raw_to_text with a permissive-licensed loader of your choice.

Learn more

  • Usage guide — hands-on, install → scaffold → ingest → chat.
  • Observability — OpenTelemetry spans for the agent loop.
  • Design (spec) — package layout, guardrails, API contracts, event protocol.
  • Principles — the rationale behind each design decision.
  • API reference — the typed public API.

Development

uv sync --all-extras --group dev
uv run pre-commit install
uv run pytest

CI runs ruff check, ruff format --check, mypy, and pytest on every PR.

License

MIT — see LICENSE.

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

reigner-0.8.1.tar.gz (188.3 kB view details)

Uploaded Source

Built Distribution

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

reigner-0.8.1-py3-none-any.whl (256.9 kB view details)

Uploaded Python 3

File details

Details for the file reigner-0.8.1.tar.gz.

File metadata

  • Download URL: reigner-0.8.1.tar.gz
  • Upload date:
  • Size: 188.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for reigner-0.8.1.tar.gz
Algorithm Hash digest
SHA256 8be0cde72877c3bf02b05e2f544b783592c33a402d0384c6f59727010aa24e33
MD5 91e96bec570c38b3da92de89f7ed4002
BLAKE2b-256 5c457702612978381a02c3158841bcb04c4057b4e2b3a6a7faaae0e58508a2b9

See more details on using hashes here.

File details

Details for the file reigner-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: reigner-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 256.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for reigner-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa7b8e0bb95d765d3e82ebcb233ffba0f03b3bae2202232f874ef71faedb937c
MD5 36ee5d77b2e5c0fcf115e9464e43347e
BLAKE2b-256 fc0c10dd4a043160060893d9bbec1667a82e19b2b9b5b784c76f28e70c9433c2

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