Skip to content

lackpy

Python that lacks most of Python. lackpy is a micro-inferencer that turns natural language intent into restricted Python programs, validates them against a safe AST subset, and runs them with full execution tracing.

intent → restricted Python → validation → traced execution → result

Why lackpy?

  • Zero-dependency core. The validator, grader, runner, and trace are pure Python stdlib — no inference dependency is required to validate or run programs.
  • AST-first security. Every program is checked at the AST level before any byte of code runs. Imports, class definitions, while loops, try/except, and dozens of other constructs are structurally impossible, not just discouraged.
  • Plugin-based tools. Tools are resolved through provider plugins. The built-in provider covers filesystem primitives; the python provider wraps any importable function; and you can register your own provider in five lines of code.
  • Untrusted model output is safe by design. Programs generated by an LLM are validated against the same AST rules as hand-written programs. A hallucinated import os or open() call is rejected before execution.
  • The ratchet pattern. Validated programs can be saved as templates with intent patterns. On future requests, the template tier matches first — no inference needed, zero latency, guaranteed valid.

Quick start — CLI

# Initialize a workspace
lackpy init

# Generate and run a program from natural language
lackpy delegate "read the file README.md" --kit read_file,find_files

# Just generate — don't run
lackpy generate "find all Python files" --kit find_files

# Validate a hand-written program
lackpy validate my_program.py --kit read_file,find_files

Quick start — Python API

import asyncio
from lackpy import LackpyService

async def main():
    svc = LackpyService()

    # Generate and run in one call
    result = await svc.delegate(
        intent="read the file pyproject.toml",
        kit=["read_file"],
    )
    print(result["output"])
    print(result["trace"])  # every tool call recorded

asyncio.run(main())

Rigged Suite

The "rigged suite" is the property that lackpy's inference pipeline can be made deterministic for any intent that has been seen before. Save a validated program as a template:

lackpy create my_program.py --name read-file --pattern "read the file {path}" --kit read_file

On the next delegate call with a matching intent, the template tier fires at tier 0 — before any LLM is consulted. The program is guaranteed valid because it was validated when it was saved.


Next steps