cerbos
SDK for working with Cerbos: an open core, language-agnostic, scalable authorization solution
What it is and what it does
Cerbos is a Python SDK that connects your application to a Cerbos authorization service—a separate, language-agnostic policy engine that evaluates access control decisions. Instead of embedding authorization logic in your code, you define context-aware policies in Cerbos and query them via this client. The SDK provides two transport options (gRPC recommended for new projects, HTTP for backwards compatibility), both with sync and async support, plus an Admin API for policy management.
The library handles the protocol details: it serializes principals (users with roles and attributes), resources (the objects being accessed), and actions into protobuf messages, sends them to the Cerbos service, and returns whether an action is allowed or a query plan for filtering resources. It also supports Cerbos Hub for managed policy storage, Unix domain sockets, TLS configuration, and custom gRPC channel options.
Use it for:
- Check if a user can perform an action on a resource before executing application logic.
- Generate query plans to filter database results based on user permissions without fetching all records.
- Manage authorization policies centrally in Cerbos Hub and sync them via the Admin API.
- Build multi-tenant applications where permissions depend on department, geography, or team attributes.
- Implement async authorization checks in high-concurrency services using AsyncCerbosClient.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python client library for querying and managing authorization policies in a Cerbos authorization service, supporting both gRPC and HTTP protocols with sync and async modes.
Yes, if you are already running a Cerbos authorization service or planning to adopt one. The SDK is actively maintained, has no known vulnerabilities, and low install friction. It is purpose-built for Cerbos integration and not a general-purpose authorization library—install it only when Cerbos is your chosen policy engine.
Install
cerbos on PyPI
pip
pip install cerbosuv
uv add cerbospoetry
poetry add cerbosInstalling cerbos
Before you install
Low friction install with a pure-Python wheel. Active maintenance with a release 1 day old. Requires Python 3.10 or later and 12 runtime dependencies including gRPC, protobuf, and HTTP tooling.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install cerbos
from cerbos.sdk.grpc.client import CerbosClient
from cerbos.engine.v1 import engine_pb2
principal = engine_pb2.Principal(id="john", roles={"employee"})
resource = engine_pb2.Resource(id="XX125", kind="leave_request")
with CerbosClient("localhost:3593", tls_verify=False) as c:
if c.is_allowed("view", principal, resource):
print("Access allowed")
Requires a running Cerbos authorization service accessible at the specified host and port; Python 3.10 or later.
Verify before relying
- Performance characteristics and latency impact of gRPC vs HTTP client modes under typical load.
- Completeness of async API coverage relative to sync client.
- Admin API feature parity and stability guarantees.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 12 — dataclasses-json, requests-toolbelt, httpx, anyio, tenacity, grpcio-tools, types-protobuf, protoc-gen-openapiv2, googleapis-common-protos, protobuf, grpcio-status, circuitbreaker |
| Maintenance | actively maintained — 1 days since the last release |
| First released | |
| Downloads | 264,512/month — #8,337 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cerbos-0.16.0-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
authzedPython client library for SpiceDB that enables…
permissive · top 5,000 on PyPI
cerbos-sqlalchemyConverts Cerbos authorization query plans into…
permissive · top 15,000 on PyPI
zope.securityProvides a generic security framework for…
unclear · top 15,000 on PyPI
oauth2-clientHandles OAuth2 authentication flows…
unclear · top 15,000 on PyPI
oslo.policyoslo.policy enforces role-based access control…
permissive · top 15,000 on PyPI
invenio-records-permissionsDefines and enforces permission policies for…
permissive · top 15,000 on PyPI
cedarpycedarpy binds the Cedar Policy authorization…
unclear · top 15,000 on PyPI
grpclibgrpclib is a pure-Python asyncio-based…
permissive · top 1,000 on PyPI
propelauth-pyValidates access tokens and manages user…
permissive · top 15,000 on PyPI
grpcio-adminExposes debugging and monitoring services for…
permissive · top 15,000 on PyPI