Skip to content

Delegated Authorization for AI Agents — new self-guided workshop - #8

Open
sohanmaheshwar wants to merge 27 commits into
mainfrom
workshop/delegated-agent-authorization
Open

Delegated Authorization for AI Agents — new self-guided workshop#8
sohanmaheshwar wants to merge 27 commits into
mainfrom
workshop/delegated-agent-authorization

Conversation

@sohanmaheshwar

Copy link
Copy Markdown
Contributor

Delegated Authorization for AI Agents

A new self-guided, ~90-minute workshop that teaches delegated, fine-grained authorization for AI agents by building a DevOps deploy agent on goose and gating every action with SpiceDB (ReBAC).

It follows the same format as agentic-rag-authorization: a stubbed starter/ where learners write the schema and decision engine themselves, module-by-module.

What it covers

Module What you do
Setup Docker/Codespaces, deps, optional goose
Part 1 — Run the agent Run it ungated and watch it over-reach (destroy production)
Part 2 — Delegated authorization Write the ReBAC schema + the three-way decide() (ALLOWED / NEEDS_APPROVAL / BLOCKED)
Part 3 — Time-bound & revocable Expiring grants for incident windows + instant revocation
Part 4 — Relationship-based hierarchy gated_by — revoking staging suspends production (contingent evaluation, not a cascading delete)
Next steps Bulk checks, scaling ReBAC, AuthZed Cloud/Dedicated

Notes

  • Web UI is the primary path — every part is completable with no LLM key; driving it with a live goose session is an optional step on each page.
  • Relationship expiration is used flag-free (GA in current SpiceDB).
  • Includes a Sandworm-styled architecture diagram in Setup (images/fig1-permission-check.svg).
  • Full reference implementation: https://github.com/sohanmaheshwar/goose-spicedb-delegation

Still open

  • 0-setup.md has a <!-- TODO --> to verify the Codespaces flow on a live Codespace before the conference.

Author 1-run-the-agent.md: quotes the authz.decide() WORKSHOP STUB, walks the
goose over-reach (deploy + destroy production both ALLOWED with no boundary),
the deterministic scripts/verify.py --checkpoint 1 path, and the ambient-
authority takeaway. No web UI in this checkpoint (no schema until CP2).

Also fixes a real bug found while verifying the goose path: deploybot_server's
_load_state() crashed with FileNotFoundError on a fresh checkout because
infra_state.json is only ever created by the web UI's /api/reset (CP2+), never
by bootstrap.py or on first run. Treat a missing file as "no environments" so
list_environments/deploy/destroy work before the web UI has ever run.
…oints

Prose-only pass over README + 0-5 checkpoint docs: stripped AI-writing tells
(em-dash overuse, rule-of-three, negative parallelism, -ing pileups, promotional
words, inline-header bold lists, hedging) and brought the voice toward Sohan's
(direct claims, analogy-first concept intros, contractions, dry restrained asides).
All fenced code, commands, paths, Next links, and Completion Milestone checkboxes
verified unchanged; starter code untouched.
Operate the deploybot entirely through the web UI (plus the optional goose
session). Remove the deterministic CLI verifier and the CLI approve/revoke
paths so learners drive every checkpoint from one surface.

- Delete starter/scripts/verify.py; drop all `scripts/verify.py --checkpoint N`
  references and "deterministic path" framing across every checkpoint.
- Replace `python approve.py ...` / `python revoke.py ...` steps with the
  web UI buttons (Approve prod · 10m, Revoke staging, Revoke prod).
- CP3: replace `bootstrap.py --window-minutes 0` with a new "Grant staging ·
  30s" button (web.py /api/grant-short) so learners watch a grant expire live
  in the authority bar instead of seeding an already-expired grant.
- CP1: the web UI is now the primary over-reach path; goose is optional.
- CP4: fix the revive step — re-grant staging via "Grant staging · 30s"
  (which writes only staging); `bootstrap.py` would wipe the prod grant via
  _reset_agent_grants and break the suspend-not-erase demo.
- Relationship expiration is a built-in SpiceDB feature as of v1.56: drop the
  `--enable-experimental-relationship-expiration` flag from docker-compose
  (plain `serve`) and the flag note from 0-setup.
- Make /api/state fully defensive so the UI loads in CP1 (no schema yet).

Verified end to end on SpiceDB v1.56.1: CP1 no-schema tolerance + over-reach,
the 3-way decision, short-grant expiry, approve/revoke, and the gated_by
cascade (revoke staging suspends production).
Add a "Two ways to drive the agent" note to 0-setup: the whole workshop is
completable with just the web UI (no LLM key, no goose install), and every
checkpoint also offers an optional goose step.

- Add a dedicated "Drive it with goose (optional)" step to Checkpoint 3
  (grant/revoke → deploy staging) and Checkpoint 4 (cascade → deploy
  production), so all four checkpoints carry the optional goose path
  consistently (CP1 and CP2 already had one).
- Includes prose edits to 0-setup and Checkpoint 1.
Terminology: rename "Checkpoint N" → "Part N" across all modules (headings,
cross-references, module map, links, completion milestones) and in web.py's
comments.

Inline glosses for concepts a reader new to authz/ReBAC/SpiceDB would trip on:
- CP1: gloss MCP (Model Context Protocol) at first use.
- CP2: explain the schema DSL — `relation name: type` is a subject-type
  constraint, and relations (stored edges) vs permissions (computed on every
  check).
- CP2: decode the relationship-tuple notation `resource#relation@subject`
  the first time a full tuple appears.

Preserves the author's in-flight prose edits across CP0–CP4.
Complete the Checkpoint → Part terminology rename in the shipped starter
stubs (authz.py, schema.zed, bootstrap.py), so the code a learner opens
matches the Part N language in the docs. Starter reset to stubs.
Export the "what you'll build" permission-check diagram (Sandworm style,
embedded Inter + JetBrains Mono) as a self-contained SVG under images/, and
embed it just below the Introduction in 0-setup.md.
…oybot extension

Replace the ambiguous 'follow goose-extension.md' step with an explicit
goose configure prompt-by-prompt flow: the absolute command path (venv
python + deploybot_server.py) and the three env vars.
Export the Part 2 relationship graph (Sandworm style, playground-style
layout, embedded JetBrains Mono) as a self-contained SVG under images/, and
embed it at the end of the 'Permissions are a graph, not a table' section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant