MachineID Python SDK
Official Python SDK for MachineID.
MachineID is an enforcement control plane — not an orchestrator. It provides a hard, authoritative allow / deny decision before code executes.
This SDK is designed for AI agents, workers, schedulers, and distributed systems that need centralized execution control without managing infrastructure.
Installation
pip install machineid-io
Prerequisite (Free Org Key)
MachineID provides a free organization key with no billing required.
- Visit https://machineid.io
- Create a free organization
- Copy your org key (starts with org_...)
Set it as an environment variable:
export MACHINEID_ORG_KEY=org_your_key_here
Quick Start (Hard Enforcement)
from machineid import MachineID
m = MachineID.from_env()
device_id = "agent-01"
# Register device (idempotent)
m.register(device_id)
# HARD GATE — MUST stop execution if denied
decision = m.validate(device_id)
if not decision["allowed"]:
print("Execution denied:", decision["code"], decision["request_id"])
raise SystemExit(1)
print("Execution allowed")
Validate Semantics (Critical)
validate() is the enforcement checkpoint.
You must stop execution immediately when:
decision["allowed"] is False
Validate returns authoritative decision metadata:
- allowed — boolean enforcement decision
- code — stable decision code (e.g. ALLOW, DEVICE_REVOKED, PLAN_NOT_ACTIVE)
- request_id — correlation ID for logs, audits, and support
Example response:
{
"allowed": false,
"code": "DEVICE_REVOKED",
"request_id": "fbf77ff5-06ed-42eb-8e07-024c32ef1e68"
}
Supported Operations
This SDK supports:
- register(device_id)
- validate(device_id) (POST, canonical)
- list_devices()
- revoke(device_id)
- unrevoke(device_id)
- remove(device_id)
- usage()
All calls authenticate via the x-org-key header and return raw API JSON.
Enforcement Rules
- register() does NOT restore revoked devices
- Only unrevoke() restores a device
- validate() is POST-only and authoritative
- Decision codes are stable and intended for programmatic handling
What This SDK Does NOT Do
This SDK intentionally does NOT:
- create organizations
- manage billing or checkout
- orchestrate agents
- perform analytics or metering
It is a pure enforcement client.
Environment-Based Setup
from machineid import MachineID
m = MachineID.from_env()
Version
import machineid
print(machineid.__version__)
Documentation
- Docs: https://machineid.io/docs
- Dashboard: https://machineid.io/dashboard
- Pricing: https://machineid.io/pricing
License
MIT
Metadata
Release files for machineid-io 0.1.6
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 |
|---|---|---|---|---|
| machineid_io-0.1.6.tar.gz | 3.8 kB | Without provenance | Details for machineid_io-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| machineid_io-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for machineid_io-0.1.6-py3-none-any.whl |
Total release size: 8.5 kB
Release files / machineid_io-0.1.6.tar.gz
| Download URL | machineid_io-0.1.6.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b260b105d5566f12466f3d7c0881f762f05a2d2c4223ce8edf36601c72b75b8
|
|
BLAKE2b-256 checksum How to use checksums |
8d21353c5a229d3a380ddcfc73980bc940e2d85c18c0a2843c162c2d9981060d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / machineid_io-0.1.6-py3-none-any.whl
| Download URL | machineid_io-0.1.6-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
183a23d4fe506f1a46957f4d6e1fdeebe9931b31f91ad12cb30f8dd8d4b0c32b
|
|
BLAKE2b-256 checksum How to use checksums |
de147007bf3423b3fa908f9eeee316630a1dc4b76bf618e95cee7c67bb163df8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for machineid-io 0.1.6
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.