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.2

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.2
File Size Uploaded
sessionknit-0.0.2.tar.gz 6.4 kB Details

Built distribution (wheel)

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

Total release size: 12.9 kB

Release files / sessionknit-0.0.2.tar.gz

Download URL sessionknit-0.0.2.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
05bb8a3addb0898242b400dc93fa1887915c8982267c4e41d78e6226f27059bc
BLAKE2b-256 checksum
How to use checksums
43d81171751ad61673f08d9c316748c4109a08c87bd444758246d49c80ae319a
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.2-py3-none-any.whl

Download URL sessionknit-0.0.2-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f21efd692ee81f2186051912d0ebe3d3d966376e64ac594a87a3bd0a1881f40
BLAKE2b-256 checksum
How to use checksums
5ace9252de5e05ade01bf71a54b1606f2fe78c5affb758e62c6844da0e660657
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

This release

0.0.2 This release

2 release files

0.0.1

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