CheckpointProvider (its name, its facts, the hooks the
kit applies its features through); the kit’s built-in stores register at this package’s import. The
owner-declared thread retention, the finished-thread ledger calls, the live-thread filter registry and
the pieces a store’s registration builds on (the shared-value chunker and resolver, the value store
and ledger protocols, the msgpack value encoding) are exported here.
CHECKPOINT_STORE_FORMAT_GENERATION
tai42_kit.llm.checkpoint.store_format.CHECKPOINT_STORE_FORMAT_GENERATION
REDIS_CHECKPOINT_NOT_CONFIGURED_MESSAGE
tai42_kit.llm.checkpoint.stores.redis.REDIS_CHECKPOINT_NOT_CONFIGURED_MESSAGE
REFERENCING_TYPE_SUFFIX
tai42_kit.llm.checkpoint.checkpoint.REFERENCING_TYPE_SUFFIX
ChannelStorage
tai42_kit.llm.checkpoint.providers.ChannelStorage
CheckpointCodec
tai42_kit.llm.checkpoint.envelope.CheckpointCodec
inline_form.
Members
dumps_typed
tai42_kit.llm.checkpoint.envelope.CheckpointCodec.dumps_typed
obj through inner.
Parameters
inline_form
tai42_kit.llm.checkpoint.envelope.CheckpointCodec.inline_form
(type, bytes) the saver stores for a value inner encoded as encoded.
Parameters
loads_typed
tai42_kit.llm.checkpoint.envelope.CheckpointCodec.loads_typed
data through inner.
Parameters
CheckpointProvider
tai42_kit.llm.checkpoint.providers.CheckpointProvider
Members
open
tai42_kit.llm.checkpoint.providers.CheckpointProvider.open
None conn string means the store’s
default connection, or raises naming the setting to set.
Parameters
saver
tai42_kit.llm.checkpoint.providers.CheckpointProvider.saver
resource, as the library builds it; the kit guards and wraps it.
Parameters
saver_with_waiting
tai42_kit.llm.checkpoint.providers.CheckpointProvider.saver_with_waiting
resource whose writes carry waiting_minutes as their key TTL, with its value store.
The value store’s writes carry the same TTL over the store’s own key space. Required when the
store’s retention is native_ttl.
Parameters
serializer
tai42_kit.llm.checkpoint.providers.CheckpointProvider.serializer
saver and the codec it installs around it.
The codec writes and reads back every value the saver stores, a value the kit encoded ahead of
the saver included. compress_threshold is LLM_PROVIDER_CHECKPOINT_INLINE_COMPRESS_BYTES.
Default: the saver’s own serializer and no codec.
Parameters
value_encoding
tai42_kit.llm.checkpoint.providers.CheckpointProvider.value_encoding
saver carries the guarded serializer.
Parameters
prepare_checkpoint
tai42_kit.llm.checkpoint.providers.CheckpointProvider.prepare_checkpoint
facts’ channel_storage. A store overrides it
only with knowledge of its own saver’s storage.
Parameters
prepare_writes
tai42_kit.llm.checkpoint.providers.CheckpointProvider.prepare_writes
recorded_generation
tai42_kit.llm.checkpoint.providers.CheckpointProvider.recorded_generation
None when it records none.
Parameters
record_generation
tai42_kit.llm.checkpoint.providers.CheckpointProvider.record_generation
generation unless one is recorded: concurrent first builds keep the first.
Parameters
holds_checkpoints
tai42_kit.llm.checkpoint.providers.CheckpointProvider.holds_checkpoints
CheckpointProviderFacts
tai42_kit.llm.checkpoint.providers.CheckpointProviderFacts
CheckpointReferenceError
tai42_kit.llm.checkpoint.chunking.CheckpointReferenceError
CheckpointResource
tai42_kit.llm.checkpoint.checkpoint.CheckpointResource
provider::conn_string checkpoint store.
handle is what the store’s registration builds its saver on. ledger is the store’s
finished-thread ledger and values its per-thread value store, both kept in the same store as
the checkpoints.
Attributes
CheckpointSerializationError
tai42_kit.llm.checkpoint.checkpoint.CheckpointSerializationError
MsgpackEncodeError into this typed error so a value
the serializer cannot encode fails loudly — never a silent pickle fallback, never an
opaque engine crash. The checkpoint guard owns the storage integer range: an integer
outside the native msgpack range [-2**63, 2**64-1] has no encoding, and the message
NAMES the offending path. A store’s codec raises it for a value it cannot store
faithfully and for a stored value it cannot decode.
CheckpointStoreFormatError
tai42_kit.llm.checkpoint.store_format.CheckpointStoreFormatError
CheckpointValueRef
tai42_kit.llm.checkpoint.chunking.CheckpointValueRef
digest: the SHA-256 (hex) of the value’s encoding. size: the encoding’s length in bytes.
closure: the digests of every reference inside that value, transitively.
Attributes
CheckpointValueStore
tai42_kit.llm.checkpoint.value_store.CheckpointValueStore
Members
touch
tai42_kit.llm.checkpoint.value_store.CheckpointValueStore.touch
digests of thread_id; return those it does not hold.
Parameters
put
tai42_kit.llm.checkpoint.value_store.CheckpointValueStore.put
blobs (by digest) for thread_id.
Parameters
get
tai42_kit.llm.checkpoint.value_store.CheckpointValueStore.get
digests of thread_id; a digest it does not hold is absent.
Parameters
held_digests
tai42_kit.llm.checkpoint.value_store.CheckpointValueStore.held_digests
thread_id holds.
Parameters
delete_thread
tai42_kit.llm.checkpoint.value_store.CheckpointValueStore.delete_thread
thread_id holds.
Parameters
CheckpointWrite
tai42_kit.llm.checkpoint.providers.CheckpointWrite
saver is the store’s own saver, values the value store the write’s large values go to,
encoding the store’s value encoding and threshold the encoded size above which a value is
stored once (a preparation runs only where sharing is on).
Attributes
Members
chunker
tai42_kit.llm.checkpoint.providers.CheckpointWrite.chunker
inline_form
tai42_kit.llm.checkpoint.providers.CheckpointWrite.inline_form
(type, bytes) to hand the saver for a value the store’s encoding encoded as encoded.
It is the form the saver’s guarded serializer stores, so the saver reads it back.
Parameters
store
tai42_kit.llm.checkpoint.providers.CheckpointWrite.store
digests and store the missing ones from blobs, in their store form.
A digest the value store does not hold and blobs does not encode raises
CheckpointReferenceError naming the thread and the digest.
Parameters
FinishedThreadLedger
tai42_kit.llm.checkpoint.ledger.FinishedThreadLedger
Members
start
tai42_kit.llm.checkpoint.ledger.FinishedThreadLedger.start
thread_ids: remove their finished mark and record their declared waiting.
The waiting is recorded wherever the store’s saver does not carry it as a key TTL; None
(the platform’s) removes a recorded one. A store whose saver stamps the waiting as the TTL of
every key it writes records nothing.
Parameters
mark
tai42_kit.llm.checkpoint.ledger.FinishedThreadLedger.mark
thread_ids as finished and deletable at or after due_at (a later mark moves it).
Parameters
finished_before
tai42_kit.llm.checkpoint.ledger.FinishedThreadLedger.finished_before
limit thread ids due at or before cutoff, earliest due first.
Parameters
forget
tai42_kit.llm.checkpoint.ledger.FinishedThreadLedger.forget
thread_ids from the ledger: their finished mark and their declared waiting.
Parameters
declared_waiting
tai42_kit.llm.checkpoint.ledger.FinishedThreadLedger.declared_waiting
thread_ids that have one.
Parameters
stale_threads
tai42_kit.llm.checkpoint.ledger.FinishedThreadLedger.stale_threads
now, by id.
A thread’s waiting retention is the one its owner declared at run start, else
default_minutes; its newest checkpoint is the newest in any of its namespaces. A store with
an index of its own answers from it; otherwise saver (the store’s own) is walked. now
must be timezone-aware.
Parameters
LiveThreadFilter
tai42_kit.llm.checkpoint.liveness.LiveThreadFilter
MsgpackValueEncoding
tai42_kit.llm.checkpoint.value_encoding.MsgpackValueEncoding
Members
encode
tai42_kit.llm.checkpoint.value_encoding.MsgpackValueEncoding.encode
(type, bytes) the library serializer writes for value.
Parameters
reference
tai42_kit.llm.checkpoint.value_encoding.MsgpackValueEncoding.reference
ref envelope, a plain dictionary in the msgpack blob.
Parameters
as_reference
tai42_kit.llm.checkpoint.value_encoding.MsgpackValueEncoding.as_reference
ref envelope dictionary.
Parameters
store_form
tai42_kit.llm.checkpoint.value_encoding.MsgpackValueEncoding.store_form
decode
tai42_kit.llm.checkpoint.value_encoding.MsgpackValueEncoding.decode
blob.
Parameters
PreEncodedCheckpoint
tai42_kit.llm.checkpoint.checkpoint.PreEncodedCheckpoint
encoded as it is. references: as
PreEncodedValue.
Attributes
Members
copy
tai42_kit.llm.checkpoint.checkpoint.PreEncodedCheckpoint.copy
PreEncodedValue
tai42_kit.llm.checkpoint.checkpoint.PreEncodedValue
encoded as it is.
references: the value holds a reference to a shared value, so its type tag carries
REFERENCING_TYPE_SUFFIX.
Attributes
RetentionMode
tai42_kit.llm.checkpoint.providers.RetentionMode
SharedSnapshot
tai42_kit.llm.checkpoint.chunking.SharedSnapshot
_DeltaSnapshot whose payload holds a reference.
StoredBlob
tai42_kit.llm.checkpoint.value_store.StoredBlob
ThreadRetention
tai42_kit.llm.checkpoint.retention.ThreadRetention
waiting_minutes: after its last write, while its owner may still continue it.
finished_minutes: after its owner marked it finished.
Every value is checked when it is built, so every seam that takes one (the saver views, the
finished-thread ledger, the park horizon) holds the platform’s ceiling. Raises
ThreadRetentionError for a value that is not positive, a value above the platform’s
for its horizon, or a finished longer than the waiting.
Attributes
ThreadRetentionError
tai42_kit.llm.checkpoint.retention.ThreadRetentionError
UnknownCheckpointProviderError
tai42_kit.llm.checkpoint.providers.UnknownCheckpointProviderError
ValueChunker
tai42_kit.llm.checkpoint.chunking.ValueChunker
threshold into blobs; None keeps every value inline.
blobs maps every digest the chunked values reference, at any depth, to its encoding.
Attributes
Members
chunk
tai42_kit.llm.checkpoint.chunking.ValueChunker.chunk
value with its sub-values above the threshold replaced by references, and its encoding.
Parameters
ValueEncoding
tai42_kit.llm.checkpoint.chunking.ValueEncoding
Members
encode
tai42_kit.llm.checkpoint.chunking.ValueEncoding.encode
(type, bytes) the store’s serializer writes for value.
Parameters
reference
tai42_kit.llm.checkpoint.chunking.ValueEncoding.reference
ref names.
Parameters
as_reference
tai42_kit.llm.checkpoint.chunking.ValueEncoding.as_reference
value is as the store reads it back, or None when it is none.
Parameters
store_form
tai42_kit.llm.checkpoint.chunking.ValueEncoding.store_form
encoded.
Parameters
decode
tai42_kit.llm.checkpoint.chunking.ValueEncoding.decode
blob holds; a blob whose encoding is not ref.size long raises.
Parameters
as_utc
tai42_kit.llm.checkpoint.ledger.as_utc
at in UTC; a naive time raises ValueError.
Parameters
checkpoint_park_horizon
tai42_kit.llm.checkpoint.providers.checkpoint_park_horizon
provider; None when the store does not outlive the process.
On a durable provider a parked thread’s last write is its park checkpoint, and the thread is kept its
waiting retention after it — the owner’s declared one, else the platform’s — so a park may wait at
most that long.
Parameters
checkpoint_provider
tai42_kit.llm.checkpoint.providers.checkpoint_provider
name; an unknown name raises UnknownCheckpointProviderError.
Parameters
checkpoint_provider_facts
tai42_kit.llm.checkpoint.providers.checkpoint_provider_facts
provider; an unknown name raises UnknownCheckpointProviderError.
Parameters
checkpoint_providers
tai42_kit.llm.checkpoint.providers.checkpoint_providers
create_checkpoint_resource
tai42_kit.llm.checkpoint.checkpoint.create_checkpoint_resource
provider names, and check its store format.
A None conn string is the store’s default connection (its registration raises, naming the
setting, when it has none). A store holding data written in an older format raises
CheckpointStoreFormatError and is closed.
The resource is cached for the life of the app by the registry; its connections stay open.
Parameters
create_saver_with_waiting
tai42_kit.llm.checkpoint.checkpoint.create_saver_with_waiting
resource whose writes carry waiting_minutes as their key TTL, guarded and wrapped.
It reads, writes and deletes what the resource’s own saver does, its shared values included; only
the TTL it stamps differs.
Parameters
durable_checkpoint_providers
tai42_kit.llm.checkpoint.providers.durable_checkpoint_providers
envelope_reference
tai42_kit.llm.checkpoint.envelope.envelope_reference
value is when it is a ref envelope as stored; None when it is not one.
Parameters
get_saver_from_resource
tai42_kit.llm.checkpoint.checkpoint.get_saver_from_resource
resource: the store’s saver, guarded and wrapped.
This is the one place a saver is built for a store’s own retention, so every saver serializes
through the guard and stores its large values once where sharing is on.
Parameters
live_thread_filters
tai42_kit.llm.checkpoint.liveness.live_thread_filters
live_threads
tai42_kit.llm.checkpoint.liveness.live_threads
mark_threads_active
tai42_kit.llm.checkpoint.ledger.mark_threads_active
thread_ids out of the ledger before a run starts on them, recording retention’s waiting.
retention is the owner’s declaration for the threads (None: the platform’s); the store
records its waiting where the waiting horizon is swept. provider and conn_string resolve
as in mark_threads_finished.
Parameters
mark_threads_finished
tai42_kit.llm.checkpoint.ledger.mark_threads_finished
thread_ids finished now, in the ledger of the store that holds them.
They become deletable their finished retention after now: retention’s (the owner’s
declaration, see resolve_retention), else the
platform’s. provider and conn_string resolve independently: None is the deployment’s
configured checkpoint provider, respectively its configured connection string. A caller that
checkpoints on a per-run provider passes it. An empty sequence is a no-op; a store error
propagates.
Parameters
platform_retention
tai42_kit.llm.checkpoint.retention.platform_retention
reference_envelope
tai42_kit.llm.checkpoint.envelope.reference_envelope
ref envelope a checkpoint stores in place of the shared value ref names.
Parameters
register_checkpoint_provider
tai42_kit.llm.checkpoint.providers.register_checkpoint_provider
cls under its name; usable as a class decorator.
Raises TypeError for a class that is not a CheckpointProvider, misses a hook or
declares facts that are not CheckpointProviderFacts, and ValueError for a malformed
name, a native_ttl store without saver_with_waiting, or a name
another class holds. The same class registered again is a no-op.
register_live_thread_filter
tai42_kit.llm.checkpoint.liveness.register_live_thread_filter
fn as owner’s live-thread filter; an owner registers once.
Parameters
resolve_references
tai42_kit.llm.checkpoint.chunking.resolve_references
value with every reference inside it, and inside the values it references, resolved.
The referenced blobs, nested ones included (a reference names them), are fetched in one round trip.
Every place that references a value receives its own object, as if the value were stored there. A
blob the store does not hold, or one whose encoding is not the length its reference records, raises
CheckpointReferenceError; nothing is returned partially resolved.
Parameters
resolve_retention
tai42_kit.llm.checkpoint.retention.resolve_retention
ThreadRetention), which raises
ThreadRetentionError for a declaration out of bounds.
Parameters
resolve_tuple
tai42_kit.llm.checkpoint.chunking.resolve_tuple
tup with every reference in its checkpoint and its pending writes resolved.
Parameters
shared_value_threshold
tai42_kit.llm.checkpoint.providers.shared_value_threshold
provider stores a checkpoint sub-value once per thread.
None when every value is stored inline. LLM_PROVIDER_CHECKPOINT_SHARED_VALUES decides when
it is set; unset, a store that copies channel values into every checkpoint stores them once, and a
store that keeps a channel once per version does not.
Parameters
stale_threads_by_walk
tai42_kit.llm.checkpoint.ledger.stale_threads_by_walk
ts of every thread, in every namespace, through
saver.alist(None), and compares it with the thread’s declared_waiting (looked up page by
page), else default_minutes, before now.
Parameters

