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.
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.12openai-agents >= 0.0.3(peer dependency)
Grantex Ecosystem
This package is part of the Grantex ecosystem. See also:
grantex— Core Python SDK@grantex/sdk— TypeScript SDKgrantex-crewai— CrewAI integrationgrantex-adk— Google ADK integration@grantex/mcp— MCP server for Claude Desktop / Cursor / Windsurf
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)
| File | Size | Uploaded | |
|---|---|---|---|
| grantex_openai_agents-0.1.8.tar.gz | 10.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|