Home / SDK / Python
Python SDK
Draft
Interface documented; the package is not yet published and the API is not live. Also available: JavaScript SDK.
On this page
Installation
The package name ametios-sdk is provisional — the package is not published to PyPI yet. The install command and client surface below describe the planned interface. Registry publication is on the roadmap.
Illustrative referencePlanned install command. Requires Python 3.11+.
pip install ametios-sdk
Authentication
The client reads an API key from the environment. Keys are scoped to a tenant at issuance (see API authentication). Never commit a key; load it from the environment or a secret manager.
Illustrative referenceClient construction. The endpoint URL is illustrative — no live endpoint exists in v1.
import os
from ametios import AmetiOS
client = AmetiOS(
api_key=os.environ["AMETIOS_API_KEY"], # required
tenant={
"organization": "org_9f2",
"workspace": "ws_billing",
"environment": "staging",
},
# endpoint is illustrative; the API is not live in v1
endpoint="https://api.ametios.dev/v1",
)
First governed action
The walkthrough below mirrors the execution chain: propose an action, let the platform authorize it, execute the governed transaction, and collect the evidence receipt.
Illustrative referenceFirst governed action: propose → authorize → execute → receipt.
import os
import sys
from ametios import AmetiOS
def main() -> None:
client = AmetiOS(
api_key=os.environ["AMETIOS_API_KEY"],
tenant={
"organization": "org_9f2",
"workspace": "ws_billing",
"environment": "staging",
},
)
# 1. Propose: validated against the registered action schema (stage 1).
proposal = client.actions.propose(
schema="billing.invoice.issue",
schema_version="1.2.0",
inputs={"customer_id": "cus_88412", "amount_cents": 45000, "currency": "USD"},
expectations={"expected_value_cents": 45000, "expected_cost_cents": 12, "risk_tier": "low"},
)
print("proposed:", proposal.action_id)
# 2. Authorize: deterministic policy evaluation (stage 4).
decision = client.actions.authorize(proposal.action_id)
print("decision:", decision.decision) # allow | deny | require-approval
if decision.decision == "deny":
print("denied by rule:", decision.trace.matched_rule)
return
if decision.decision == "require-approval":
print("parked for approval:", decision.approval.approval_id)
return # a human decides; see the approval-inbox reference
# 3. Execute the governed transaction (stage 5).
result = client.actions.execute(proposal.action_id)
print("executed in", result.duration_ms, "ms")
# 4. Collect the evidence receipt (stage 6) and verify it locally.
receipt = client.receipts.get(result.receipt_id)
ok = client.receipts.verify(receipt)
print("receipt valid:", ok, "| hash:", receipt.receipt_hash)
if __name__ == "__main__":
try:
main()
except Exception as exc:
print(exc, file=sys.stderr)
raise SystemExit(1)
Client surface
| Method | Description | Status |
|---|---|---|
AmetiOS(...) | Construct a tenant-scoped client | Draft |
client.actions.propose(...) | Validate and submit an action proposal | Draft |
client.actions.authorize(action_id) | Run deterministic policy evaluation | Draft |
client.actions.execute(action_id) | Execute the governed transaction | Draft |
client.receipts.get(receipt_id) | Fetch an evidence receipt | Draft |
client.receipts.verify(receipt) | Verify a receipt locally (hash recomputation) | Draft |
client.approvals.decide(approval_id, decision) | Record a human approval decision | Roadmap |
Related: JavaScript SDK (same surface), API reference (the endpoints this SDK will wrap), quickstart (run the chain locally today).