Skip to main content

Boole

Local-first LLM inference for Python. Run GGUF models on your own hardware via llama.cpp — get cloud-SDK ergonomics without the cloud bill.

pip install boole

Why Boole

Most inference SDKs assume every call leaves your machine. You pay per token, per second of GPU time, per cold start — even for workloads your own laptop or workstation could handle in milliseconds. Boole flips the default: inference runs locally unless you tell it not to.

  • ~10x cheaper by default — no metered API calls for work your hardware can already do.
  • No cold starts — models load once into a long-lived local process, not a fresh container on every request.
  • No data leaves your machine — prompts, context, and outputs stay local unless you explicitly opt into remote burst.
  • Familiar shapeApp, Function, and Sandbox primitives will feel immediately natural if you've used a serverless inference SDK before.
  • Burst when you need to — for models too large for local hardware, or workloads that need to scale past one machine, the same function can transparently hand off to remote compute (opt-in, planned).

Quickstart

from boole import App

app = App(name="my-app")

generate = app.function(
    {"model": "TheBloke/Mistral-7B-Instruct-v0.2-GGUF", "quant": "Q4_K_M"},
    lambda ctx, prompt: ctx.llm.generate(prompt),
)

result = generate.call("Write a haiku about GPUs")
print(result)

The first call downloads and caches the GGUF weights to ~/.boole/models; every call after that loads from disk and runs entirely on your machine.

You can also use Function as a decorator:

@app.function({"model": "TheBloke/Mistral-7B-Instruct-v0.2-GGUF", "quant": "Q4_K_M"})
def generate(ctx, prompt: str) -> str:
    return ctx.llm.generate(prompt)

Core concepts

Primitive What it does
App Top-level container that groups functions and shared config.
Function A typed, callable unit of inference work, bound to a specific model.
Sandbox An isolated local execution context for running arbitrary code with resource limits (timeout, memory cap).
Client SDK entry point — model cache directory, default backend, auth for future remote mode.
RemoteBurst (planned) Routes a Function call to remote compute when local hardware can't handle it.

Streaming generation

def handler(ctx, prompt: str):
    return ctx.llm.stream(prompt)


stream_generate = app.function({"model": "...", "quant": "Q4_K_M"}, handler)

for token in stream_generate.stream("Write a haiku about GPUs"):
    print(token, end="", flush=True)

Running untrusted code in a Sandbox

sandbox = app.sandbox(timeout_ms=5000, memory_limit_mb=512)
result = sandbox.exec("python3", ["-c", "print(1 + 1)"])
print(result.stdout)

Async usage

Function.call() is synchronous by default. If you're already inside an event loop (e.g. a FastAPI handler), use acall() instead:

result = await generate.acall("Write a haiku about GPUs")

Platform support

Boole uses llama-cpp-python bindings to talk to llama.cpp directly, with GPU offload where available.

Platform CPU GPU acceleration
macOS (Apple Silicon) ✅ Metal
macOS (Intel)
Linux (x64/arm64) ✅ CUDA / Vulkan
Windows (x64) ✅ CUDA / Vulkan

llama-cpp-python publishes prebuilt wheels for common platform/CUDA combinations; unsupported combinations fall back to compiling llama.cpp from source on install (a C++ compiler is required in that case).

Configuration

from boole import Client

client = Client(
    model_cache_dir="~/.boole/models",  # where GGUF files are stored
    default_backend="llama-cpp",  # inference backend
)

app = App(name="my-app", client=client)

Roadmap

  • Local inference via llama.cpp / GGUF (llama-cpp-python)
  • App / Function / Sandbox primitives
  • RemoteBurst — opt-in remote fallback for oversized models / scaled workloads
  • Structured output / grammar-constrained generation helpers
  • Async-native backend (non-blocking generation without a thread pool)

Contributing

Issues and PRs welcome. See CONTRIBUTING.md for local dev setup.

pip install -e ".[dev]"
pytest
ruff check .

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

boole-0.0.1.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

boole-0.0.1-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file boole-0.0.1.tar.gz.

File metadata

  • Download URL: boole-0.0.1.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for boole-0.0.1.tar.gz
Algorithm Hash digest
SHA256 92a3a6fb30a6d66538b77bac3900e37e97f48ae6ff2554252f064ac09866d356
MD5 1219bb98c23aa3cfa8b85bf55e28564f
BLAKE2b-256 2a9958bbdc0968d13e898e4fc4000eaedff722d04573138250151fdf32d6ac73

See more details on using hashes here.

File details

Details for the file boole-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: boole-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for boole-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 91c506c2c61c5fa143a1f65215627f38fb1c0ab59841718976d607db9073486b
MD5 239128a99d637d2ea8734663c4a7e075
BLAKE2b-256 20091427f90185e054e4d4cd96f24538c03c4e06a36fcdf1751b40405f3d7947

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page