Python SDK for the Lyhna governance API
Project description
Lyhna Python SDK
Governance infrastructure for autonomous systems. Every action gets a cryptographic receipt — APPROVED, REFUSED, or ESCALATED — before it executes.
Install
pip install lyhna
Quick start
import os
from lyhna import bind
os.environ["LYHNA_API_KEY"] = "lyhna_..."
receipt = bind(
action_type="deploy_production",
intent="release_v3",
authority_tier="tier_2",
payload={"service": "api"},
)
if receipt.outcome == "APPROVED":
deploy()
elif receipt.outcome == "ESCALATED":
notify(receipt.escalate_to)
else:
log(receipt.outcome_reason)
Explicit client
from lyhna import LyhnaClient
client = LyhnaClient(api_key="lyhna_...", base_url="https://www.lyhna.com")
receipt = client.bind(
action_type="deploy_production",
intent="release_v3",
authority_tier="tier_2",
)
Async
from lyhna import AsyncLyhnaClient
async with AsyncLyhnaClient(api_key="lyhna_...") as client:
receipt = await client.bind(
action_type="deploy_production",
intent="release_v3",
authority_tier="tier_2",
)
Verify a receipt
from lyhna import verify_receipt
result = verify_receipt(receipt)
assert result["valid"] is True
Outcomes
| Outcome | Meaning |
|---|---|
| APPROVED | Action is authorized — proceed. |
| REFUSED | Action is denied — do not proceed. outcome_reason explains why. |
| ESCALATED | Action requires higher authority. escalate_to names who. |
Errors
| Exception | When |
|---|---|
LyhnaAuthError |
401 or 403 — bad or missing API key. |
LyhnaTimeoutError |
Request exceeded timeout. |
LyhnaError |
Any other API error. |
Links
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
lyhna-0.1.0.tar.gz
(4.5 kB
view details)
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
lyhna-0.1.0-py3-none-any.whl
(5.9 kB
view details)
File details
Details for the file lyhna-0.1.0.tar.gz.
File metadata
- Download URL: lyhna-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac4da2084e389fb931df94a2a8c035721ca2fb7562107f4bc53ea9e6845cfea6
|
|
| MD5 |
e690a11fc25b6bf5d90ed6869bbd193b
|
|
| BLAKE2b-256 |
b7c03609b4a11d6003744ac8548edbefb6213d26e0ed53b77ef7bf682532b589
|
File details
Details for the file lyhna-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lyhna-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26b5544c727caf5615b424659f8146df8e24e84036118631f44a069bb01dcd60
|
|
| MD5 |
de34adbfa3ac8bfc84e3c528209214f0
|
|
| BLAKE2b-256 |
339d996f57c3212f0bbb594467ab1b5fefa0e9ca007a8e68486e3e43a1eff5dd
|