Skip to main content
A knowledge base agent answers questions from a mix of sources — each end user’s own documents (Notion, Google Drive, personal Confluence) and shared company-wide content (internal wikis, public runbooks). The same agent identity serves many users, and every read against a personal source must be scoped to the calling user’s data while shared sources stay pooled. Governance binds every call to a verified end-user identity, then splits backend authentication by source type. Per-user OAuth backends route each call with the calling user’s own upstream token, so per-user authorization is delegated to the upstream service. Shared backends use a single workspace credential for content the whole workspace should see. Cedar rules stay coarse-grained at the agent and backend level, field classifications redact sensitive document metadata before it reaches the model, and the audit trail captures both agent and end-user identity on every call.

Threat Model

Governance Approach

Implementation

1

Register the agent with required act-as identity

Register the agent so every request must carry a verified end-user identity:
With --actas-required, the gateway rejects any tool call without a verified act-as token. The per-user OAuth flow in step 2 keys credentials off this same act-as sub.
vp_workspace_oidc is a placeholder ID for a workspace verification provider. Create one for your IdP and pass its returned ID, or skip the provider step and inline the discovery URL on the agent with --actas-oidc-url <discovery-url>.
2

Configure a per-user OAuth backend for personal knowledge bases

Add the personal knowledge base as a per-user OAuth backend. Each end user provisions their own upstream credential through a magic-link flow on first use — the gateway never holds a single shared credential that could span users:
On the first call from a new user, the gateway returns a 401 with a magic-link provision_url. The user opens it, completes Notion’s OAuth consent against their own account, and the next tools/list reflects their newly provisioned backend.
3

Configure a shared backend for company-wide knowledge

Add the shared internal wiki as a shared OAuth backend. One operator-supplied credential serves every caller — appropriate for content the whole workspace should see:
4

Define agent-level Cedar rules

Write authorization rules that key off the agent identity and act-as presence — not per-user identity. Per-user authorization is delegated to the upstream service via the per-user OAuth credential:
See the Policy Example below for the Cedar rule content.
5

Simulate the rules

Test rules against historical events before deploying:
Verify that requests without an act-as token are denied for the personal backend and that write operations are universally forbidden.
6

Monitor provisioning and access patterns

Stream audit events to watch both per-user provisioning health and read activity:
Look for credential.provision_link.issued (a user hit the magic-link flow), oauth.consent.granted (a user successfully provisioned), oauth.token.refresh_failed (a user’s token needs re-consent), and mcp.tool_call.attempted events to see read patterns per user.

Policy Example

knowledge-agent-rules.cedar
Per-user OAuth keeps Cedar rules coarse-grained. The upstream service decides which documents the calling user can see, because the gateway forwards the user’s own access token. Cedar’s job is to gate which backends the agent can reach and to block reads when the user identity is missing — not to enumerate per-user document permissions.

Next steps