Catalog PyPI
PACKAGE EXPLORERView in registry

agent-authz

PyPI

A secure-by-default authorization PEP for APIs, Agent tools, RAG, and tasks

abacagentauthorizationmcppolicyragrbac
Versions collected1
Direct dependencies8From release 0.7.0b7
Last observed20 Oct, 21:31 UTC

README

Version 0.7.0b7 documentation

Agent Authz

Authorization integrity at the moment an Agent action executes.
One business operation · every registered path · one final decision before work happens.

Execution PEP CI status Public beta Python 3.11 or newer Apache 2.0 license

Quickstart Why Agent Authz Coverage evidence Documentation 中文说明

API, Agent Tool, MCP Tool, worker, and retrieval paths converge on one business operation before an allow or deny decision

Agent Authz is an embedded Python Policy Enforcement Point (PEP) for the moment an agent action actually runs. It maps a registered API route, Agent Tool, MCP Tool, retrieval boundary, or worker to a business operation; loads trusted tenant and resource facts; then allows or denies before protected data is returned or a side effect begins.

It works beside the policy system you already use. Your application continues to own identity, business data, transactions, and policy distribution.

The execution-integrity loop

1. Name the action2. Guard the execution3. Prove the coverage
Map document.publish once, rather than inventing a check per surface.Put the guard immediately before the route handler, Tool callable, MCP callable, retrieval result, or worker side effect.Compare registered paths, Catalog bindings, and final guards in CI.
API route ─┐
Agent Tool ├──> document.publish ──> trusted facts ──> allow / deny ──> side effect
MCP Tool  ─┤
worker    ─┤
retrieval ─┘

Start here

Clone the public Beta and run the dependency-free end-to-end example:

git clone https://github.com/FrankPlusPlus/agent-authz.git
cd agent-authz
python -m venv .venv
. .venv/bin/activate
python -m pip install -e .
python examples/secure_document_agent.py

It exercises the real model of the SDK—not a toy allow-list:

api_allowed=True          tool_allowed=True
tool_denied=True          cross_tenant_denied=True
permitted_chunk_ids=['chunk-public']
permit_status='consumed'  coverage_ready=True

Then follow the five-minute quickstart, or jump straight to FastAPI, Tool, MCP, and framework integrations.

Why Agent Authz

An agent can reach the same business action through far more than an HTTP endpoint. A route guard alone does not protect a Tool called directly; a policy engine alone cannot show whether every executable path applied that policy.

Keep usingAgent Authz adds
Casbin, OPA, Cerbos, OpenFGA, SpiceDBA common execution contract and a final guard at Python application boundaries.
FastAPI, MCP, agent frameworksA way to map their heterogeneous entrypoints to one operation vocabulary.
Your database and identity providerTrusted resource loading: tenant, ownership, and relations come from host-owned data, never model output.
Your CI and audit stackCoverage evidence, decision metadata, and privacy-safe audit primitives.

That is the product boundary: Agent Authz is not a PDP, IAM system, relationship database, vector database, agent framework, gateway, or hosted control plane. It is the thin runtime layer that keeps authorization from drifting at the execution boundary.

A minimal production-shaped guard

Define the resource and policy once. The loader is owned by the host service, so the model cannot assert tenant or relationship facts for itself.

from authz_sdk import Authz, Catalog, PolicySet, ResourceRegistry, Subject

catalog = Catalog()
catalog.resource("document", actions=("read",), relations=("viewer",), tenant_required=True)

policies = PolicySet()
policies.bind(
    id="document_viewers_read",
    operation="document.read",
    template="relation",
    relations=("viewer",),
)

documents = {
    "doc-1": {"tenant_id": "acme", "viewers": {"alice"}, "body": "Private launch plan"}
}
resources = ResourceRegistry()

def load_document(document_id, subject, context):
    row = documents.get(document_id)
    if row is None or row["tenant_id"] != subject.tenant_id:
        return None
    return {
        "id": document_id,
        "attributes": {"tenant_id": row["tenant_id"]},
        "relations": {"viewer": subject.id in row["viewers"]},
    }

