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.
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,
whileloops,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
pythonprovider 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 osoropen()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¶
lackpy ships two binaries: lackpy (flag-based inference on a single -c intent —
delegate is the default mode) and lackpyctl (workspace management).
# Initialize a workspace
lackpyctl init
# Generate and run a program from natural language (delegate is the default mode)
lackpy -c "read the file README.md" --profile read_file,find_files
# Just generate — don't run
lackpy -c "find all Python files" --generate --profile find_files
# Validate a hand-written program file
lackpy my_program.py --validate --profile read_file,find_files
Quick start — Python API¶
import asyncio
from lackpy.service import LackpyService
async def main():
svc = LackpyService()
# Generate and run in one call
result = await svc.delegate(
intent="read the file pyproject.toml",
profile=["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. There are two complementary mechanisms:
Lackey files. Generate a program from an intent and save it as a reusable Lackey file (a Python class) under .lackpy/templates/, then invoke it by path:
lackpy -c "read the file README.md" --create --name ReadFile --profile read_file
# → Created .lackpy/templates/ReadFile.py
lackpy .lackpy/templates/ReadFile.py
The saved program is guaranteed valid because it was validated when it was created, and running it by path skips inference entirely.
Templates. For intent-driven deterministic matching, save a .tmpl template with a pattern (via the svc.create(pattern=...) Python API). The template tier (tier 0) then matches future intents by pattern and instantiates the stored program — before any LLM is consulted.
Next steps¶
- Getting Started — install, initialize, first commands
- Tutorial — step-by-step walkthrough of every feature
- Concepts: Architecture — how the pipeline works
- Python API Reference — full API docs
- CLI Reference — every command