Skip to main content

grantex-openai-agents

OpenAI Agents SDK 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-openai-agents

You also need the OpenAI Agents SDK installed (it's a peer dependency):

pip install openai-agents

Quick start

from grantex_openai_agents import create_grantex_tool

# Create a scope-enforced tool from any function
tool = 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
)

# Use with any OpenAI Agents SDK agent
from agents import Agent
agent = Agent(name="assistant", tools=[tool])

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 an OpenAI Agents SDK FunctionTool with JWKS-backed grant token verification.

Parameter Type Description
name str Tool name
description str Tool description
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
  • openai-agents >= 0.0.3 (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-openai-agents 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-openai-agents 0.1.8
File Size Uploaded
grantex_openai_agents-0.1.8.tar.gz 10.1 kB Details

Built distribution (wheel)

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

Total release size: 19.9 kB

Release files / grantex_openai_agents-0.1.8.tar.gz

Download URL grantex_openai_agents-0.1.8.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8878c7c4dbe36ef5fdac3ee590a7433392a338336a78593cc68a3b4a917ecc54
BLAKE2b-256 checksum
How to use checksums
96c6b8df6ba5351beb83f7d130fa14102b79149c72688204740f1ed41c27fc83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

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

Download URL grantex_openai_agents-0.1.8-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc201d27cf3e5b73739e8e446bec17a9e61ba8ba7946542ea4c1a1f4d341de57
BLAKE2b-256 checksum
How to use checksums
242c6fcaf5e5c9dbd6a1d1d139d3aebc0d22cabcb5079bbb78af799e214a5b11
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