SPL (Safe Policy Lisp) evaluator for Agent-Safe capability tokens. 150 lines, zero deps, microseconds.
Project description
Agent-Safe SPL — Python SDK
Python implementation of the SPL (Safe Policy Lisp) evaluator for Agent-Safe capability tokens.
Install
pip install -e . # core (zero runtime deps)
pip install -e ".[crypto]" # with Ed25519/Merkle/hash-chain support
pip install -e ".[dev]" # with test dependencies
Usage
As a library
from spl import parse, verify
policy = parse('(and (= (get req "action") "read") (<= (get req "amount") 100))')
request = {"action": "read", "amount": 50}
env = {
"vars": {},
"per_day_count": lambda action, day: 0,
"crypto": {
"dpop_ok": lambda: True,
"merkle_ok": lambda t: True,
"vrf_ok": lambda d, a: True,
"thresh_ok": lambda: True,
},
}
result = verify(policy, request, env)
print("ALLOW" if result["allow"] else "DENY")
As a CLI
python -m spl examples/policies/family_gifts.spl examples/requests/gift_50_niece.json
# → ALLOW
Tests
pip install -e ".[dev]"
pytest tests/ -v
Requirements
- Python 3.10+
- Zero runtime dependencies for core evaluator
cryptographypackage optional for real Ed25519 verification
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_safe_spl-0.3.0.tar.gz.
File metadata
- Download URL: agent_safe_spl-0.3.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50dedd7c1f15d2cda080063a4590dc572258aa4a54435fd41f015e60279afa50
|
|
| MD5 |
cdc578ac56cf826f7ca342d8991b80f3
|
|
| BLAKE2b-256 |
c994fc3a2651b97df115d617ed59a7f83fbafa65b6fecf105b64456a3795ac97
|
Provenance
The following attestation bundles were made for agent_safe_spl-0.3.0.tar.gz:
Publisher:
publish.yml on jmcentire/agent-safe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_safe_spl-0.3.0.tar.gz -
Subject digest:
50dedd7c1f15d2cda080063a4590dc572258aa4a54435fd41f015e60279afa50 - Sigstore transparency entry: 1440416873
- Sigstore integration time:
-
Permalink:
jmcentire/agent-safe@73406158985a9715203405761bb3430dd4f85016 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/jmcentire
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@73406158985a9715203405761bb3430dd4f85016 -
Trigger Event:
release
-
Statement type:
File details
Details for the file agent_safe_spl-0.3.0-py3-none-any.whl.
File metadata
- Download URL: agent_safe_spl-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0d6d29f7de6c492e978330e5c68f74786ea42761aaf771e4f9ba8e95c51bb10
|
|
| MD5 |
fcde8457aad99228d89e8b11a073997f
|
|
| BLAKE2b-256 |
8d617a841ac2cb944acddc7ec06e750c03654777e7b5caa26e4605f69d1ea121
|
Provenance
The following attestation bundles were made for agent_safe_spl-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on jmcentire/agent-safe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_safe_spl-0.3.0-py3-none-any.whl -
Subject digest:
a0d6d29f7de6c492e978330e5c68f74786ea42761aaf771e4f9ba8e95c51bb10 - Sigstore transparency entry: 1440416940
- Sigstore integration time:
-
Permalink:
jmcentire/agent-safe@73406158985a9715203405761bb3430dd4f85016 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/jmcentire
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@73406158985a9715203405761bb3430dd4f85016 -
Trigger Event:
release
-
Statement type: