let it loop (LIL)
Single-Process Local Write-Ahead Log (LILWAL02) & Process Supervisor for Python Scripts (v0.7.2)
Official Website • Architecture & Trade-Offs • DCP-2.0 Simulation Harness • PyPI Package
Status & Scope:
letitloopis a single-maintainer, single-writer local filesystem Write-Ahead Log (LILWAL02) and process supervisor (lil watch/@supervise) for Python functions, scrapers, and batch scripts. It requires onlypsutil>=5.9.0and stores state in human-readable, CRC32-framed JSONL files.
⚡ Quickstart
from letitloop import atomic_marker, durable, step
@durable(goal_id="customer_sync", wal_dir=".durable_wal")
def sync_workflow():
# If this process crashes or receives SIGKILL midway,
# completed steps are skipped from the local WAL on restart.
user = step("fetch_user", fetch_crm_record, user_id=123)
summary = step("summarize", call_llm_model, user)
# Guard local side effects with a 2-phase file marker
with atomic_marker("slack_notification") as should_execute:
if should_execute:
step("notify", send_slack, summary)
return summary
if __name__ == "__main__":
sync_workflow()
pip install letitloop
For asynchronous pipelines, use @durable_async and await async_step(...) with ContextVar isolation across asyncio.gather().
Interactive Crash-Recovery Visualizer
Run the local Streamlit visualizer (uses deterministic local steps, zero external API calls):
python -m pip install -e .
python -m pip install -r examples/interactive_demo/requirements.txt
streamlit run examples/interactive_demo/app.py
🧭 When to Use LetItLoop (and When Not To)
| Workload / Requirement | Recommended Tool | Why |
|---|---|---|
| Single-writer local Python script, scraper, or CLI job | LetItLoop (@durable + lil watch) |
Zero external daemon, human-readable JSONL WAL (LILWAL02) with CRC32 + SHA-256 hash chain, and built-in subprocess crash supervision (lil watch). |
SQLite / PostgreSQL transactional workflows with durable sleep & queues |
DBOS (dbos) |
Runs in-process on SQLite by default with a production PostgreSQL upgrade path and official PydanticAI / OpenAI Agents SDK integrations. |
LangGraph graph or @entrypoint / @task pipelines |
LangGraph SqliteSaver |
Native checkpointer maintained by the LangGraph core team. |
| Data engineering DAGs & scheduled flows | Prefect | Mature Python @flow / @task engine with ephemeral local SQLite mode and observability UI. |
| Multi-node distributed microservices & multi-day timers | Temporal or Restate | Dedicated workflow server clusters with distributed event histories and multi-language workers. |
See docs/ARCHITECTURE_AND_TRADE_OFFS.md for a detailed architectural analysis and contract boundaries.
🔄 Process Liveness: Auto-Supervision & CLI Watcher
LetItLoop pairs State Durability (saving step outputs to disk) with Process Liveness (restarting a script after SIGKILL 137 or an unhandled crash):
1. Terminal Watcher (lil watch)
Supervise any Python script with sliding-window rapid-failure circuit breaking and clean signal forwarding:
lil watch agent_pipeline.py --max-restarts 10 --backoff 1.0
2. Entrypoint Decorator (@supervise)
from letitloop import durable, step, supervise
@supervise(max_restarts=5, backoff=1.0)
@durable(goal_id="equity_analyst", wal_dir=".equity_wal")
def run_pipeline():
user = step("fetch_data", fetch_financials)
report = step("generate_report", analyze, user)
return report
if __name__ == "__main__":
run_pipeline()
💎 Core Design Guarantees & Contract Boundaries
- CRC32-Framed Append-Only WAL (
LILWAL02): Each step delta is framed as\nLILWAL02:<byte_len_hex>:<crc32_hex>:<canonical_json>\nand linked via a sequential SHA-256 hash chain (prev_hash->event_hash). Torn tail writes from mid-append power loss orSIGKILLare truncated back to the last valid frame on replay, while mid-file corruption fails closed withStateError. - $O(1)$ Delta Patching & Atomic Snapshots:
Step outputs append discrete delta patches under
step_outputsand write periodic atomic snapshots (state.jsonvia tempfile +os.fsync+ 6-attempt Windows NTFSos.replaceretry + POSIX directory fsync). - 2-Tier Mutex (
atomic_marker): Combines a process-localthreading.Lockand a cross-processFileLock(with PID start-time token verification to prevent PID-reuse lock false positives) and sweeps orphaned.pending.<dead_pid>markers on recovery.External API Boundary: No local filesystem marker can prevent duplicate execution if
SIGKILLstrikes after an HTTP request leaves the host NIC but before the response is committed to disk. For non-idempotent remote APIs (e.g. Stripe charges), pass an upstreamIdempotency-Keyheader derived fromf"{goal_id}:{marker_id}". - Allowlist-Only Type Hydration (
DurableCodecRegistry): Preservesdatetime,uuid.UUID,pathlib.Path,tuple, and custom types registered viaregister_codec()across initial execution and WAL replay without usingpickleor dynamic code imports.
🍳 Runnable Examples & Cookbooks
Self-contained examples in examples/:
| Target | Example / Cookbook | Description |
|---|---|---|
| Playwright | examples/cookbooks/playwright_scraper.py |
Multi-page scraper with @durable_async checkpointing that skips already-scraped pages on resume |
| Streamlit UI | examples/interactive_demo/app.py |
Local crash injection and WAL replay visualizer |
| Browser-Use | examples/cookbooks/browser_use_durable.py |
Release digest workflow with step-level crash recovery |
| LangGraph | examples/cookbooks/langgraph_financial_analyst.py |
4-step financial analyst pipeline with offline and live DeepSeek modes |
| DSPy | examples/cookbooks/dspy_durable_optimize.py |
Prompt optimizer pipeline with step-level checkpointing |
| Pydantic AI | examples/cookbooks/pydantic_ai_durable.py |
Type-safe agent workflow wrapped with LetItLoop step persistence |
| FastAPI | examples/fastapi_durable_background.py |
Single-worker durable background task queue backed by local WAL |
| CrewAI / LlamaIndex | examples/crewai_durable_tools.py • examples/llamaindex_durable_workflow.py |
Tool-call and step wrapper examples |
Run the financial analyst cookbook offline without API keys:
python -m pip install -e ".[financial-agent]"
python examples/cookbooks/langgraph_financial_analyst.py --ticker AAPL --offline
python examples/cookbooks/langgraph_financial_analyst.py --ticker AAPL --offline --demo
🛡️ GitHub Action CI Gate (letitloop-action@v2)
Verify LILWAL02 frame checksums and Python AST syntax in GitHub Actions:
name: Verify WAL & Python AST
on: [pull_request]
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: sdageltc/letitloop-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
mode: 'gate'
wal-dir: '.bench_wal'
workspace: '.'
📜 Architecture Documentation
- Architecture & Trade-Offs: Single-writer design contract, failure modes, and comparison with DBOS, LangGraph, and Temporal.
- ADR-0001: Write-Ahead Logging (
LILWAL02) & Torn-Tail Recovery. - State Machine Specification: Event-sourced state transitions and replay rules.
- Adapter Reference: Optional adapter shims under
letitloop.adapters.
👥 Contributors
sdageltc |
Yash Paudel |
wangshen-tech |
MagMueller |
darkseidpaul |
Aaqibhafeezkhan |
License
Distributed under the MIT License. Copyright (c) 2026 sdageltc. See LICENSE for details.
Metadata
Release files for letitloop 0.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| letitloop-0.7.2.tar.gz | 138.9 kB | With provenance | Details for letitloop-0.7.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| letitloop-0.7.2-py3-none-any.whl | Python 3 | none | any | Details for letitloop-0.7.2-py3-none-any.whl |
Total release size: 238.5 kB
Release files / letitloop-0.7.2.tar.gz
| Download URL | letitloop-0.7.2.tar.gz |
|---|---|
| Size | 138.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85c55cc11347455af23f4ece8acee33acade2eeaefddad926b10099677d74a15
|
|
BLAKE2b-256 checksum How to use checksums |
46c641ffa214388d583e7af5b349131a93e9a51852ba0846693d9e93f24069c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / letitloop-0.7.2-py3-none-any.whl
| Download URL | letitloop-0.7.2-py3-none-any.whl |
|---|---|
| Size | 99.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e0801f8eafa5d3fd890517374067a359a5d68ea1ee669a09bfd923388eaea16d
|
|
BLAKE2b-256 checksum How to use checksums |
382c16ec550ad63fa69d09f52d04b743554ab4849e8227088c4db7884a783857
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for letitloop 0.7.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for letitloop-0.7.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.