Open source · Apache-2.0 · Python 3.11+

loom. Senior judgement, compiled.

One typed foundation for APIs, ETL, streaming, agents and jobs. Contracts, rules and permissions are declared, compiled into an execution plan at start-up and checked before the first request.

pip install loom-kernel
Read the docsGitHub

Rules and dependencies live in the signature

class CreateUserUseCase(UseCase[User, User]):
    rules = [
        Rule.check(F(CreateUser).email, via=_email_must_be_valid),
        Rule.forbid(lambda _, __, exists: exists,
                    message="email already exists")
            .from_params("email_exists"),
    ]

    async def execute(
        self,
        cmd: CreateUser = Input(),
        email_exists: bool = Exists(User, from_command="email",
                                    against="email"),
    ) -> User:
        return await self.main_repo.create(cmd)
  • Exists checks a database condition before execute runs.
  • Rule.check and Rule.forbid declare invariants, not if blocks.
  • A wrong plan fails at start-up with a structured error, not in production.

One kernel for almost every business need

APIs and microservices

Typed use cases with rules and dependencies in the signature. Auto-CRUD and OpenAPI on FastAPI. Repositories decoupled from the database.

ETL

Declarative pipelines validated at compile time. Polars and delta-rs by default, Spark and Delta when needed. Upsert, partition replace, SCD2, checkpoints and lineage.

Streaming

Kafka, Bytewax and Mongo CDC with explicit delivery semantics.

Agents

Agents defined in YAML and validated offline, with typed permissions. Bedrock, OpenAI, Anthropic and TypeSafe.

Jobs

Background jobs and Celery workers as first-class citizens, with the same rules as your use cases.

Testing and observability

Golden tests, in-memory repositories, Polars and Spark step runners. structlog, OpenTelemetry and Prometheus.

Run and observe loom in Periplo

loom is the foundation of Periplo, our platform. Periplo already catalogs and queries the tables your loom pipelines write; next, it will follow their runs and create, deploy and observe loom services for you.