Grantex is an open-source delegated authorization protocol and reference implementation for AI agents. It gives each agent a verifiable identity and scoped, time-limited, revocable authority from a human or organization, with multi-agent delegation, service-side verification, and audit records. Grantex complements OAuth 2.0 and MCP: OAuth handles application and user authorization, MCP connects models to tools, and Grantex proves which agent may perform which action for which principal.
Verified against npm, PyPI, and the Go module proxy on 12 July 2026. Grantex packages are independently versioned.
Implemented product areas; follow the linked docs for package-level status and limitations.
Offline consent bundles and on-device verification examples for Gemma agents.
Published OAuth endpoint package for single-process evaluation; review the v2.0.2 consent, state, and token-exchange limitations.
DPDP Act 2023 and EU AI Act control mappings, structured consent records, purpose limitation, and audit-ready exports.
Public directory of registered AI agent publishers with DID profiles, public keys, and DNS ownership verification; no compliance certification or embeddable badge widget is implied.
Four SQL-backed activity checks, finding lifecycle APIs, and stored custom-rule and channel configuration.
Decode claims locally, verify signatures with JWKS, and opt into a network-backed live revocation check.
Rate limiting, HTTP security headers, SDK retry, structured logging, deep health checks, transactions, and graceful shutdown.
enforce(), wrapTool(), and Express/FastAPI middleware with custom or pre-built tool manifests.
Concise, current answers for developers, search engines, and AI assistants choosing an authorization approach for autonomous agents.
Grantex is an open-source delegated authorization protocol and reference implementation for AI agents. It gives each agent a verifiable identity and scoped, time-limited, revocable authority from a human or organization, with multi-agent delegation, service-side verification, and audit records.
AI agent authorization replaces shared, all-or-nothing credentials with per-agent identity, least-privilege scopes, explicit approval, expiry, delegation constraints, revocation, and attributable audit records.
No. Grantex reuses OAuth-style authorization requests, consent, codes, scopes, and tokens, then adds agent identity, multi-agent delegation, and action attribution for autonomous agents.
Grantex complements OAuth 2.0 and MCP: OAuth handles application and user authorization, MCP connects models to tools, and Grantex proves which agent may perform which action for which principal.
Use @grantex/sdk@0.3.13 for TypeScript, grantex==0.3.14 for Python, and github.com/mishrasanjeev/grantex-go@v0.1.10 for Go. Review release status before upgrading because packages are independently versioned and Go v0.1.10 has documented workarounds.
No. Local JWT verification checks signature, issuer, audience, expiry, and scopes after JWKS retrieval. It does not prove current revocation unless the verifier performs an online state check or synchronizes revocation data.
Use a primary Grantex SDK to register the agent, request a grant, and exchange the authorization code, then enforce scopes at the service boundary with an SDK verifier or direct JWKS validation. Framework adapters are available for OpenAI Agents SDK, Anthropic, LangChain, CrewAI, Google ADK, Vercel AI, AutoGen, Express, FastAPI, and MCP.
No. @grantex/mcp-auth@2.0.2 is single-process evaluation software with process-local codes, metadata-only consent configuration, incomplete Grantex code handoff, and no live revocation lookup in middleware or introspection.
Open Agentic Commerce Protocol (OACP) is Grantex's agentic-commerce trust and artifact-authority layer. Grantex signs and verifies authority artifacts and adapter mappings; it is not a buyer or seller runtime, merchant connector, payment processor, order system, or point of sale.
No. The Grantex protocol specification is open and frozen at v1.0. The related Delegated Agent Authorization Protocol (DAAP) document is an individual IETF Internet-Draft for discussion, not an IETF-adopted or endorsed standard.
Enforce tool-level permissions on any connector you define. Bring your own manifests or use the 53 pre-built ones. Verification is local after key retrieval; reusable JWKS resolvers avoid repeat fetches while valid, but initial retrieval and rotation refreshes require network access.
Define manifests for any tool your agent calls — internal APIs, new SaaS tools, proprietary services. No waiting for a Grantex release. The enforce engine treats custom and pre-built manifests identically.
Custom Manifests Guide →# Any connector. 5 lines.
from grantex import ToolManifest, Permission
grantex.load_manifest(ToolManifest(
connector="my-crm",
tools={
"search": Permission.READ,
"create": Permission.WRITE,
"delete": Permission.DELETE,
},
))
# enforce() works immediately
grantex.enforce(token, "my-crm", "delete")
Works with any connector. 53 pre-built manifests included to get you started:
"35 AI agents, 53 pre-built connectors + 3 custom manifests for our internal APIs, 339+ tools — all scope-enforced through one grantex.enforce() call per tool execution."
— AgenticOrg · AI Virtual Employee Platform · Live in production
Today's AI frameworks offer no standard way to authorize, audit, or revoke what agents do on behalf of humans.
Agents invoke APIs, read files, and send emails — with no verifiable proof that a human consented. If something goes wrong, there's no audit trail to follow.
Once an agent has a credential, revoking it requires hunting down every token manually. There's no standard for instant, cascading invalidation across sub-delegations.
Compliance requires knowing exactly what each agent did, when, and under whose authority. Without a tamper-evident audit trail, you're flying blind.
Agents use shared secrets with no identity, no scoping, and no revocation. The numbers from 2025 speak for themselves.
Shai-Hulud worm — 500+ npm packages, 2.6B weekly downloads. Stole all cloud credentials from CI runners.
SANDWORM_MODE — 19 malicious npm packages installed rogue MCP servers in Claude Code, Cursor, and Windsurf. Targeted API keys from 9 LLM providers.
OpenClaw — 21,639 exposed instances publicly leaking OAuth tokens and plaintext credentials.
CVE-2026-21852 — Simply opening a crafted repo in Claude Code was enough to exfiltrate the developer's active Anthropic API key.
Read the full analysis: 4 Agent Security Breaches That Should Change How You Think About API Keys
Your agent reads an internal doc via MCP, is prompt-injected, and forwards confidential customer PII to an external endpoint. API key used: yours. Action log: empty. Authorization record: none.
In this scenario, no agent-specific consent record exists and the shared credential does not identify an approving principal.
Grantex can address this →A broadly privileged shared credential provides no agent-specific scope boundary.
Grantex can address this →Without execution-boundary logging, the deployment lacks an attributable agent-action record.
Grantex can address this →HashiCorp Vault, AWS Secrets Manager, Doppler, and identity providers already offer important controls. Grantex adds agent-specific delegated authority at the action boundary; it does not replace those systems.
Manage human and application identity, store credentials, apply provider policies, rotate or revoke access, and retain provider audit records. Exact capabilities vary by product and configuration.
Grantex grant tokens can bind an agent, approving principal, scopes, expiry, and delegation context. Attributable action records require integration at the execution boundary.
The protected service verifies the exact scope and current authorization state before acting, then uses or exchanges the upstream credential only after that decision.
Evidence review: Read the documentation-based 15-project authorization review · See architecture comparisons
OWASP guidance, the EU AI Act, and the NIST AI RMF all increase the focus on identity, authorization, human oversight, and auditability. Grantex supplies technical building blocks; each deployer remains responsible for its own compliance assessment.
ASI-01: Goal hijacking · ASI-03: Identity abuse · ASI-05: Privilege escalation · ASI-10: Rogue agents. Grantex supports relevant mitigations with scoped grants, per-agent DIDs, delegation invariants, and central revocation.
Application dates vary by obligation and system classification; consult the current European Commission timeline. Grantex provides technical controls that may support risk, transparency, and oversight programs.
Govern 1.1: Accountability · Map 5.1: Attribution · Measure 2.5: Audit trails. Grant tokens can carry principal context, and configured audit integrations can produce hash-chained exportable records.
Full mapping: Compliance Matrix · OWASP deep-dive blog post
Five steps from consent to revocation, all enforced by cryptography.
Your app calls POST /v1/authorize
with the agent ID, user ID, and requested scopes. Grantex returns
a consent URL — redirect the user there.
The user sees exactly what the agent wants to do, described in plain English. One click — approved. Your redirect callback receives an authorization code.
Call grantex.tokens.exchange({ code, agentId })
to swap the authorization code for a signed RS256 JWT grant token
(JTI-tracked, scoped, time-limited).
Present the token to any microservice. It validates the RS256 signature
and claims using keys retrieved from the public JWKS endpoint, or calls
POST /v1/tokens/verify for
the authorization service's current revocation status. Supported
integrations can reuse cached keys between verifications.
Call POST /v1/tokens/revoke.
The JTI is blocklisted in Redis immediately. All sub-delegated tokens
derived from this grant are invalidated in the same operation.
Choose an SDK. These pinned commands reproduce the releases verified above; each follows the same consent, token exchange, and verification lifecycle.
// npm install @grantex/sdk@0.3.13 import { Grantex, verifyGrantToken } from '@grantex/sdk'; const grantex = new Grantex({ apiKey: 'YOUR_API_KEY' }); // 1. Request authorization; live mode returns the code to your callback. const auth = await grantex.authorize({ agentId: 'ag_01J...', userId: 'usr_01J...', scopes: ['calendar:read', 'email:send'], audience: 'https://api.example.com', }); if (!auth.code) { console.log(`Approve access at: ${auth.consentUrl}`); // Exchange the callback's code in your redirect handler. } else { // 2. Sandbox or policy auto-approval can return a code immediately. const token = await grantex.tokens.exchange({ code: auth.code, agentId: 'ag_01J...' }); // 3. Verify locally; retrieving or refreshing JWKS may use the network. const grant = await verifyGrantToken(token.grantToken, { jwksUri: 'https://api.grantex.dev/.well-known/jwks.json', audience: 'https://api.example.com', }); console.log(grant.scopes); // ['calendar:read', 'email:send'] }
# python -m pip install grantex==0.3.14 from grantex import AuthorizeParams, ExchangeTokenParams, Grantex client = Grantex(api_key="YOUR_API_KEY") # 1. Request authorization; live mode returns the code to your callback. auth = client.authorize(AuthorizeParams( agent_id="ag_01J...", user_id="usr_01J...", scopes=["calendar:read", "email:send"], audience="https://api.example.com", )) if not auth.code: print(f"Approve access at: {auth.consent_url}") # Exchange the callback code in your redirect handler. else: # 2. Sandbox or policy auto-approval can return a code immediately. token = client.tokens.exchange(ExchangeTokenParams(code=auth.code, agent_id="ag_01J...")) # 3. Use the token — scopes, grant ID, and JWT are available. print(token.scopes) # ('calendar:read', 'email:send') print(token.grant_token) # RS256-signed JWT
// go get github.com/mishrasanjeev/grantex-go@v0.1.10
package main
import (
"context"
"fmt"
"log"
grantex "github.com/mishrasanjeev/grantex-go"
)
func main() {
ctx := context.Background()
client := grantex.NewClient("YOUR_API_KEY")
auth, err := client.Authorize(ctx, grantex.AuthorizeParams{
AgentID: "ag_01J...",
PrincipalID: "usr_01J...",
Scopes: []string{"calendar:read", "email:send"},
Audience: "https://api.example.com",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(auth.ConsentURL)
token, err := client.Tokens.Exchange(ctx, grantex.ExchangeTokenParams{
Code: "authorization-code-from-callback",
AgentID: "ag_01J...",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(token.GrantToken)
}
# npm install -g @grantex/cli # All commands support --json for AI agent / script use # 1. Request authorization (sandbox auto-approves) grantex authorize --agent ag_01J... --principal user_123 \ --scopes calendar:read,email:send # 2. Exchange the code for a grant token grantex tokens exchange --code <code> --agent-id ag_01J... # 3. Verify the token grantex tokens verify <jwt> # Machine-readable output grantex --json grants list | jq '.[0].grantId'
MPP defines a machine-payment flow. Grantex can attach signed agent, principal, category, and spending-limit claims that an integrating merchant verifies and enforces; Grantex does not execute or guarantee a payment.
Open Agentic Commerce Protocol (OACP) is Grantex's agentic-commerce trust and artifact-authority layer. Grantex governs policy, internal artifact issuance or refusal, verification, and compatibility adapters. AgenticOrg runs seller and buyer agents, Shopify connector runtime, buyer surfaces, purchase preparation, and Offline POS handoff orchestration. Merchant, POS, and payment providers remain source of record for final execution.
W3C VC 2.0 binding agent identity, human delegation, spending limits, and 9 MPP categories into one credential.
Merchants verify locally — signature, expiry, category, and amount in a single call. A warm JWKS cache avoids repeat fetches; initial retrieval and refresh require network access.
Look up registered organizations by DID and inspect DNS-verified domain ownership. Public reads require no API key.
import { requireAgentPassport } from '@grantex/mpp'; // One line to protect any route app.use('/api/inference', requireAgentPassport({ requiredCategories: ['inference'], maxAmount: 10, })); // req.agentPassport is populated: // humanDID: did:grantex:user_alice // orgDID: did:web:acme.com // categories: [inference, compute] // maxAmount: 50 USDC // depth: 0 (direct grant)
const passport = await grantex.passports.issue({ agentId: 'ag_01HXYZ...', grantId: 'grnt_01HXYZ...', allowedMPPCategories: ['inference', 'compute'], maxTransactionAmount: { amount: 50, currency: 'USDC' }, }); const mw = createMppPassportMiddleware({ passport });
x402 supports HTTP 402 payment flows. Grantex can add signed agent and spend-policy claims that the protected API must verify and enforce before acting.
x402 payment evidence does not by itself establish agent-specific delegated authority. Without a separate policy check, a wallet or payment handler may accept requests broader than intended.
A GDT (Grantex Delegation Token) is a W3C Verifiable Credential that carries signed claims for the approving principal, scope, amount limit, and expiry; the protected service must verify and enforce those claims.
Configured issuance and verification events go to the selected audit logger. The default x402 logger and revocation registry are in memory; durable multi-process enforcement requires host-provided shared implementations.
import { generateKeyPair, issueGDT } from '@grantex/x402'; const principal = generateKeyPair(); const agent = generateKeyPair(); const gdt = await issueGDT({ agentDID: agent.did, scope: ['weather:read'], spendLimit: { amount: 10, currency: 'USDC', period: '24h' }, expiry: '24h', signingKey: principal.privateKey, });
import { x402Middleware } from '@grantex/x402'; app.use('/api/weather', x402Middleware({ requiredScopes: ['weather:read'], requiredAmount: 0.001, currency: 'USDC', })); // req.gdt is populated: // agentDID: did:key:z6Mk... // principalDID: did:key:z6Mk... // remainingLimit: 9.999 // scopes: [weather:read]
Drop Grantex into any AI framework or language runtime.
End-to-end examples for every SDK and framework integration. Clone the repo, start the local stack, and run.
Core authorization lifecycle — register agent, authorize, exchange code, verify the token locally using JWKS, log an audit entry, and revoke.
Same core flow in Python — register, authorize, exchange, verify locally using JWKS, audit, and revoke using the Python SDK.
Scoped tools with automatic audit callbacks. Create tools via
createGrantexTool,
attach audit handler, invoke.
Vercel AI SDK tools with Zod schemas, scope enforcement, and
withAuditLogging
wrapper. Works with generateText.
CrewAI tools with local JWKS-backed scope enforcement and audit logging. Demonstrates PermissionError on unauthorized scopes.
OpenAI Agents SDK tools with Grantex scope enforcement.
Uses @function_tool
decorator pattern with local JWT scope checks backed by retrieved JWKS keys.
Google Agent Development Kit tools with Grantex scope enforcement. Plain functions with docstrings — no decorator needed.
Strands tools with Grantex scope enforcement at creation time.
Supports local JWKS-backed JWT scope checks and online
client.enforce()
verification.
Core authorization lifecycle in Go — register agent, authorize, exchange code, verify the token locally using JWKS, log an audit entry, and revoke.
Anthropic SDK tool use with Grantex scope enforcement and audit logging.
Uses GrantexToolRegistry
to manage tools and dispatch tool_use blocks.
Interactive Next.js app with the full Grantex consent flow — agent registration, consent UI, token exchange, and audit logging.
Delegation chain pattern (SPEC §9) — parent delegates scoped subset to child agent with cascade revocation.
Agent-to-agent email automation with delegation, scope enforcement, failure handling, cascade revocation, and audit trail inspection.
Gemma 4 on-device agent with offline authorization via consent bundles. Verifies every tool invocation locally — no internet required at runtime.
AI agent uses a Grantex Delegation Token with x402 to fetch paid API data — automatic 402 → pay → retry flow.
Time-bound grant tokens with automatic expiry detection, refresh token rotation, and single-use refresh enforcement.
Query, filter, and analyze the audit trail with metrics computation and hash chain integrity verification.
Grantex gateway as a reverse proxy with YAML config and scope enforcement. Authorized requests pass through, unauthorized requests are rejected.
GoogleCalendarAdapter with automatic grant token verification, scope checking, and audit logging. Shows read-only vs read-write enforcement.
Published security assessment, individual IETF Internet-Draft, open source.
No critical findings were identified. The single high-severity finding was fixed during the engagement; the report and remediation notes are public.
Controls for Security, Availability, and Confidentiality are mapped to SOC 2 criteria. Formal third-party attestation is not published.
The Grantex wire protocol is an open IETF Internet-Draft
(draft-mishra-oauth-agent-grants-01),
built on the OAuth 2.0 framework. It is an individual submission for
discussion, not an IETF-adopted or endorsed standard.
The 29-package monorepo runs unit, integration, end-to-end, and security workflows. GitHub Actions is the source of truth for current pass/fail status.
Connect with developers building the trust layer for AI agents.
Ask questions, share what you're building, and get help from the community and maintainers.
Propose RFCs, ask design questions, and participate in protocol discussions.
Grantex is Apache 2.0 licensed. Star the repo to follow releases and show your support.
Define fine-grained scope restrictions, rate limits, and time-bound grants per agent or team.
Sync agents and principals from your identity provider automatically.
OIDC and SAML 2.0 support multi-IdP routing, JIT provisioning, group-to-scope mapping, and enforcement. LDAP is a direct-bind preview that does not search directories or retrieve groups.
Scheduled and on-demand checks for four implemented activity patterns, with lifecycle APIs for stored findings.
JSON exports of grant and audit records for internal control and evidence review.
Self-host the entire stack with our production Docker Compose configuration.
Encrypted per-user credential store. Agents exchange grant tokens for upstream service credentials.
Fastify OAuth 2.1 + PKCE endpoint package with dynamic client registration; v2.0.2 limitations are documented.
Real-time SSE and WebSocket streams; optional @grantex/destinations consumers can forward events to Datadog, Splunk, S3, BigQuery, or Kafka.
Per-grant spending limits with atomic debit, threshold alerts, and JWT budget claims.
Structured JSON logging (pino), Prometheus metrics, OpenTelemetry tracing, and Grafana dashboard templates out of the box.
Manage agents, policies, webhooks, and budgets as infrastructure with the official Terraform provider.
Pluggable policy engines — delegate authorization to Open Policy Agent or AWS Cedar.
Manage policies in Git with versioned bundles and automatic sync via webhooks.
Grantex grant tokens inside Google A2A agent-to-agent communication. TypeScript and Python.
Real-time API usage tracking with Redis counters, daily rollup, and per-plan rate limits.
Register and verify your domain via DNS TXT records. Runtime traffic routing on your domain is on the roadmap.
Cryptographic human presence verification via passkeys. Biometric, security key, or platform authenticator — embedded as evidence in Verifiable Credentials.
Portable, tamper-evident authorization proof in W3C VC-JWT format. Any verifier can validate using the published DID document — no Grantex account needed.
Privacy-preserving credential presentation. Holders choose exactly which claims to reveal — minimum disclosure for each verifier.
W3C DID document at did:web:grantex.dev with RS256 and Ed25519 public keys for local credential and token verification after key retrieval.
Rate limiting on every endpoint, HTTP security headers (HSTS, CSP, X-Frame-Options), HMAC-signed SSO state, timing-safe auth, scope validation, and 1MB body limits.
All three SDKs (TypeScript, Python, Go) include exponential backoff with jitter, Retry-After header support, and configurable max retries for transient failures.
Deep health checks (DB + Redis), config validation on startup, graceful shutdown, connection pooling, database transactions, and structured JSON logging.
We work directly with engineering and security teams to design the right integration. Contact us to discuss deployment, support, and service-level requirements.