TinkerFin Contracts
tinkerfin-contracts provides protocol-neutral run identities and Runtime observation
interfaces so integrations can share execution data through one common contract.
Installation
pip install tinkerfin-contracts
Run identity
from tinkerfin_contracts import RunIdentity, ThreadIdentity
identity = RunIdentity(namespace="company-a", thread_id="thread-1", run_id="run-1")
assert identity.thread == ThreadIdentity(namespace="company-a", thread_id="thread-1")
The namespace is required and limited to 128 Unicode characters; thread and run IDs
are limited to 1,024 characters each. All identifiers are non-empty, immutable,
case-sensitive UTF-8 strings without surrounding whitespace. Hosts choose namespace
ownership and enforce authorization. JSON uses flat namespace, threadId, and
runId fields; the derived thread property is not serialized.
Runtime observers
RuntimeObserver.open_run() creates one request-scoped
RunObservationSession. The session receives validated run and Native observation
models, owns any work it starts, exposes asynchronous failure notification, and closes
idempotently at the Runtime boundary.
RunSourceContext carries the canonical identity, ordinary/branch/resume/abandon input
kind, parent lineage, Runtime mode, finite input/config snapshots, public resume
summaries, and Runtime-owned private state keys.
The observation union contains:
- Run start, input, resume-checkpoint, Observer-failure, terminal, and close values;
- validated Native message, task, root/subgraph state, interrupt, and declared extra-mode values;
- stable full graph namespace, IDs, UTC time, and monotonic clock evidence.
identity.namespace identifies the application-defined isolation scope.
graph_namespace identifies a position within the execution graph; () is the root.
Observation JSON uses graphNamespace for that position.
Runtime observers receive validated models rather than captured Python repr.
JSON fields reject non-finite numbers during Python and JSON validation. Model fields
cannot be reassigned, but nested dictionaries and lists remain mutable. Treat received
evidence as read-only; the Runtime supplies an independent copy to each observer.
Command(resume=...) remains invocation input and is represented only through the
protocol-neutral Run source summary and checkpoint Observation.
Document collections
tinkerfin_contracts.storage.ConditionalStore lets consumers share a collection
without depending on a provider's query models. asearch_exact(namespace, limit=100, offset=0) returns independent DocumentSnapshot values containing
the key, finite JSON value and UTC creation/update times. Descendant namespaces
are excluded before pagination; pages sort by update time descending and then key.
acompare_and_set(namespace, key, expected=observed, value=replacement) compares
the complete JSON value and commits one document atomically across processes.
Object member order does not affect the condition; array order and scalar types
do. expected=None requires absence and value=None deletes. A conflict returns
False without changing data. Consumers retain their draft and reread before
retrying. Providers define validation and resource failures; these operations
use borrowed resources and do not transfer ownership to consumers.
Documentation
License
Apache License 2.0. See LICENSE.
Metadata
Release files for tinkerfin-contracts 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tinkerfin_contracts-0.1.1.tar.gz | 22.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tinkerfin_contracts-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.5 kB
Release files / tinkerfin_contracts-0.1.1.tar.gz
| Download URL | tinkerfin_contracts-0.1.1.tar.gz |
|---|---|
| Size | 22.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2fba2dbe806ce3445fed177f26956df4467a5e1812b78e51183239a01d9f4a6b
|
|
BLAKE2b-256 checksum How to use checksums |
712d185bdf8c62bfc9945e30c8da7b1728a3530ca40c3035ddedc340bd07f439
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"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 / tinkerfin_contracts-0.1.1-py3-none-any.whl
| Download URL | tinkerfin_contracts-0.1.1-py3-none-any.whl |
|---|---|
| Size | 23.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9340aa66c71457c434ccd903adc3d9249bbdb2523e88a0e778f633b1b75ecd5e
|
|
BLAKE2b-256 checksum How to use checksums |
ee77229950ad66ed50ce4a6f59880f26768d49011d131a25602add8870472d59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"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}
|