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

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.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-openai-agents 0.1.7
File Size Uploaded
grantex_openai_agents-0.1.7.tar.gz 10.4 kB Details

Built distribution (wheel)

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

Total release size: 20.3 kB

Release files / grantex_openai_agents-0.1.7.tar.gz

Download URL grantex_openai_agents-0.1.7.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fa6b738bb59033ff172277dc4b45e6917a66dcffaa19496df31235766d81cc5b
BLAKE2b-256 checksum
How to use checksums
34ff912b9199995e5d7712f9fc6d2595d35e68ea9372d5a784bc803a6a53e0a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

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

Download URL grantex_openai_agents-0.1.7-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a27be1dd3977aaca34b00e7d8e54eaca22d004e61ff5365b18d8f36f5b8bf64
BLAKE2b-256 checksum
How to use checksums
a54a77695bfdd1c6fee5abaf8143715d1a4965bc6c96930cda24eb3a1ddcbc64
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