Install
Quick Start
create_grantex_tool raises a PermissionError immediately — the tool is never created.
API Reference
create_grantex_tool()
Creates an OpenAI Agents SDK FunctionTool with offline scope enforcement.
| 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 |
get_tool_scopes(grant_token)
Returns the scopes embedded in a grant token (offline, no network call).
decode_jwt_payload(token)
Decodes the payload of a JWT without verifying the signature. Useful for inspecting token claims.
Requirements
- Python 3.9+
grantex>= 0.1.0openai-agents>= 0.0.3 (peer dependency)