Skip to main content
Checkpoint savers for LLM graph state: the provider registry, the per-loop registry, and the retention seams. A checkpoint store is a registration of 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
A codec the serialization guard installs around a saver’s serializer. Every value the saver stores is written by the codec, and read back by it: a value the kit encoded ahead of the saver takes the codec’s inline_form.

Members

dumps_typed

tai42_kit.llm.checkpoint.envelope.CheckpointCodec.dumps_typed
Encode obj through inner. Parameters

inline_form

tai42_kit.llm.checkpoint.envelope.CheckpointCodec.inline_form
The (type, bytes) the saver stores for a value inner encoded as encoded. Parameters

loads_typed

tai42_kit.llm.checkpoint.envelope.CheckpointCodec.loads_typed
Decode data through inner. Parameters

CheckpointProvider

tai42_kit.llm.checkpoint.providers.CheckpointProvider
One checkpoint store’s registration: its name, its facts, and the hooks the kit applies its features through. The kit calls the hooks and applies everything else itself, the same way for every store: the serialization guard, large values stored once per thread, the store-format gate, the retention views and the sweep. A hook receives the settings it needs as arguments. Attributes

Members

open

tai42_kit.llm.checkpoint.providers.CheckpointProvider.open
Open the store: its handle, its finished-thread ledger and its per-thread value store, set up. Returns the resource and the function that closes it. A 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
The store’s saver over 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
A saver over 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
The serializer the kit guards on 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
How this store encodes a value for the chunker, its value store and the resolver. saver carries the guarded serializer. Parameters

prepare_checkpoint

tai42_kit.llm.checkpoint.providers.CheckpointProvider.prepare_checkpoint
The checkpoint and versions the saver is handed; every value they reference is held when this returns. Default: the kit’s preparation for 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
The pending writes the saver is handed; every value they reference is held when this returns. Default: every write value chunked and pre-encoded. Parameters

recorded_generation

tai42_kit.llm.checkpoint.providers.CheckpointProvider.recorded_generation
The store-format generation the store records, or None when it records none. Parameters

record_generation

tai42_kit.llm.checkpoint.providers.CheckpointProvider.record_generation
Record generation unless one is recorded: concurrent first builds keep the first. Parameters

holds_checkpoints

tai42_kit.llm.checkpoint.providers.CheckpointProvider.holds_checkpoints
Whether the store holds any checkpoint. Parameters

CheckpointProviderFacts

tai42_kit.llm.checkpoint.providers.CheckpointProviderFacts
What the kit reads about one checkpoint store. Attributes

CheckpointReferenceError

tai42_kit.llm.checkpoint.chunking.CheckpointReferenceError
A stored checkpoint references a value its thread’s value store does not hold, or holds altered.

CheckpointResource

tai42_kit.llm.checkpoint.checkpoint.CheckpointResource
The long-lived resource behind one 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
A checkpoint value could not be stored faithfully, or a stored value could not be read back. The guard converts ormsgpack’s 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
The checkpoint store holds data written in a format this version does not read.

CheckpointValueRef

tai42_kit.llm.checkpoint.chunking.CheckpointValueRef
A reference to a value stored once in its thread’s value store. 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
Where one checkpoint store keeps its threads’ shared values.

Members

touch

tai42_kit.llm.checkpoint.value_store.CheckpointValueStore.touch
Re-arm the retention of the held digests of thread_id; return those it does not hold. Parameters

put

tai42_kit.llm.checkpoint.value_store.CheckpointValueStore.put
Store blobs (by digest) for thread_id. Parameters

get

tai42_kit.llm.checkpoint.value_store.CheckpointValueStore.get
The held blobs among digests of thread_id; a digest it does not hold is absent. Parameters

held_digests

tai42_kit.llm.checkpoint.value_store.CheckpointValueStore.held_digests
Every digest thread_id holds. Parameters

delete_thread

tai42_kit.llm.checkpoint.value_store.CheckpointValueStore.delete_thread
Delete every value thread_id holds. Parameters

CheckpointWrite

tai42_kit.llm.checkpoint.providers.CheckpointWrite
What the kit hands a store’s write preparation: the thread’s value store and the kit’s tools. 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
A chunker over the store’s encoding and the threshold.

inline_form

