Skip to main content

CAT Cafe SDK

Python SDK for CAT Cafe - Continuous Alignment Testing platform for LLM observability.

Installation

pip install cat-cafe-client

Compatibility: the client version tracks the CAT Cafe server API it targets. cat-cafe-client 0.11.0 targets the cat-cafe server 0.11.0 API, and still works with 0.10.x servers by falling back to their flat /api/... routes.

Quick Start

from cat.cafe.client import CATCafeClient, DatasetImport, DatasetExample

# Initialize the client
client = CATCafeClient(base_url="http://localhost:8000")

# Create a dataset with examples in one call
dataset = DatasetImport(
    name="My Test Dataset",
    description="Sample dataset for testing",
    examples=[
        DatasetExample(
            input={"messages": [{"role": "user", "content": "What's the weather?"}]},
            expected={"messages": [{"role": "assistant", "content": "Weather info"}]},
            metadata={"tags": ["weather"]},
        )
    ],
)
result = client.import_dataset(dataset)
dataset_id = result["dataset"]["id"]

From here, run your AI system against the dataset and stream results to an experiment -- see "Manual Experiment Control" below for the full flow.

This SDK is the core HTTP client for CAT Cafe's dataset, experiment, and trace-scoring APIs. It intentionally does not include a task/evaluator runner -- for the higher-level workflow of defining a task function, evaluators, and running them against a dataset, use cat-experiments instead:

pip install "cat-experiments[cat-cafe]"

cat-experiments run experiment.py --dataset data.jsonl --storage cat-cafe

Core Classes

CATCafeClient

The main client for interacting with CAT Cafe:

client = CATCafeClient(base_url="http://localhost:8000")

Dataset Models

  • DatasetImport: For creating new datasets with examples
  • DatasetExample: Individual examples in a dataset
  • Dataset: Structured dataset object returned from API
  • Example: Individual example object returned from API

Experiment Models

  • Experiment: Experiment configuration
  • ExperimentResult: Results from running experiments

Key Methods

Dataset Operations

# Import a complete dataset
result = client.import_dataset(dataset_import)

# Add examples to an existing dataset (single or batch)
example_id = client.add_dataset_example(dataset_id, example)
client.add_dataset_examples(dataset_id, [example_a, example_b])

# Fetch dataset as structured object
dataset = client.fetch_dataset(dataset_id)

# Find dataset by name
dataset = client.fetch_dataset_by_name("My Dataset")

# List all datasets
datasets = client.list_datasets()

Experiment Operations

# Start an experiment tied to a dataset
experiment_id = client.start_experiment(experiment_config)

# Stream runs as you produce them
client.create_run(experiment_id, {...})
client.append_evaluation(experiment_id, run_id, {...})

# Mark it done
client.complete_experiment(experiment_id)

# Compare two experiments on the same dataset
comparison = client.compare_experiments(experiment_a_id, experiment_b_id)

Manual Experiment Control

from cat.cafe.client import CATCafeClient, Experiment

client = CATCafeClient(base_url="http://localhost:8000")

# Create experiment configuration
experiment_config = Experiment(
    name="Manual Experiment",
    description="Step-by-step experiment",
    dataset_id=dataset_id,
    tags=["manual", "testing"],
)

# Start experiment
experiment_id = client.start_experiment(experiment_config)

# Run your tests and stream results
dataset = client.fetch_dataset(dataset_id)

for example in dataset.examples:
    output = call_my_ai_system(example.input)  # however you invoke your system under test

    client.create_run(
        experiment_id,
        {
            "run_id": f"run-{example.id}",
            "example_id": example.id,
            "input_data": {"input": example.input},
            "output": dict(example.expected) if isinstance(example.expected, dict) else example.expected,
            "actual_output": output,
        },
    )
    client.append_evaluation(
        experiment_id,
        f"run-{example.id}",
        {"evaluator_name": "manual_score", "score": 0.8},
    )

# Complete experiment
client.complete_experiment(experiment_id, {"total_examples": len(dataset.examples)})

Requirements

  • Python 3.10+
  • httpx
  • CAT Cafe server running (default: http://localhost:8000)

License

Apache License 2.0 — see the LICENSE file in the cat-cafe repository for details.

Metadata

Release files for cat-cafe-client 0.11.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 cat-cafe-client 0.11.0
File Size Uploaded Provenance Actions
cat_cafe_client-0.11.0.tar.gz 10.7 kB With provenance Details for cat_cafe_client-0.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cat-cafe-client 0.11.0
File Interpreter ABI Platform Actions
cat_cafe_client-0.11.0-py3-none-any.whl Python 3 none any Details for cat_cafe_client-0.11.0-py3-none-any.whl

Total release size: 21.8 kB

Release files / cat_cafe_client-0.11.0.tar.gz

Download URL cat_cafe_client-0.11.0.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
023e841a977d7debac0780ff540a552b427bdbbc73d1e7c760b3b66048f38827
BLAKE2b-256 checksum
How to use checksums
b32a3f3640d453a11da273ce02810ca4ab13a37df9a0aaed6e43ca6be6227c90
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 17, 2026.

Transparency log

Release files / cat_cafe_client-0.11.0-py3-none-any.whl

Download URL cat_cafe_client-0.11.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdf091d27398f5332835dfa1e7704ab627721a5268cddc312c145597e20da399
BLAKE2b-256 checksum
How to use checksums
41cfc8708a321cb69c38dc859b7971ace11bd3064a7207d5dec7941e15668519
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 17, 2026.

Transparency log

Security for cat-cafe-client 0.11.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 cat_cafe_client-0.11.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 Nov 17, 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