Skip to main content

Google ADK integration for the Grantex delegated authorization protocol — scope-enforced agent tools

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grantex_adk-0.1.5.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grantex_adk-0.1.5-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file grantex_adk-0.1.5.tar.gz.

File metadata

  • Download URL: grantex_adk-0.1.5.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for grantex_adk-0.1.5.tar.gz
Algorithm Hash digest
SHA256 02a716f8b8eba5689a67b8e1603a240df159b9b2275be1cb3e4e6e5e2e0a23cb
MD5 cbb0a344d185bb3500dae8272159e795
BLAKE2b-256 2d4ca352498e4b2c46168aaff11ae871ec7601da0f9b503a2236bc4fdad5cc26

See more details on using hashes here.

File details

Details for the file grantex_adk-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: grantex_adk-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for grantex_adk-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 971e837efa785d62e08ca3026af94388155709170351a6cc0a94927cc71abe4d
MD5 64019b7c2fbc9be9af82f0aebf824c83
BLAKE2b-256 4654e0eea05bf200f4111d763f809ac131321764be7c4f5d78fcc440485c2fff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page