Documentation Index
Fetch the complete documentation index at: https://docs.grantex.dev/llms.txt
Use this file to discover all available pages before exploring further.
What it does
This example demonstrates a realistic two-agent email automation workflow with comprehensive failure handling:- Register two agents — a planner (Agent A) and an executor (Agent B)
- Agent A reads calendar events after offline scope verification
- Agent A delegates
email:sendto Agent B (subset of its own scopes) - Agent B sends an email using the delegated, scoped permission
- Failure: unauthorized scope — Agent B tries
calendar:read(not delegated) and is rejected immediately - Failure: cascade revocation — Agent A’s grant is revoked, which automatically invalidates Agent B’s delegated token
- Recovery pattern — Agent B detects the revoked token and reports that a new delegation is needed
- Audit trail inspection — shows a timeline of all success and failure events across both agents
Prerequisites
- Node.js 18+
- Docker (Docker Desktop or Docker Engine with Compose)
Run
Start the local Grantex stack from the repository root:Expected output
Environment variables
| Variable | Default | Description |
|---|---|---|
GRANTEX_URL | http://localhost:3001 | Base URL of the Grantex auth service |
GRANTEX_API_KEY | sandbox-api-key-local | API key. Use a sandbox key for auto-approval |
Source code
The full source is inexamples/multi-agent-email-flow/src/index.ts.