Skip to main content

r3con

Context representation for large-scale reasoning.

Ask a question whose evidence is scattered across many documents. r3con organizes that context into a representation built for that question, then reasons over it.

How r3con works

Install

pip install r3context

Set the key your provider expects:

export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...

Or put them in a .env in your working directory.

Use

Command line — point it at a folder, a glob, or files:

r3con run "Which supplier missed the most delivery windows?" ./reports \
  --model openai/gpt-5.6-luna

--model takes any litellm model string, e.g. anthropic/claude-sonnet-5, gemini/gemini-3.8-flash, hosted_vllm/Qwen/Qwen3.5-35B-A3B. The default is openai/gpt-5.6-luna.

A folder is walked recursively. You can also match a pattern, or name the files:

r3con run "Who approved the Q3 overspend?" "./reports/*.pdf"      # quote the glob
r3con run "Who approved the Q3 overspend?" "./reports/**/*.pdf"   # ** recurses
r3con run "Who approved the Q3 overspend?" q1.md q2.md q3.md      # or name them

Python, reading documents off disk:

from r3con import r3con

docs = r3con.read_documents("./reports")     # a folder, a glob, or a list of files
                                             # .txt .md .csv .json .html .xml … and .pdf
result = r3con.run("Which supplier missed the most delivery windows?", docs)
print(result)

Python, documents you already have:

result = r3con.run("Which supplier missed the most delivery windows?", [doc_a, doc_b, doc_c])

documents is a list of strings — the documents themselves.

Notebooks, over five short memos arranged so no single one holds the answer:

What you get back

result.answer             # str       — the answer; str(result) gives you the same
result.relevant_context   # list[str] — the final collection of relevance snippets
result.structured_context # dict      — the structured context, in dict form
result.run_dir            # Path      — where this run's artifacts went (below)

Logs

Every run writes a folder under ./logs with everything it did — each document's relevance snippet in every round, the schema it proposed, the parsed records, and the reasoning transcript.

logs/<timestamp>_<hex>/          <- result.run_dir
├── relevance/            result.json · calls.json
├── structuring/
│   ├── schema/           result.json · calls.json · transcript.yaml
│   └── parsing/          result.json · calls.json
└── reasoning/            result.json · calls.json · transcript.yaml

Evaluation

How r3con was evaluated, with the baselines it was compared against: r3con-evaluation.

Licence

MIT — see LICENSE. src/r3con/runtime/python_executor.py is a modified copy of the sandboxed interpreter from smolagents, Apache-2.0, © HuggingFace Inc. See NOTICE and LICENSE-APACHE-2.0.

Metadata

Release files for r3context 0.1.0

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

Source distribution (sdist)

Source distribution for r3context 0.1.0
File Size Uploaded Provenance
r3context-0.1.0.tar.gz 82.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 180.3 kB

Release files / r3context-0.1.0.tar.gz

Download URL r3context-0.1.0.tar.gz
Size 82.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1bbc095e4e26e302f0c17cf8c0445caa441430065db375778027d8d8fc8b426e
BLAKE2b-256 checksum
How to use checksums
a9ef68c51f377a685b72d47c604474df2ac5624d994bb3a720c29691bdff241a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / r3context-0.1.0-py3-none-any.whl

Download URL r3context-0.1.0-py3-none-any.whl
Size 98.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b05ce902be46d36b297015bd97aa22312de7bae7e3912816ccfbd12b7796d2a3
BLAKE2b-256 checksum
How to use checksums
1ac8d7471daf08b93f81f9ad37601178c15b1be3d1469e41a238162bc18ec7e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for r3context 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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