Skip to main content

reef_client

Stdlib-only client SDK for the Reef protocol. reef_client is a client of Reef's HTTP wire protocol, not of the reef package: it never imports reef and has no dependencies, so external harnesses can install it or copy it into environments that cannot take the reef wheel's dependencies.

The distribution is reef-client (pyproject.toml); the import package is the inner reef_client/ directory:

  • client.py is ReefClient, the ask/observe/report loop every example shares (see the Reef docs), plus the harness update channel reads: harness_versions (the version catalog with gate metrics) and harness_pull (write one served tree, head or version-addressed, into a directory).
  • skill.py fetches and syncs the scenario's served skill file (fetch_skill/sync_skill);
  • sse.py converts between buffered chat completions and OpenAI-style SSE chunk streams in both directions (synthesize_sse_events / SSEAccumulator).
  • serve.py is serve mode: a local sidecar that agents treat as their model endpoint (python -m reef_client.serve), owning session stamping, trajectory capture, receipt collection, and SSE passthrough/synthesis so reef-oblivious agents need no SDK. See the reference.

The client and skill helpers are re-exported at the package root: from reef_client import ReefClient, fetch_skill, sync_skill. Import the sse/serve submodules directly.

Install

pip install reef-client

For development:

git clone https://github.com/Human-Agent-Society/reef-client && cd reef-client
pip install -e .

The package is standard library only — copying the inner reef_client/ directory into your harness works too.

Import existing records

Run the importer on the machine holding your data, pointing it at a running Reef service that supports POST /reef/records/batch:

reef-client import records.jsonl --url https://reef.example.com --scenario my-agent
# Also works without a console-script installation:
python -m reef_client import records.jsonl --url https://reef.example.com --scenario my-agent

No reef-infra, training libraries, or third-party HTTP client is required. Authentication is read from REEF_TOKEN when set.

Each UTF-8 JSONL line is an existing record envelope. IDs must stay stable and reports must follow their referenced inferences:

{"agent_record_id":"sample-1","request_type":"inference","payload":{"messages":[{"role":"user","content":"2+2?"}],"response":{"choices":[{"message":{"role":"assistant","content":"4"}}]}}}
{"agent_record_id":"score-1","request_type":"report","payload":{"references":["sample-1"],"score":1}}

The selected server recipe determines which inference payload and feedback fields it needs. The importer preserves IDs and payloads; it does not run inference or convert arbitrary dataset schemas.

  • Reads incrementally, limiting each request by --batch-size (default 128) and --max-batch-bytes (default 524288). Requests must stay below 1 MiB and contain at most 1000 records. Each source line must fit the byte limit.
  • Reuses the HTTP connection and retries transient failures with backoff (--retries, default 3). It sends unchanged record IDs on retry.
  • Saves acknowledged byte offsets to FILE.reef-import.json, or --progress PATH. Re-run the same command after interruption. A full bounded-memory checksum pass verifies the source on each invocation before seeking to saved progress.
  • Binds the checkpoint to the file checksum, service URL and scenario, and locks it against concurrent importers. Keep the source immutable. Checkpoints contain no token or record payloads. POSIX file locking requires Linux/macOS.
  • Stops on permanent failures without advancing the failed batch's checkpoint. Previously acknowledged batches remain stored. Lost responses can be retried safely because the server deduplicates stable record IDs.

Python callers can use reef_client.record_import.import_records_file(Path(...), url=..., scenario=...). It returns the cumulative number of acknowledged source rows, including existing records; it does not count completed training samples. After import, continue sending chat/report traffic to the same scenario. Import completion means records were acknowledged, not that training has finished.

Metadata

Release files for reef-client 0.3.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 reef-client 0.3.0
File Size Uploaded Provenance Actions
reef_client-0.3.0.tar.gz 30.8 kB With provenance Details for reef_client-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for reef-client 0.3.0
File Interpreter ABI Platform Actions
reef_client-0.3.0-py3-none-any.whl Python 3 none any Details for reef_client-0.3.0-py3-none-any.whl

Total release size: 57.5 kB

Release files / reef_client-0.3.0.tar.gz

Download URL reef_client-0.3.0.tar.gz
Size 30.8 kB
Tags Source
SHA-256 checksum
How to use checksums
729771dad498f2141b8ed530ae85cf8048b962c37fc54098ba176225c7094ff8
BLAKE2b-256 checksum
How to use checksums
fb7dba7a838fc2a699e4669f0c4aa818f4db1a9bba2a215603149c6ce880bf82
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 18, 2026.

Transparency log

Release files / reef_client-0.3.0-py3-none-any.whl

Download URL reef_client-0.3.0-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74f28edd2742f6d3ce3d3b1cd30eee8a44cc730634f29ba423d0d31b0281f700
BLAKE2b-256 checksum
How to use checksums
d5a9fdbda1c9701745a40c3f6966de4bfad7499d2241e6795121169f49079221
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 18, 2026.

Transparency log

Security for reef-client 0.3.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for reef_client-0.3.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 Oct 18, 2026.

Transparency log

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