tai42_kit.llm.checkpoint.providers.CheckpointWrite.inline_form
The (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
Re-arm every digest of 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
The per-thread retention record of one checkpoint store. It holds the finished marks and their due times, the declared waiting retentions, and lists the threads past their waiting horizon. Every method that takes thread ids takes any sequence; an empty one changes nothing, on every provider.

Members

start

tai42_kit.llm.checkpoint.ledger.FinishedThreadLedger.start
A run starts on 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
Record 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
Up to limit thread ids due at or before cutoff, earliest due first. Parameters

forget

tai42_kit.llm.checkpoint.ledger.FinishedThreadLedger.forget
Remove thread_ids from the ledger: their finished mark and their declared waiting. Parameters

declared_waiting

tai42_kit.llm.checkpoint.ledger.FinishedThreadLedger.declared_waiting
The recorded declared waiting minutes of those of thread_ids that have one. Parameters

stale_threads

tai42_kit.llm.checkpoint.ledger.FinishedThreadLedger.stale_threads
The threads whose newest checkpoint is older than their waiting retention before 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
A store’s msgpack encoding, for the chunker, its value store and the resolver.

Members

encode

tai42_kit.llm.checkpoint.value_encoding.MsgpackValueEncoding.encode
The (type, bytes) the library serializer writes for value. Parameters

reference

tai42_kit.llm.checkpoint.value_encoding.MsgpackValueEncoding.reference
The ref envelope, a plain dictionary in the msgpack blob. Parameters

as_reference

tai42_kit.llm.checkpoint.value_encoding.MsgpackValueEncoding.as_reference
A reference as msgpack reads it back: the ref envelope dictionary. Parameters

store_form

tai42_kit.llm.checkpoint.value_encoding.MsgpackValueEncoding.store_form
The blob, zlib compressed under its own type tag when it is msgpack above the compress threshold. Parameters

decode

tai42_kit.llm.checkpoint.value_encoding.MsgpackValueEncoding.decode
Decompress and decode blob. Parameters

PreEncodedCheckpoint

tai42_kit.llm.checkpoint.checkpoint.PreEncodedCheckpoint
A checkpoint the kit already encoded whole, carrying the checkpoint’s keys for the library saver. The library saver reads the checkpoint’s id and copies it before handing it to its serializer; the copy keeps the encoding, and the serializer returns encoded as it is. references: as PreEncodedValue. Attributes

Members

copy

tai42_kit.llm.checkpoint.checkpoint.PreEncodedCheckpoint.copy
A shallow copy that keeps the encoding.

PreEncodedValue

tai42_kit.llm.checkpoint.checkpoint.PreEncodedValue
A checkpoint value the kit already encoded: the saver’s serializer returns 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
A _DeltaSnapshot whose payload holds a reference.

StoredBlob

tai42_kit.llm.checkpoint.value_store.StoredBlob
A value as its thread’s value store holds it: a type tag and the stored bytes. Attributes

ThreadRetention

tai42_kit.llm.checkpoint.retention.ThreadRetention
How long a checkpoint thread is kept, in minutes, bounded by the platform’s values. 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
A declared checkpoint retention is out of bounds; the message names the value and the bound it broke.

UnknownCheckpointProviderError

tai42_kit.llm.checkpoint.providers.UnknownCheckpointProviderError
A checkpoint provider name no registration holds.

ValueChunker

tai42_kit.llm.checkpoint.chunking.ValueChunker
Chunk values above 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
One store’s encoding of checkpoint values, as the chunker and the resolver use it.

Members

encode

tai42_kit.llm.checkpoint.chunking.ValueEncoding.encode
The (type, bytes) the store’s serializer writes for value. Parameters

reference

tai42_kit.llm.checkpoint.chunking.ValueEncoding.reference
The value a checkpoint stores in place of the value ref names. Parameters

as_reference

tai42_kit.llm.checkpoint.chunking.ValueEncoding.as_reference
The 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
The blob the value store holds for a value encoded as encoded. Parameters

decode

tai42_kit.llm.checkpoint.chunking.ValueEncoding.decode
The value 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
How long a parked run’s checkpoint is kept on 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
The registration of name; an unknown name raises UnknownCheckpointProviderError. Parameters

checkpoint_provider_facts

tai42_kit.llm.checkpoint.providers.checkpoint_provider_facts
Return the facts of provider; an unknown name raises UnknownCheckpointProviderError. Parameters

checkpoint_providers

tai42_kit.llm.checkpoint.providers.checkpoint_providers
A read-only, name-sorted view of every registered provider’s facts.

create_checkpoint_resource

tai42_kit.llm.checkpoint.checkpoint.create_checkpoint_resource
Open the store 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
A saver over 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
The providers whose checkpoints survive a process restart.

envelope_reference

tai42_kit.llm.checkpoint.envelope.envelope_reference
The 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
The saver a graph checkpoints through on 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
A read-only view of the registered filters by owner.

live_threads

tai42_kit.llm.checkpoint.liveness.live_threads
Map each candidate a registered filter claims to the owner that claimed it. Every filter is called; a filter’s raise propagates. Parameters

mark_threads_active

tai42_kit.llm.checkpoint.ledger.mark_threads_active
Take 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
Mark 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
The platform’s two retention settings: the default and the ceiling of every declaration.

reference_envelope

tai42_kit.llm.checkpoint.envelope.reference_envelope
The 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
Register 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
Register 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
Resolve an owner’s declaration against the platform’s values. An unset waiting is the platform’s; an unset finished is the platform’s finished capped at the resolved waiting (a finished thread is never kept longer than a waiting one). The resolved value is bounded where it is built (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
The encoded size above which 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
The stale-thread listing of a store without an index of its own, by id. Reads the newest checkpoint 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