sdageltc/letitloop

Make any Python function crash-proof in 3 lines. The zero-daemon durability kernel for AI agents & scripts.

5

stars

207

commits

Python

primary language

Sep 1, 2026

updated

sdageltc.github.io/letitloop/
ai-agents
ast
crash-recovery
crewai
developer-tools
durable-execution
fault-tolerance
langchain
mcp-server
python
write-ahead-log

README

let it loop (LIL)

let it loop (LIL)

Make any Python function or AI agent workflow crash-proof in 3 lines. Zero tokens wasted on SIGKILL.

Official Website PyPI version CI Matrix GitHub Action v2 Benchmark Python 3.11+ License: MIT

Official WebsiteDCP-2.0 BenchmarkGitHub Action v2PyPI Package


Temporal is great if you have a DevOps team to manage a cluster. LetItLoop is for developers who want crash-proof Python functions and AI agent pipelines in 3 lines of code without running a single daemon.


LetItLoop Process Crash & WAL Recovery Demo

⚡ Quickstart

from letitloop import durable, step, atomic_marker


@durable(goal_id="customer_sync")
def sync_workflow():
    # If this process crashes or gets SIGKILLed midway,
    # completed steps are skipped on resume in <15ms. Zero duplicate tokens wasted.
    user = step("fetch_user", fetch_crm_record, user_id=123)
    summary = step("summarize", call_claude, user)

    # Protect external API mutations against duplicate execution
    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

⚡ Async Support: For asynchronous pipelines, use @durable_async and await async_step(...) with full asyncio.gather() isolation.


🔄 Process Liveness: Auto-Supervision & CLI Watcher

LetItLoop bridges the gap between State Durability (saving steps to disk) and Process Liveness (auto-restarting on SIGKILL 137 / OOM) with zero external daemons:

1. Terminal Watcher (lil watch)

Run any existing Python script under supervisor control with rapid-failure circuit breaking and clean Ctrl+C handling:

# Auto-respawns on SIGKILL (137), resuming from last WAL checkpoint in ~14ms
lil watch agent_pipeline.py --max-restarts 10 --backoff 1.0

2. In-Code Programmatic Supervisor (@supervise)

from letitloop import durable, step, supervise


@supervise(max_restarts=5, backoff=1.0)
@durable(goal_id="equity_analyst")
def run_pipeline():
    user = step("fetch_data", fetch_financials)
    report = step("generate_report", analyze, user)
    return report


if __name__ == "__main__":
    run_pipeline()

💎 The 3 Architectural Moats

1. Zero-Daemon Local Durability (Zero Infrastructure)

No background Go servers, no Redis queues, and no PostgreSQL cluster configuration. LetItLoop embeds a single-file Write-Ahead Log (LILWAL02) that logs step outputs atomically. If your script dies from SIGKILL (137), OOM, or spot eviction, running the script again instantly fast-forwards to the exact interrupted step in ~14ms.

2. Source-Span AST Node Splicer (0% Comment Loss)

Temporal and existing orchestrators only manage task state. LetItLoop includes a surgical Python concrete syntax tree (CST) engine built specifically for self-coding AI agents:

  • Replaces targeted functions and classes with surgical precision.
  • 0% Comment Loss: Guarantees module docstrings, inline comments, licensing headers, and class indentation are never stripped or hallucinated away by LLM whole-file rewrites.

3. Proof-Carrying CI Gate (letitloop-action)

LetItLoop generates signed HMAC-SHA256 receipts recording execution invariants and test outputs. Drop letitloop-action@v2 into GitHub Actions to block AI pull requests from hallucinating passing test outputs or altering protected function signatures.


📊 DCP-2.0 Agent Durability Conformance Benchmark

How does LetItLoop compare against heavyweight workflow engines and existing agent frameworks under physical host OS SIGKILL (137) fault injection?

Empirical results from the open DCP-2.0 Durability Benchmark:

