Skip to main content

grantex-adk

Google Agent Development Kit (ADK) integration for the Grantex delegated authorization protocol — scope-enforced agent tools.

Wrap any function with Grantex grant token verification so your agents can only use tools they've been authorized for.

PyPI Python License

Homepage | Docs | Sign Up Free | GitHub

Install

pip install grantex-adk

You also need the Google ADK installed (it's a peer dependency):

pip install google-adk

Quick start

from grantex_adk import create_grantex_tool
from google.adk import Agent

# Create a scope-enforced tool from any function
read_calendar = create_grantex_tool(
    name="read_calendar",
    description="Read upcoming calendar events",
    grant_token=grant_token,       # JWT from Grantex authorization flow
    required_scope="calendar:read",
    func=get_calendar_events,      # your function
)

# Google ADK uses plain functions as tools — just pass them directly
agent = Agent(
    model="gemini-2.0-flash",
    name="assistant",
    tools=[read_calendar],
)

If the verified grant token doesn't include the required scope, create_grantex_tool raises a PermissionError immediately and the tool is never created.

API reference

create_grantex_tool()

Creates a plain function with the correct __name__ and __doc__ for ADK tool discovery, with JWKS-backed grant token verification.

Parameter Type Description
name str Tool name (becomes __name__)
description str Tool description (becomes __doc__)
grant_token str JWT grant token from Grantex
required_scope str Scope that must be present in the token
func Callable[..., str] The function to wrap
jwks_uri str JWKS URL used to verify the grant token
issuer, issuer_did, audience `str None`
clock_tolerance int Clock tolerance in seconds for token verification

get_tool_scopes()

Returns the scopes embedded in a grant token (offline, no network call).

decode_jwt_payload()

Decodes the payload of a JWT without verifying the signature. Useful for inspecting token claims.

Requirements

  • Python 3.9+
  • grantex >= 0.3.12
  • google-adk >= 0.2.0 (peer dependency)

Grantex Ecosystem

This package is part of the Grantex ecosystem. See also:

License

Apache-2.0

Ownership

Grantex is owned by Orchestrum Technologies LLP. Inventor and owner: Sanjeev Kumar. Ownership contact: sanjeev@orchestrum.in or mishra.sanjeev@gmail.com.

Authority hardening requires Python SDK 0.7.1 (current_authority), not just a valid JWT signature. Bind the audience and trusted human/agent identities, and check the issuer before every execution. This does not create human consent or automatically consume action decisions/spend caps. Existing offline defaults remain offline. Verify registry availability before installation. See the SDK execution authority guide.

Metadata

Release files for grantex-adk 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grantex-adk 0.1.8
File Size Uploaded
grantex_adk-0.1.8.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for grantex-adk 0.1.8
File Interpreter ABI Platform
grantex_adk-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 19.3 kB

Release files / grantex_adk-0.1.8.tar.gz

Download URL grantex_adk-0.1.8.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c9c9f928994cfa5b3f390209be22f0ebe8788ded6e86b5be89c8185406cabb93
BLAKE2b-256 checksum
How to use checksums
b328b72f48c021cf56e5f6d4d10e04336988e2b4b9ea746cec71676dffed7fca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / grantex_adk-0.1.8-py3-none-any.whl

Download URL grantex_adk-0.1.8-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4f99a52a00809555b0c60af34962d91dbcc4c08a7b6335de91db707839df9bb
BLAKE2b-256 checksum
How to use checksums
0f19ccc11bbf1093a037fecaa563a5e164a6416594a63d6a3c8744d54c612032
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page