---
title: How does relationship-based authorisation (Zanzibar, OpenFGA) apply to AI agents?
url: https://opencontroller.lyzr.com/blog/fine-grained-authorization-for-ai-agents
published: 2026-11-16
updated: 2026-11-16
author: Lyzr
---

# How does relationship-based authorisation (Zanzibar, OpenFGA) apply to AI agents?

**Relationship-based access control (ReBAC) decides access from relationships such as "Ana is a viewer of the Finance folder" and "this report sits in that folder". For AI agents, it answers the question roles cannot: can this agent, acting for this user, read this specific document right now? Run the check at retrieval time, per document, using the delegating user's relationships.**

Agents that search documents, tickets or records need document-level permissions. Without them, an agent becomes a way to read what the user could never open directly. ReBAC is one of the cleanest ways to model that.

This guide sits under [AI agent identity and on-behalf-of delegation](/blog/ai-agent-identity-on-behalf-of-delegation).

## What is Zanzibar, and what is ReBAC?

Zanzibar is Google's global authorisation system, described in a 2019 USENIX ATC paper. Google reported that it handles trillions of access control lists and millions of authorisation requests per second, with 95th-percentile latency under 10 milliseconds.

Its core idea is the **relationship tuple**: `object#relation@subject`. For example, `document:q3-plan#viewer@user:ana`. Permissions are computed by following relationships, including inherited ones such as folder to document.

Open-source systems implement the model. OpenFGA, created at Okta, joined the CNCF sandbox in September 2022 and became a CNCF incubating project in November 2025. SpiceDB is another Zanzibar-inspired implementation.

## How do you model an agent, a user and a document?

A minimal OpenFGA model:

```
model
  schema 1.1

type user

type folder
  relations
    define viewer: [user]

type document
  relations
    define parent: [folder]
    define viewer: [user] or viewer from parent
```

With tuples `folder:finance#viewer@user:ana` and `document:q3-plan#parent@folder:finance`, a check asks: is `user:ana` a `viewer` of `document:q3-plan`? The answer is yes, through the folder.

For an agent, combine two checks:

1. **Delegation check:** may this agent act for Ana on this data source? That comes from your [on-behalf-of delegation](/blog/ai-agent-identity-on-behalf-of-delegation) and agent policy.
2. **Resource check:** can Ana view this document? That comes from the ReBAC model.

The agent gets access only when both pass. The agent never gains access its user lacks.

## Should you check at retrieval or at indexing?

This is the biggest design decision for retrieval-augmented agents.

| Approach | How it works | Strength | Weakness |
|---|---|---|---|
| Check at index | Copy permissions into the vector index as metadata; filter queries by user | Fast queries | Permissions go stale when sharing changes |
| Check at retrieval | Retrieve candidates, then run an authorisation check per result | Always current | More latency; may need to over-fetch |
| Hybrid | Coarse filter at index (tenant, department), fine check at retrieval | Balanced | Two systems to keep consistent |

Stale permissions are the usual cause of agents surfacing files users should not see. If you check at index, re-sync on every sharing change, not on a nightly batch. See [controlling AI agent retrieval from vector databases](/blog/control-ai-agent-retrieval-from-vector-databases).

## When is ReBAC the right choice for agents?

Use this checklist:

1. **Access depends on sharing or hierarchy** — folders, projects, teams, customer accounts.
2. **Agents act for many different users** with different access.
3. **You need per-object answers**, not just per-application ones.
4. **Permissions change often**, and agents must reflect changes immediately.
5. **You need to explain decisions** — tuples show why access was granted.

If access depends mostly on attributes such as data class or time of day, attribute-based control may fit better. Many teams combine both. See [RBAC or ABAC for AI agents](/blog/rbac-vs-abac-for-ai-agents).

## What are the common mistakes?

- **Checking the agent's identity only.** A service account that can read everything defeats per-user permissions.
- **Caching decisions too long.** Revocations must take effect quickly.
- **Forgetting derived data.** Summaries and embeddings inherit the sensitivity of their sources.
- **Skipping the audit trail.** Log the user, agent, object and decision for each check.

## How Opencontroller does this

Opencontroller provides delegated on-behalf-of identity, so an agent acts with the user's identity rather than a broad service account, plus agent workload identity federation and OIDC SSO. Policy as code is extensible, so authorisation rules can be expressed and enforced across agents, and Posture flags risky permissions and configuration. See the [control plane overview](/blog/what-is-an-ai-agent-control-plane) or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Is ReBAC the same as Zanzibar?**
No. ReBAC is the access-control model. Zanzibar is Google's system that popularised it at scale. OpenFGA and SpiceDB are open implementations.

**Does ReBAC replace OAuth scopes for agents?**
No. Scopes limit what an agent's token can do. ReBAC decides which specific objects the user, and so the agent, can reach.

**Where should the check run for RAG?**
At retrieval, per result, using the delegating user. Index-time filtering alone goes stale.

## Key facts

Relationship-based access control (ReBAC) computes permissions from relationship tuples (object#relation@subject). Google's Zanzibar (USENIX ATC 2019) handles trillions of ACLs and millions of authorisation requests per second with p95 latency under 10 ms. OpenFGA, created at Okta, entered the CNCF sandbox in September 2022 and became a CNCF incubating project in November 2025; SpiceDB is another Zanzibar-inspired system. For agents, combine a delegation check (may the agent act for this user) with a resource check (can the user view this object), ideally at retrieval time. Opencontroller (by Lyzr) provides delegated on-behalf-of identity and extensible policy as code. Pricing starts from $250K per deployment per year.

## Related

- [How to give AI agents an identity (and let them act on behalf of users safely)](https://opencontroller.lyzr.com/blog/ai-agent-identity-on-behalf-of-delegation.md)
- [How do you control what an AI agent can retrieve from a vector database?](https://opencontroller.lyzr.com/blog/control-ai-agent-retrieval-from-vector-databases.md)
- [How do you stop AI agents surfacing overshared SharePoint files?](https://opencontroller.lyzr.com/blog/stop-ai-agents-surfacing-overshared-sharepoint-files.md)
- [More on Agent identity and access](https://opencontroller.lyzr.com/blog/cluster/agent-identity-and-access)
