bab
bab (باب, "door") decides whether an AI agent may take an action on a resource: allow, ask a person, or deny.
Overview
An agent that can delete a pod or change a topic needs an answer to one question before it does: may this agent do this, here? bab answers it with one of three verdicts.
- allow: go ahead.
- approve: a person on the team that owns the resource has to say yes; bab names them.
- deny: the default.
The rules live in OpenFGA. You describe your resources and actions in a small YAML catalogue, bab generates the OpenFGA model from it, and nobody edits the model by hand. If the store cannot be reached, the answer is never allow.
bab is the permissions member of the tenish family of open-source platform and agent projects, each usable on its own: gojira deploys, kobo is where people build agents, sero keeps secrets, noto observes, and liminal is the gateway agents reach tools through.
Quickstart
You need Python 3.11 or newer, Docker and make.
git clone https://github.com/tenishai/bab && cd bab
python3 -m venv venv && venv/bin/pip install -e .
make demo PY=venv/bin/python
make demo fetches the OpenFGA CLI, starts OpenFGA in Docker, loads the example
catalogue and asks six questions, then one more with the store unreachable:
atlas pod_delete namespace:platform-dev/ingest -> {"verdict": "allow", ...}
atlas pod_delete namespace:platform-prod/ingest -> {"verdict": "approve", "approvers": ["user:alice", "user:bob", "user:carol"], ...}
beacon pod_delete namespace:data-kafka/streams -> {"verdict": "deny", "reason": "agent:beacon holds neither pod_delete nor pod_delete_gated on ...
--- store unreachable (fail-closed):
{"verdict": "approve", "reason": "store unreachable; fallback approvers", "degraded": true}
make demo-down stops it. To ask from your own code:
from bab import Door, catalogue
from bab.store import OpenFgaStore
door = Door(OpenFgaStore(url, store_id), catalogue.load("catalogues/example.yaml"),
fallback_approvers=("user:alice@example.com",))
d = door.decide("atlas", "pod_delete", "namespace:platform-prod/ingest")
# d.verdict in {ALLOW, APPROVE, DENY}; d.approvers; d.reason; d.degraded
How it works
- A catalogue generates the model.
catalogues/*.yamllists the resource levels and the actions;bab modelturns it into OpenFGA's language. CI fails if the generated model drifts from the catalogue. - Three sources write to the store, and nothing else does. An identity sync (people to teams), a topology sync (the resource tree and who owns it), and grants. A grant is checked against the team's ceiling when it is written.
- One check at the moment of the action.
Door.decideruns where the agent dispatches a tool. No console sits in that path. - Grants expire. A grant carries a time window and every check passes the current time, so it stops answering yes on the dot. Read grants stand; grants that change or destroy things expire by default.
- A service for fleets.
bab serveputs the same decisions behind HTTP, keeps a ledger of requests and grants, and hands out one-hour credentials for a granted permission.
| Path | What |
|---|---|
catalogues/*.yaml |
resource levels and actions; one profile per deployment (the example ships) |
bab/model.py |
catalogue to OpenFGA model |
bab/door.py |
the decision, fail-closed |
bab/ceiling.py |
write-time check: may this team hold this grant? |
bab/sync/ |
identity and topology syncs |
bab/service/ |
the HTTP service (bab serve) |
model/example.fga.yaml |
the example's fixture and assertions |
Status
Alpha. The decision, the generated model, the syncs, expiring grants and the HTTP service are built and run in our own deployment. Interfaces can still change between minor versions; CHANGELOG.md says what changed. Running pinned assertions against a policy change before it lands is designed, not built.
Documentation
- docs/design.md: the data model and the decision
- docs/design-leases.md: expiring grants, requests and short-lived credentials
- ARCHITECTURE.md: a map of the code, for people and coding agents
- RELEASING.md: how a release is cut and what it contains
- SECURITY.md: how to report a vulnerability
Contributing
Issues and pull requests are welcome. CONTRIBUTING.md has the setup, the checks CI runs and the sign-off every commit needs; the Code of Conduct applies to everyone taking part.
How this was built
tenishai is a small team of engineers who build with AI coding agents. Most of
this code was written in pairing sessions with Claude models in Claude Code: a
person set the design, directed the work and reviewed what landed, and the
agent wrote much of the code and docs. Many commits name the agent in a
Co-Authored-By: trailer, either a Claude model or Poe (earlier Raven), the
name of the agent one of us pairs with. A commit without a trailer may still
have had AI help.
In this repo, "Ember (SRE AI)" in docs and pull requests is the agent Shaz pairs with. Its commits name the Claude model in the trailer, not Ember.
License
MIT (see LICENSE).
Copyright (C) 2026 tenish and the bab contributors
Metadata
Release files for tenish-bab 0.4.29
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tenish_bab-0.4.29.tar.gz | 315.8 kB | Without provenance | Details for tenish_bab-0.4.29.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tenish_bab-0.4.29-py3-none-any.whl | Python 3 | none | any | Details for tenish_bab-0.4.29-py3-none-any.whl |
Total release size: 398.8 kB
Release files / tenish_bab-0.4.29.tar.gz
| Download URL | tenish_bab-0.4.29.tar.gz |
|---|---|
| Size | 315.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a4263cbcca20845e654cce0848845d25962a6a1af5896dd4aabda9cab67a73c
|
|
BLAKE2b-256 checksum How to use checksums |
fb348ae2fe3a14206d027cdc1764d855031e355eaae06abd6db40f2155bf5959
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / tenish_bab-0.4.29-py3-none-any.whl
| Download URL | tenish_bab-0.4.29-py3-none-any.whl |
|---|---|
| Size | 83.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5948d4a914026c6591d36b2e3d772144d2eb8447a6255dfd93bdcd8c0059b7dc
|
|
BLAKE2b-256 checksum How to use checksums |
c8178838aaf22ef5f025ebad31342aa7d5698a4b5b6916101d46d4a36693a746
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for tenish-bab 0.4.29
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.