skillfed

cerbos

SDK for working with Cerbos: an open core, language-agnostic, scalable authorization solution

cerbos v0.16.0 264.5K downloads/30d#8,337 on PyPI
Permissive license Apache-2.0 Active released

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 cerbos

uv

uv add cerbos

poetry

poetry add cerbos

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersTopic :: SecurityTopic :: Software Development :: Libraries

Tags

authorization policy clientcerbos sdk pythonaccess control policy enginepermission checking librarygrpc authorization clientpolicy decision point clientcontext-aware access control
authorizationpolicy-enginegrpc

More Libraries packages