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).
  • harness.py syncs an agent's harness with Reef (reef-client harness connect|run|sync|status|disconnect): it runs the agent with the artifact Reef serves as a layer over the person's own configuration, which it never writes. reef-client harness connect sets a machine up in one command: it asks at most for the token and, when Reef serves several, the harness; it installs the agent when it is missing, and makes the agent's own command run through Reef. The Reef deployment decides the agent (its evolution.adapter). Each run syncs before the agent starts. When the agent exits, a background process sends what the session changed in the layer, such as Claude Code's memory, so the terminal is back at once. While a training step runs, Reef refuses the send, and the change waits for the next run or sync.
  • 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 10 MiB and contain at most 1000 records. Each source line must fit the byte limit. A Reef service older than Reef PR #846 accepts requests below 1 MiB only.
  • 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.4.3

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.4.3
File Size Uploaded Provenance Actions
reef_client-0.4.3.tar.gz 47.7 kB With provenance Details for reef_client-0.4.3.tar.gz

Built distribution (wheel)

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

Total release size: 86.5 kB

Release files / reef_client-0.4.3.tar.gz

Download URL reef_client-0.4.3.tar.gz
Size 47.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6fc6cb1df4e9203a698c289449c0ba995f05e085f7d1637c99317efb4266654e
BLAKE2b-256 checksum
How to use checksums
aabfa320a2d3ac58a8b47bc8b80e172f9b310d2924644052ded2b74aa248f457
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 26, 2026.

Transparency log

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

Download URL reef_client-0.4.3-py3-none-any.whl
Size 38.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6ce09607a1e430e8e1d099b0615e83520199050af80e83c1fd951cfaad5b551
BLAKE2b-256 checksum
How to use checksums
6f72c55035f7fcf8ef0c1369dd43fa685f7bd659cc855a6fab115b558811661f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 26, 2026.

Transparency log

Security for reef-client 0.4.3

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.4.3.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 Nov 26, 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