Governance API & Agent Governance: Policy, Permissions, Reporting
Permissions-aware retrieval, audit, and compliance reporting
You'll be able to
- Explain how permissions-aware retrieval keeps an agent within the user's access
- Use governance signals β audit trails and reporting β to evidence agent behavior
Read first
Day 6 Lab
- Confirm how your agent authenticates (Glean describes OAuth and Glean-issued tokens) and that the token resolves to a real user.
- Run the same agent query as two different users; confirm each sees only what their permissions allow.
- Capture an audit record for each agent action: who, what, which sources, what decision.
- Sketch a compliance report from those records: a per-user, per-action trail you could hand an auditor.
Working Example: Permissions-Aware Retrieval with an Audit Record
Glean describes permissions-aware retrieval β results are scoped to the authenticated user's access β together with audit and reporting for agent activity. The token must resolve to a real identity; the agent then inherits exactly that identity's reach, no more. Every action emits an audit record you can roll up into a compliance report. Verified against developer_platform.
import os, json, datetime
from glean import Glean
_client = Glean(
instance=os.environ["GLEAN_INSTANCE"],
api_token=os.environ["GLEAN_API_TOKEN"], # resolves to a specific user
)
def governed_retrieve(query: str, user_id: str) -> dict:
"""Retrieve as the user, then emit an audit record for the action."""
resp = _client.client.search.query(query=query, page_size=5)
sources = [{"title": r.title, "url": r.url} for r in resp.results]
audit = {
"ts": datetime.datetime.utcnow().isoformat() + "Z",
"actor": user_id, # WHO the agent acted as
"action": "retrieve", # WHAT it did
"query": query,
"source_count": len(sources), # WHICH evidence (ids only β no payloads)
}
print(json.dumps(audit)) # ship to your audit sink / SIEM
return {"sources": sources, "audit": audit}
This is the GOVERN function in practice: identity decides what is returned, and the audit record proves what happened. The agent automates the work; the permission model and the trail keep a human able to answer "who saw what, and why." Verified against developer_platform.
Check for understanding
Why does permissions-aware retrieval matter more, not less, once an agent is doing the retrieving?
Check yourself
1. Glean describes three agent run-modes. Which list matches them?
2. When a host connects to Glean's MCP server with a scoped token, what happens to access?
3. In a guarded multi-tool agent loop, what is the job of the pre-action gate?
4. Across CrewAI, Google ADK, LangGraph, and the OpenAI Agents SDK, what does every Glean tool have in common?
5. Which statement about this curriculum is accurate?
In 10 seconds
βGlean describes governance over agents: permissions-aware retrieval so an agent never out-reaches its user, plus audit and reporting. Identity decides what's returned; the audit trail proves what happened.β
Capstone: Map Controls to NIST AI RMF and Evaluate Your Agent