grantex-strands
Strands Agents SDK integration for the Grantex delegated authorization protocol - scope-enforced agent tools.
Wrap Strands tool functions with Grantex grant token scope checks so agents only receive tools they have been authorized to use.
Install
Version 0.2.0 is a breaking release requiring Python 3.11+ and
grantex 0.7+. Online tools forward audience to client.enforce().
The default verified mode checks signatures and scopes, not current
revocation. This helper has no amount extractor; for capped tools call
Grantex.enforce(..., amount=...) directly before execution. Do not use
caps_mode="warn" or "off" as production spend enforcement. See the
migration guide.
pip install grantex-strands grantex
You also need the Strands Agents SDK installed:
pip install strands-agents
Quick Start
from grantex_strands import create_grantex_tool
def get_calendar_events(date: str = "") -> str:
return f"events for {date}"
read_calendar = create_grantex_tool(
name="read_calendar",
description="Read upcoming calendar events",
grant_token=grant_token,
required_scope="calendar:read",
func=get_calendar_events,
)
# Pass read_calendar into your Strands agent tools list.
If the verified grant token does not include the required scope, create_grantex_tool raises PermissionError immediately and the tool is not created.
Enforcement Modes
Verified mode is the default. It verifies the grant token against JWKS and checks the verified scp claim:
tool = create_grantex_tool(
name="read_calendar",
description="Read upcoming calendar events",
grant_token=grant_token,
required_scope="calendar:read",
func=get_calendar_events,
)
Online mode delegates enforcement to a Grantex client:
tool = create_grantex_tool(
name="read_calendar",
description="Read upcoming calendar events",
grant_token=grant_token,
required_scope="calendar:read",
func=get_calendar_events,
client=grantex_client,
connector="calendar",
online=True,
)
API Reference
create_grantex_tool()
Creates a Strands-compatible tool with Grantex 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] |
Function to wrap |
jwks_uri |
str |
JWKS URL used to verify the grant token |
issuer, issuer_did, audience |
str | None |
Optional JWT claim validation settings |
clock_tolerance |
int |
Clock tolerance in seconds for token verification |
client |
Any |
Grantex client instance for online mode |
connector |
str | None |
Connector name for online mode |
online |
bool |
Use client.enforce() instead of offline JWT scope checking |
get_tool_scopes()
Returns the scopes embedded in a grant token. Invalid tokens return an empty list.
Requirements
- Python 3.11+
grantex >= 0.3.12strands-agents >= 0.1
Grantex Ecosystem
This package is part of the Grantex ecosystem. See also:
grantex- Core Python SDKgrantex-crewai- CrewAI integrationgrantex-openai-agents- OpenAI Agents SDK integrationgrantex-adk- Google ADK integration
License
MIT
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-strands 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| grantex_strands-0.2.2.tar.gz | 8.8 kB | Without provenance | Details for grantex_strands-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| grantex_strands-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for grantex_strands-0.2.2-py3-none-any.whl |
Total release size: 16.4 kB
Release files / grantex_strands-0.2.2.tar.gz
| Download URL | grantex_strands-0.2.2.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
989e3d3e9a1b5608deeafecf5b7992396223181eacd8a599260530f1f77ee296
|
|
BLAKE2b-256 checksum How to use checksums |
5f3e6b97575d534a0d7ce536b1e2f4a9abb4b982463142f53958c7f0c3de4b86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / grantex_strands-0.2.2-py3-none-any.whl
| Download URL | grantex_strands-0.2.2-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb40327cd32560d3a626257d20ddb45f8bdcfeeb8912bd20f5da2e5862495bed
|
|
BLAKE2b-256 checksum How to use checksums |
a4a0335f83ebac1b2652438f97c8d53d600755bfb9abb10826fc434e84d71e17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for grantex-strands 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.