Skip to main content

loops-tinker

Drop-in compatibility shim that provides the tinker package namespace backed by the loops SDK.

Installation

pip install loops-tinker

Usage

Existing code that uses import tinker works without modification:

import tinker

service_client = tinker.ServiceClient(training_project_id="proj_abc123")
training_client = service_client.create_lora_training_client(
    base_model="Qwen/Qwen3-8B", rank=16,
)
sampling_client = service_client.create_sampling_client(model="Qwen/Qwen3-8B")

All types are also available under tinker.types:

from tinker.types import SamplingParams, Datum, ModelInput
from tinker.types.tensor_data import TensorData

Using with tinker-cookbook

tinker-cookbook depends on tinker, but you can swap in loops-tinker using uv's override-dependencies to prevent the original tinker from being installed.

First add the override to pyproject.toml before installing any dependencies (there is no CLI command for this). If tinker-cookbook is added first, the original tinker gets installed and its files conflict with loops-tinker:

[tool.uv]
override-dependencies = [
    "tinker ; python_version < '0'",
]

Then add the dependencies:

uv init
uv add tinker-cookbook
uv add "loops @ git+https://github.com/basetenlabs/loops#subdirectory=loops"
uv add "loops-tinker @ git+https://github.com/basetenlabs/loops#subdirectory=loops-tinker"

loops is a transitive dep of loops-tinker but must be listed directly because [tool.uv.sources] only applies to direct dependencies. This won't be needed once loops is published to PyPI.

The tinker namespace will be provided by loops-tinker instead of the original package.

Token provenance

Enable recording when creating the sampling client, as in Tinker:

sampling_client = training_client.save_weights_and_get_sampling_client(
    record_stability_info=True,
)
response = await sampling_client.sample_async(
    prompt=prompt,
    num_samples=1,
    sampling_params=sampling_params,
    include_routed_experts=True,
)
sequence_id = response.sequences[0].sequence_id

record_stability_info defaults to False. Both sync and async versions of ServiceClient.create_sampling_client, TrainingClient.create_sampling_client, and TrainingClient.save_weights_and_get_sampling_client accept it. Every sample from that client records data; there is no per-sample recording option.

Attach PromptProvenanceSpan and SampledProvenanceSpan references with Datum.with_provenance(model_input=..., loss_fn_inputs=...). The two lists tile the input tokens and target-token rows respectively. Token data stays on the server; the client passes only sequence references and spans.

Paired clients share the trainer's run and session. Standalone clients record under their service session; trainers in that same session can consume those references. The sampler must support route capture and the trainer must enable R3 replay. include_routed_experts=True requests the route payload; it is a Loops extension. The recording interface matches Tinker, but StableReinforce and top-k recording are not implemented.

Retention differs from Tinker: Loops stores generic sampling records and payloads in S3 or Cannery without implementing Tinker's inactivity expiry. Retention is controlled by storage lifecycle policies, not the client session lifetime. These records support R3; they are not StableReinforce stability artifacts.

Training references use Datum.with_provenance(...) exclusively. Route payload locations are stored in sequence records, not returned on SampledSequence. include_routed_experts=True requires a client created with record_stability_info=True; it selects the moe.routes payload for that record.

Recording uses the existing service session, independently of sampler affinity. See the native SDK provenance requirements for the server versions provenance needs.

Metadata

Release files for baseten-loops-tinker 0.18.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 baseten-loops-tinker 0.18.0
File Size Uploaded Provenance Actions
baseten_loops_tinker-0.18.0.tar.gz 92.1 kB With provenance Details for baseten_loops_tinker-0.18.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for baseten-loops-tinker 0.18.0
File Interpreter ABI Platform Actions
baseten_loops_tinker-0.18.0-py3-none-any.whl Python 3 none any Details for baseten_loops_tinker-0.18.0-py3-none-any.whl

Total release size: 105.0 kB

Release files / baseten_loops_tinker-0.18.0.tar.gz

Download URL baseten_loops_tinker-0.18.0.tar.gz
Size 92.1 kB
Tags Source
SHA-256 checksum
How to use checksums
96e25902ab8b925ea0af5a24cbc9e3ccd2034204c09c4be92bcec7b3d341ec33
BLAKE2b-256 checksum
How to use checksums
502423072e09834cc513ea6dad434307d0bd36cbfb0815c9d5b6e71c55973c43
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 4, 2026.

Transparency log

Release files / baseten_loops_tinker-0.18.0-py3-none-any.whl

Download URL baseten_loops_tinker-0.18.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a12ec0736d198f417a6bf427373d9af8b0e30a29548f211389c9cca6aba0295f
BLAKE2b-256 checksum
How to use checksums
c5383cbc101db6c9f69a9c2cb31dbf65a3c4f2b54fe4156fc03b3b4f4a3aaaea
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 4, 2026.

Transparency log

Security for baseten-loops-tinker 0.18.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 baseten_loops_tinker-0.18.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 4, 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