Architecture & RuntimeDurability MechanismCrash Recovery ($R_{crash}$)Resumption Latency ($T_{resume}$)Duplicate Token Waste ($W_{token}$)Per-Step Write OverheadProof / Audit Trail
LetItLoop (@durable WAL)Single-File Atomic WAL (LILWAL02)98.6% PASS14.2 ms2.8% (interrupted step)+3.8 ms (fsync journal)HMAC-SHA256 Sealed
Temporal (Durable Workflows)Distributed Event Sourcing (Cluster)99.2% PASS74.0 ms1.9%+18.5 ms (gRPC cluster)Cluster Event History
LangGraph (SQLite Saver)Superstep Graph Checkpointing84.5% PARTIAL38.4 ms16.8% (node re-run)+1.2 ms (SQLite row)Database Row Logs
CrewAI (In-Memory Loop)In-memory process queue0.0% LOSSN/A (Full restart)100.0% (Total wipe)0.0 ms (Zero disk writes)None
Microsoft AutoGenIn-memory ConversableAgent state0.0% LOSSN/A (Full restart)100.0% (Total wipe)0.0 ms (Zero disk writes)None
Raw Python (Unmanaged CLI)Standard runtime globals0.0% LOSSN/A (Full restart)100.0% (Total wipe)0.0 ms (Zero disk writes)None

[!NOTE] Methodological Disclosure & Architectural Trade-offs:

  1. Why 100% durability is physically impossible: If a non-maskable SIGKILL strikes while an uncommitted external network request is actively in flight, that single step must be re-executed upon resume, producing an empirical ~1.4%–2.8% token re-execution overhead.
  2. The I/O Overhead Trade-off: LetItLoop trades ~3.8ms disk fsync write latency per step to guarantee sub-millisecond local recovery. For pure in-memory math loops, this is unnecessary overhead; for LLM/API agent pipelines costing $0.10–$2.00 per step, paying 3.8ms disk I/O to guarantee zero lost progress is an overwhelming net win.

🔄 Durability vs. Liveness (Auto-Supervision)

  • Durability (LetItLoop Kernel): Guarantees that completed state is never lost when a process terminates.
  • Liveness (Supervisor Runner): When a process gets killed by the OS (SIGKILL), it requires a supervisor to automatically respawn it. LetItLoop provides built-in supervision:
# Supervise execution and auto-respawn process on unhandled SIGKILL/crash until completion
lil run --task auth-refactor --supervise --strict

🍳 Framework Recipes & Community Cookbooks

Explore runnable self-contained examples in examples/:

FrameworkRecipe / CookbookStatusDescription
CrewAIDurable Tools Example✅ ReadyMulti-agent tool execution with step-level resumption and zero duplicate side-effects
LlamaIndexDurable Workflows Example✅ ReadyEvent-driven @step pipeline with crash durability and sub-millisecond fast-forward
OpenAI SwarmDurable Handoff Example✅ ReadyMulti-agent context handoff with WAL v2 serialization
LangGraphIssue #82: Financial Analyst Agent🤝 Contributor4-step yfinance + StateGraph equity analysis surviving simulated SIGKILL
DSPyIssue #83: Prompt Optimizer Pipeline🤝 ContributorAsync BootstrapFewShot / Teleprompter tuning with zero lost progress
PlaywrightIssue #88: Web Scraping Agent🤝 ContributorMulti-page browser scraper that checkpoints DOM items to skip scraped pages
Pydantic AIIssue #89: Pydantic AI Integration🤝 ContributorType-safe agent with tool-calling checkpointing and zero token waste

🛡️ GitHub Action CI Gate (v2)

Drop letitloop-action@v2 into your CI pipeline to block non-deterministic AI agent regressions:

name: LetItLoop Proof-Carrying CI Gate
on: [pull_request]

jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: sdageltc/letitloop-action@v2
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          strict-ast: 'true'

📜 Architecture Decision Records (ADRs)

Core design invariants are documented under docs/adr/:

  • ADR-0001: Write-Ahead Logging (WAL) & Zero-State Recovery
  • ADR-0002: Deterministic AST & Exit-Code Verification Gates
  • ADR-0003: Zero-API-Key Headless Agent CLI Failovers
  • ADR-0004: Format-Aware Acceptance Checks & Markdown Invariants

License

Distributed under the MIT License. Copyright (c) 2026 sdageltc. See LICENSE for details.

Contributors

sdageltc

206 commits

Saket7002

1 commits

sdageltc/letitloop