resources.register("document", load_document)
authz = Authz.production(catalog, policies, resources)

decision = authz.can(
    Subject(id="alice", tenant_id="acme"),
    operation="document.read",
    resource_type="document",
    resource_id="doc-1",
)
assert decision.allowed

Put the same operation immediately around the callable that returns data or causes the effect:

from authz_sdk import AgentRuntime, protect_tool

runtime = AgentRuntime(authz)

@protect_tool(
    runtime=runtime,
    operation="document.read",
    subject=lambda call: call.kwargs["subject"],
    resource_type="document",
    resource_id=lambda call: call.kwargs["document_id"],
)
def read_document(*, subject, document_id):
    return documents[document_id]["body"]

Proof, not promises

Most authorization libraries can answer a policy question. Agent Authz also helps answer an operational question: did the application attach the final check everywhere it claims to?

CapabilityWhat it catches
CoverageManifestMissing final guards, missing declared data boundaries, and unmapped Catalog operations.
FastAPI route inventoryLive registered routes, mounted sub-applications, and matching Authz guards in FastAPI's assembled dependency graph.
CandidateFilterRetrieval candidates that must not enter an LLM prompt.
ExecutionPermit + RedisPermitStoreReplay of high-risk approvals across workers; shared-store outages fail closed.

Coverage evidence is intentionally scoped: FastAPI has strict evidence from its assembled dependency graph; generic Python Agent tools, MCP, and task registries are explicit host attestations unless their framework exposes an inspectable registry. The report labels these levels rather than pretending to scan arbitrary Python code or protect an unintegrated service. Read Coverage evidence for the exact contract.

Fits around your stack

SurfaceAvailabilityExecution boundary
Native core + Authz.production()AvailableCatalog, trusted resources, policy, final decision
FastAPIAvailable extraDependency guard before the handler
Python Agent ToolsAvailableSync/async callable guard before execution
MCP Python SDK 2.xBeta extraRegistered MCP Tool callable; host owns MCP authentication
Agno / LangGraphFoundation wrappersTool and node execution guards
CasbinAvailable extraExisting enforcer behind the common request/decision contract
OPA / Cerbos / OpenFGA / SpiceDBExperimental transportsFail-closed starter adapters, not complete vendor clients
RAGAvailable primitiveFilter candidates before prompt assembly

See the integration matrix, policy backend boundaries, and deployment patterns.

Production boundary

Agent Authz can fail closed for its own decision and permit store. The host application is still responsible for:

  • authenticating the caller and supplying a verified, request-local Subject;
  • loading tenant, ownership, and relationship facts from a trusted source;
  • placing the final guard immediately before a side effect;
  • routing each relevant execution path through a registered guard;
  • durable audit storage, query pushdown, key management, and outage policy.

For the exact threat model and multi-worker/microservice guidance, read the production guide, deployment patterns, and threat model.

Learn, evaluate, contribute

The public roadmap is in ROADMAP.md. Please read CONTRIBUTING.md before opening a pull request.

License

Apache-2.0. See LICENSE.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.7.0b74 Aug 20268

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

ACCESSIBLE
frankplusplus/agent-authz

Shared repository data · GitHub

License detected in repository
Apache-2.0
License branch / ref
main
Last push
19 Oct 2026
Archived
No
Contributor identities
— · partial collection

Public sponsor counts have not been collected. These signals belong to the repository owner.

Downloads & popularity

0count
Gauge · observed snapshots23 Oct 2026
10.50
2026-10-23: 0 · observed 2026-10-23T19:07:46.2089870Z
23 Oct23 Oct

github · 1 observations shown. Missing days are unknown.

View observed values
Date / source periodValueObserved at
2026-10-2302026-10-23T19:07:46.2089870Z

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:31 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:5d8ef47618773397a73903b9f003e1205bef6fb1b4acd83beb636c81e1f08e19