Skip to main content

Reef Python SDK

Server-side Python client for Reef. Product servers authenticate with an InkPass API key or service credential. Provider credentials remain inside Reef.

Install

pip install reef-sdk

Create a typed decision

The decision client accepts choice, score, and noul questions in one request. Use the rolling Jev alias to follow the latest release, or use a pinned model ID when reproducibility matters.

import os

from reef_sdk import DecisionCreateRequest, ReefClient, ReefConfig


request: DecisionCreateRequest = {
    "state": {
        "ticket": "I upgraded to Pro, still see Free, and was charged.",
    },
    "questions": {
        "route": {
            "type": "choice",
            "instructions": "Choose the team that should handle this ticket.",
            "criteria": {
                "billing": "Billing, subscription, or charge issue",
                "technical": "Technical product malfunction",
                "account": "Account access or identity issue",
            },
        },
        "urgency": {
            "type": "score",
            "instructions": "Score the urgency of this ticket.",
            "criteria": ["low", "medium", "high"],
        },
        "billing_related": {
            "type": "noul",
            "instructions": "Does this ticket concern billing?",
        },
    },
    "requested_model": "~typesafe/jev-latest",
    "model_policy_id": "decision_model_default",
}

with ReefClient(
    ReefConfig(
        "https://reef.example.com",
        os.environ["REEF_SERVICE_API_KEY"],
        credential_kind="service",
    )
) as reef:
    decision = reef.decisions.create(
        "support-product",
        request,
        idempotency_key="ticket-4821-routing-v1",
    )

if decision["status"] == "completed":
    route = decision["answers"]["route"]
    if route["type"] == "choice":
        print(route["choice"], route["confidence"])

DecisionResponse is a status-discriminated union. Completed responses require typed answers, provider metadata, and usage. The SDK rejects a malformed successful response instead of passing an untyped dictionary to application code.

Runtime requirements

  • Call the SDK from a product backend. Do not expose Reef credentials to browser code.
  • The principal needs agent_decision:execute.
  • The product needs an active OpenRouter provider configuration and an execution policy whose model policy requires the decisions capability.
  • Reuse an idempotency key only for the same request. Reef returns the stored result without a second provider call.

See Reef decision requests for policy setup, the HTTP contract, errors, accounting, and production verification evidence.

The client also exposes configuration, prompts, conversations, files, runs, approvals, tools, usage, memory, and evidence. Mutations require caller-owned idempotency keys. The SDK never accepts provider credentials and does not retry mutations outside Reef.

Metadata

Release files for reef-sdk 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-sdk 0.3.0
File Size Uploaded Provenance
reef_sdk-0.3.0.tar.gz 14.6 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 25.6 kB

Release files / reef_sdk-0.3.0.tar.gz

Download URL reef_sdk-0.3.0.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a7b9342cb96bc29b567a6668118843690b6b499abc15467f7552679c2dd6c7a0
BLAKE2b-256 checksum
How to use checksums
63be4bc2c37fa2007e77358bf5dde5afaa796a7d612c9f45d8db05dad3fe8c0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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 / reef_sdk-0.3.0-py3-none-any.whl

Download URL reef_sdk-0.3.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28ebb725c3f3e1fe067dd697a4dabbc168713d6ce1a6846a99a5513d3227197e
BLAKE2b-256 checksum
How to use checksums
4cae9b148fdf1a5dd9c07aa8067e72bd32c7e13c094336b0894af7f082f09708
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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 reef-sdk 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.

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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

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