Make any Python function crash-proof in 3 lines. The zero-daemon durability kernel for AI agents & scripts.

5

stars

207

commits

Python

primary language

Sep 1, 2026

updated

sdageltc.github.io/letitloop/
ai-agents
ast
crash-recovery
crewai
developer-tools
durable-execution
fault-tolerance
langchain
mcp-server
python
write-ahead-log

README

let it loop (LIL)

let it loop (LIL)

Make any Python function or AI agent workflow crash-proof in 3 lines. Zero tokens wasted on SIGKILL.

Official Website PyPI version CI Matrix GitHub Action v2 Benchmark Python 3.11+ License: MIT

Official WebsiteDCP-2.0 BenchmarkGitHub Action v2PyPI Package


Temporal is great if you have a DevOps team to manage a cluster. LetItLoop is for developers who want crash-proof Python functions and AI agent pipelines in 3 lines of code without running a single daemon.


LetItLoop Process Crash & WAL Recovery Demo

⚡ Quickstart

from letitloop import durable, step, atomic_marker


@durable(goal_id="customer_sync")
def sync_workflow():
    # If this process crashes or gets SIGKILLed midway,
    # completed steps are skipped on resume in <15ms. Zero duplicate tokens wasted.
    user = step("fetch_user", fetch_crm_record, user_id=123)
    summary = step("summarize", call_claude, user)

    # Protect external API mutations against duplicate execution
    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

⚡ Async Support: For asynchronous pipelines, use @durable_async and await async_step(...) with full asyncio.gather() isolation.


🔄 Process Liveness: Auto-Supervision & CLI Watcher

LetItLoop bridges the gap between State Durability (saving steps to disk) and Process Liveness (auto-restarting on SIGKILL 137 / OOM) with zero external daemons:

1. Terminal Watcher (lil watch)

Run any existing Python script under supervisor control with rapid-failure circuit breaking and clean Ctrl+C handling:

# Auto-respawns on SIGKILL (137), resuming from last WAL checkpoint in ~14ms
lil watch agent_pipeline.py --max-restarts 10 --backoff 1.0

2. In-Code Programmatic Supervisor (@supervise)

from letitloop import durable, step, supervise


@supervise(max_restarts=5, backoff=1.0)
@durable(goal_id="equity_analyst")
def run_pipeline():
    user = step("fetch_data", fetch_financials)
    report = step("generate_report", analyze, user)
    return report


if __name__ == "__main__":
    run_pipeline()

💎 The 3 Architectural Moats

1. Zero-Daemon Local Durability (Zero Infrastructure)

No background Go servers, no Redis queues, and no PostgreSQL cluster configuration. LetItLoop embeds a single-file Write-Ahead Log (LILWAL02) that logs step outputs atomically. If your script dies from SIGKILL (137), OOM, or spot eviction, running the script again instantly fast-forwards to the exact interrupted step in ~14ms.

2. Source-Span AST Node Splicer (0% Comment Loss)

Temporal and existing orchestrators only manage task state. LetItLoop includes a surgical Python concrete syntax tree (CST) engine built specifically for self-coding AI agents:

  • Replaces targeted functions and classes with surgical precision.
  • 0% Comment Loss: Guarantees module docstrings, inline comments, licensing headers, and class indentation are never stripped or hallucinated away by LLM whole-file rewrites.

3. Proof-Carrying CI Gate (letitloop-action)

LetItLoop generates signed HMAC-SHA256 receipts recording execution invariants and test outputs. Drop letitloop-action@v2 into GitHub Actions to block AI pull requests from hallucinating passing test outputs or altering protected function signatures.


📊 DCP-2.0 Agent Durability Conformance Benchmark

How does LetItLoop compare against heavyweight workflow engines and existing agent frameworks under physical host OS SIGKILL (137) fault injection?

Empirical results from the open DCP-2.0 Durability Benchmark:

