Ragwell Python SDK
Typed synchronous and asynchronous Python clients for Ragwell, a managed service for document ingestion and retrieval with source citations.
Status: 0.2.0 developer beta release candidate. This source implements the
reviewed machine API, including optional Jev reranking. The candidate runtime passed
the deployed beta lifecycle and a bounded live Jev smoke; a fresh hosted CI matrix
remains a release gate. The SDK returns retrieval evidence and citations; it does
not generate answers.
Requirements and installation
Python 3.11 or newer is required. Install the ragwell distribution from PyPI:
python -m pip install ragwell
For local development:
uv sync --locked --python 3.11
Runtime use requires an existing project grant and API key. The SDK does not create
projects, users, keys, or billing resources. Supply the endpoint and key explicitly
or through RAGWELL_BASE_URL and RAGWELL_API_KEY; explicit arguments win. No beta
hostname is built into the package and no .env file is loaded implicitly.
Synchronous quick start
import os
from pathlib import Path
from ragwell import Ragwell
from ragwell.types import SearchFilters
with Ragwell() as client:
project = client.project(os.environ["RAGWELL_PROJECT_ID"])
ready = project.documents.upload_and_wait(
file=Path("guide.pdf"),
wait_timeout=300,
)
results = project.search(
query="What is the retention policy?",
filters=SearchFilters(document_ids=[ready.intake.document.id]),
)
for item in results.items:
print(item.rank, item.source_filename, item.parts)
Asynchronous quick start
import os
from ragwell import AsyncRagwell
async def retrieve(query: str):
async with AsyncRagwell() as client:
project = client.project(os.environ["RAGWELL_PROJECT_ID"])
return await project.search(query=query)
Initialize one async client at application startup, share it within its owning event
loop, and close it at shutdown. Injected HTTPX clients are borrowed unless
owns_http_client=True; SDK-created pools are owned and closed by the SDK.
Public resource layout
client.project(project_id) is local and performs no preflight request. Both client
styles expose the same 26 contract operations:
client.upload_policy.get()project.get()andproject.embedding_connection.get()project.uploads.create(),.get(),.upload_content(), and.finalize()project.documents.list(),.get(),.replace_metadata(),.delete(),.inspect(), and.activity()project.documents.generations.list(),.chunks.list(), and.sources.get()project.documents.exports.create(),.get(),.stream_part(), and.download_part()project.jobs.list(),.get(),.retry(), and.cancel()project.deletions.get()and.retry()project.search()
Convenience workflows add documents.upload(), documents.upload_and_wait(),
jobs.wait(), deletions.wait(), documents.exports.wait(), and lazy .iter()
methods for documents, jobs, generations, and chunks.
Generated public types and enums are available from ragwell.types. They preserve
UUIDs, aware timestamps, omission through UNSET, explicit null, complete source
parts and scores, command acceptance versus current resource state, and additive
response fields through additional_properties.
Reliability and ownership
- HTTP 202 means accepted, never completed. Waiters have finite deadlines and never cancel or retry remote work implicitly.
- Job cursors are opaque and filter/project scoped. Iterators never parse or create them, stop at null, and reject repeated cursors.
- Safe reads receive at most two bounded retries. Replayed mutations keep one idempotency key for the logical command. Search is never automatically replayed.
command_in_progressmay retry within the deadline usingRetry-After; quota, authorization, validation, and revision/idempotency conflicts do not.- Upload helpers accept paths, bytes, and seekable binary streams, hash incrementally, restore caller cursors, and never close caller-owned streams. Bytes/streams need an explicit filename.
- Export saves stream to an SDK-owned temporary file in the destination directory, verifies manifest byte size and SHA-256, then replaces atomically. Overwrite is opt-in.
See deadlines, bounds and recovery for timeout-zero behavior, transfer budgets, cancellation, decoded-body caps and accepted-intake recovery IDs.
Errors derive from RagwellError. ApiError preserves safe status/code, field
errors, quota detail, retry hints, operation ID, and server X-Request-ID. Transport,
protocol, wait-timeout, terminal-operation, pagination, and integrity failures are
distinct. Exceptions do not include keys, request bodies, queries, raw HTML, or
document content.
Optional reranking (0.2.0)
After a project owner configures their paid Jev key in the dashboard, request
reranking for an individual search. This interface requires ragwell>=0.2.0:
from ragwell import Ragwell
from ragwell.types import RerankRequest
with Ragwell() as client:
result = client.project(project_id).search(
query="What is the refund window?",
k=5,
rerank=RerankRequest(id="jev"),
)
for item in result.items:
print(item.scores.rerank, item.content)
AsyncRagwell exposes the same argument on await project.search(...).
Omitting rerank or passing None uses ordinary retrieval. A missing project key
raises ConflictError with code project_reranker_misconfigured. Provider failures
remain explicit, and the SDK never automatically retries a search. Jev charges
the configured TypeSafe, OpenRouter or Vercel AI Gateway account. The client API
key is your Ragwell key; never pass the provider key as a search parameter.
Provider, API base URL and Jev model are project settings; the Ragwell SDK request
stays the same for every route.
response.rerank includes the provider, requested model and resolved_model
(null when no scoring ran), so gateway model aliases remain traceable.
Relevance is 0–3; rerank_confidence is separate on 0–1. Original source parts,
text/vector scores and hybrid score remain available; scores.final follows the
reranking order. The first version accepts no tuning parameters.
Runnable async example
The Python 3.12 example project installs the
published SDK from PyPI. Copy its env.example to .env, configure your project,
then run its scripts to sync a local document folder, retrieve to terminal/JSON,
and clean the project.
Development and qualification
uv run --locked ruff format --check .
uv run --locked ruff check .
uv run --locked mypy
uv run --locked python scripts/generate.py --check
uv run --locked pytest
uv run --locked python -m build --no-isolation
The vendored artifact is 2026-09-22.1, machine SHA-256
edd7aa3d26def4a1dcafceee4af2b9d4ae5a0d2affde52719ce03e904cc5a509.
See contract provenance,
generation qualification, and
operation mapping. Ordinary tests require no service,
credentials, provider calls, private repository, or model downloads.
The current contract adds optional Jev reranking. The installed 0.2.0 candidate
passed the deployed beta lifecycle with the matching live contract, and its package
runtime passed a bounded synthetic Jev request. Representative quality, latency and
cost evaluation remains separate product-rollout work. The
release process records the remaining hosted CI, TestPyPI and
PyPI controls.
An optional beta lifecycle validation checks the installed wheel against a dedicated existing beta project with a scoped key. It starts no services and is separate from the full fixture matrix and ordinary offline CI.
Documentation: API reference and scopes, sync lifecycle example, async lifecycle example, compatibility and support, security policy, changelog, and release preparation.
License
MIT.
Metadata
Release files for ragwell 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ragwell-0.2.0.tar.gz | 239.2 kB | With provenance | Details for ragwell-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ragwell-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for ragwell-0.2.0-py3-none-any.whl |
Total release size: 420.0 kB
Release files / ragwell-0.2.0.tar.gz
| Download URL | ragwell-0.2.0.tar.gz |
|---|---|
| Size | 239.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60b8e54273605c5eb6af2c4b43c3e88b1f0d12e17adfaa943eca3d0a82160e19
|
|
BLAKE2b-256 checksum How to use checksums |
d74b82c893d977ac562ef0c1642b40a1f95d10236ca79b09b629723e1c6261cf
|
| 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 Sep 22, 2026.
Transparency logRelease files / ragwell-0.2.0-py3-none-any.whl
| Download URL | ragwell-0.2.0-py3-none-any.whl |
|---|---|
| Size | 180.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e04481e9cbd31da0c475e10988128a3ba093c8cda7463ecb89432b0a64a8fcb
|
|
BLAKE2b-256 checksum How to use checksums |
18ef19438c52d2bec434485b2faa1477ae25e0c14862ad5a734989bc7909c013
|
| 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 Sep 22, 2026.
Transparency logSecurity for ragwell 0.2.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for ragwell-0.2.0.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 Sep 22, 2026.
Transparency logA 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.