SessionKnit (Python)
Part of LoopEngine — a runtime for defining and running AI agents through a transparent ReAct loop — handling durable, DAG-shaped session logs with crash-interruption detection. Works standalone too, no dependency on LoopEngine itself.
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. Published as
sessionknit on PyPI.
Release files for sessionknit 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sessionknit-0.0.3.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sessionknit-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.2 kB
Release files / sessionknit-0.0.3.tar.gz
| Download URL | sessionknit-0.0.3.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63e404dc05e38633a0e525ad761f308b34da91f6ae4310d78ffd34b412ea0992
|
|
BLAKE2b-256 checksum How to use checksums |
aed53afeb75dea243ad56d8a5d981c8a97fe641940f49b44fb364f3f014fa5c4
|
| 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.3-py3-none-any.whl
| Download URL | sessionknit-0.0.3-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1cd10babc75277bed7cff6ac374285835bb910c56d9edd36f9061bb010b7b443
|
|
BLAKE2b-256 checksum How to use checksums |
d6e2997e5ee5fdda112c2106eb63213be0d9d08dfa0e5ed27bf76b7bac8d1486
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.8
|