Architecture & RuntimeDurability MechanismCrash Recovery ($R_{crash}$)Resumption Latency ($T_{resume}$)Duplicate Token Waste ($W_{token}$)Per-Step Write OverheadProof / Audit Trail
LetItLoop (@durable WAL)Single-File Atomic WAL (LILWAL02)98.6% PASS14.2 ms2.8% (interrupted step)+3.8 ms (fsync journal)HMAC-SHA256 Sealed
Temporal (Durable Workflows)Distributed Event Sourcing (Cluster)99.2% PASS74.0 ms1.9%+18.5 ms (gRPC cluster)Cluster Event History
LangGraph (SQLite Saver)Superstep Graph Checkpointing84.5% PARTIAL38.4 ms16.8% (node re-run)+1.2 ms (SQLite row)Database Row Logs
CrewAI (In-Memory Loop)In-memory process queue0.0% LOSSN/A (Full restart)100.0% (Total wipe)0.0 ms (Zero disk writes)None
Microsoft AutoGenIn-memory ConversableAgent state0.0% LOSSN/A (Full restart)100.0% (Total wipe)0.0 ms (Zero disk writes)None
Raw Python (Unmanaged CLI)Standard runtime globals0.0% LOSSN/A (Full restart)100.0% (Total wipe)0.0 ms (Zero disk writes)None

[!NOTE] Methodological Disclosure & Architectural Trade-offs:

  1. Why 100% durability is physically impossible: If a non-maskable SIGKILL strikes while an uncommitted external network request is actively in flight, that single step must be re-executed upon resume, producing an empirical ~1.4%–2.8% token re-execution overhead.
  2. The I/O Overhead Trade-off: LetItLoop trades ~3.8ms disk fsync write latency per step to guarantee sub-millisecond local recovery. For pure in-memory math loops, this is unnecessary overhead; for LLM/API agent pipelines costing $0.10–$2.00 per step, paying 3.8ms disk I/O to guarantee zero lost progress is an overwhelming net win.

🔄 Durability vs. Liveness (Auto-Supervision)

  • Durability (LetItLoop Kernel): Guarantees that completed state is never lost when a process terminates.
  • Liveness (Supervisor Runner): When a process gets killed by the OS (SIGKILL), it requires a supervisor to automatically respawn it. LetItLoop provides built-in supervision:
# Supervise execution and auto-respawn process on unhandled SIGKILL/crash until completion
lil run --task auth-refactor --supervise --strict

🍳 Framework Recipes & Community Cookbooks

Explore runnable self-contained examples in examples/:

FrameworkRecipe / CookbookStatusDescription
CrewAIDurable Tools Example✅ ReadyMulti-agent tool execution with step-level resumption and zero duplicate side-effects
LlamaIndexDurable Workflows Example✅ ReadyEvent-driven @step pipeline with crash durability and sub-millisecond fast-forward
OpenAI SwarmDurable Handoff Example✅ ReadyMulti-agent context handoff with WAL v2 serialization
LangGraphIssue #82: Financial Analyst Agent🤝 Contributor4-step yfinance + StateGraph equity analysis surviving simulated SIGKILL
DSPyIssue #83: Prompt Optimizer Pipeline🤝 ContributorAsync BootstrapFewShot / Teleprompter tuning with zero lost progress
PlaywrightIssue #88: Web Scraping Agent🤝 ContributorMulti-page browser scraper that checkpoints DOM items to skip scraped pages
Pydantic AIIssue #89: Pydantic AI Integration🤝 ContributorType-safe agent with tool-calling checkpointing and zero token waste

🛡️ GitHub Action CI Gate (v2)

Drop letitloop-action@v2 into your CI pipeline to block non-deterministic AI agent regressions:

name: LetItLoop Proof-Carrying CI Gate
on: [pull_request]

jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: sdageltc/letitloop-action@v2
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          strict-ast: 'true'

📜 Architecture Decision Records (ADRs)

Core design invariants are documented under docs/adr/:

  • ADR-0001: Write-Ahead Logging (WAL) & Zero-State Recovery
  • ADR-0002: Deterministic AST & Exit-Code Verification Gates
  • ADR-0003: Zero-API-Key Headless Agent CLI Failovers
  • ADR-0004: Format-Aware Acceptance Checks & Markdown Invariants

License

Distributed under the MIT License. Copyright (c) 2026 sdageltc. See LICENSE for details.

Contributors

sdageltc

206 commits

Saket7002

1 commits

Languages

Python

98.2%

TypeScript

1.7%