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==0.1.7

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.7

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.7
File Size Uploaded
grantex_adk-0.1.7.tar.gz 10.0 kB Details

Built distribution (wheel)

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

Total release size: 19.7 kB

Release files / grantex_adk-0.1.7.tar.gz

Download URL grantex_adk-0.1.7.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
610c3e2ef0122e303bd51c30bd0896dd0479251a3516123113e162f544c09e35
BLAKE2b-256 checksum
How to use checksums
6967e1d30eb2dda477f3ab3d6bd296daa94057927f1129dd0f6fc290a81855de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

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

Download URL grantex_adk-0.1.7-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d2cf7815f65ab79baa9650738a02d2c59520324cc9e9691f0838b3113064f36
BLAKE2b-256 checksum
How to use checksums
8fc1ca650329f08cdcf1547336be4f48489287b6c854667f8e9ebcb5c4c0cf1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

0.1.8

2 release files

This release

0.1.7 This release

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