Skip to main content

SessionKnit (Python)

Ported line-for-line from the TypeScript implementation. See the root README for the pitch, the prior-art table, and the scope decisions — this file only covers what's specific to running the Python code.

Install

pip install -e ".[dev]"

Quickstart

PYTHONPATH=src python3 examples/quickstart.py
from sessionknit import FileStorage, SessionKnit, SessionEntry

sessionknit = SessionKnit(
    FileStorage("./sessions"),
    has_unresolved_tool_call=lambda m: m.has_tool_call,
    build_continuation=lambda m: Message(role="user", content="Continue from where you left off."),
)

await sessionknit.append(session_id, SessionEntry(id=id, parent_id=parent_id, message=message))

result = await sessionknit.resume(session_id)
# result.messages, result.resumed_after_interruption

Test

pytest

Status

Chain reconstruction, topology repair, the async write-behind queue, and interruption detection are real and tested. Not yet published to PyPI — sessionknit is unclaimed there.

Release files for sessionknit 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sessionknit 0.0.1
File Size Uploaded
sessionknit-0.0.1.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sessionknit 0.0.1
File Interpreter ABI Platform
sessionknit-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.9 kB

Release files / sessionknit-0.0.1.tar.gz

Download URL sessionknit-0.0.1.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
539c6b954583aa8a5373dbff39ff22d2af30fd14e771cc5a2831597203788fbf
BLAKE2b-256 checksum
How to use checksums
e71dc8297ee95c612f7fa09e25fabf856fc87539e13c5f1d8a4b8c2e63a235ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Release files / sessionknit-0.0.1-py3-none-any.whl

Download URL sessionknit-0.0.1-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b11c87ef1b4aea538b678f8b92f6f990a86df2a24e922d47dd956f2f2e38ffa
BLAKE2b-256 checksum
How to use checksums
32eac02ceab3ce03c92f344b7120de5f19a2ac7b2e3f740873e86db302b6699e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Release history Release notifications | RSS feed

0.0.3

2 release files

0.0.2

2 release files

This release

0.0.1 This release

2 release files

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