prismnetwork
Headless GPU leasing on Prism Network for autonomous
agents, the Python counterpart to @prismnetwork/agent-sdk. Give it a wallet; it
authenticates with a signature, pays on-chain in USDG, provisions a GPU, and runs
over SSH. No browser, no dashboard.
pip install prismnetwork
from prismnetwork import PrismAgent, DEFAULT_IMAGE
agent = PrismAgent(private_key=AGENT_KEY, escrow="0xfD4228eEEfC49e4b76A0CD40af9fdd546220B2FD")
agent.authenticate()
lease = agent.lease(image=DEFAULT_IMAGE, duration_seconds=600, min_vram_mib=16000)
out = agent.run(lease, "nvidia-smi")
print(out["stdout"])
agent.end_lease(lease)
What it does
authenticate() signs a challenge with the wallet and exchanges it for a bearer
session. lease() gets a quote, funds an on-chain USDG escrow bound to the quote
(createLease), waits for the GPU to provision, and returns SSH access. run()
executes a command over SSH, retrying through the host's sshd warmup. Metering is
per-second; each lease settles on-chain with a verifiable receipt.
Read-only helpers: offers(), balances(), leases(), quote(...), access(id).
Which machine answered
Every session run() opens checks the SSH host key on the far end, and
host_key_policy(lease.access) says what that check was worth:
from prismnetwork import host_key_policy
host_key_policy(lease.access)
# {"mode": "attested" | "reported" | "unverified", "fingerprint": ..., "source": ...}
attested means the fingerprint comes out of a hardware report whose signed data
commits to the key the guest generated at boot. Prism walks that report and puts
the fingerprint on the access grant, and the SDK refuses a session whose host key
does not match it, so the operator cannot put a different machine on the other
end. The report is checked in our control plane rather than here, so attested
says we checked it and this client holds the session to what we published.
reported means the node named the key on the signed report that opened
access, which rules out the relay and the network path but not the operator,
whose bond is what a dispute reaches instead.
unverified means nobody published a key: capacity brokered from a public
cloud has its host key generated by the cloud and never shown to the network, so
the key is recorded on first sight and held for the rest of the lease.
Your own ~/.ssh/known_hosts is never touched. The record sits beside the
lease's private key and is removed with it by end_lease().
PrismAgent(..., require_host_key=True) refuses to open a session on a lease
that publishes no key, rather than trusting whichever machine answers first.
Batch
Pass command= to lease() and the node runs that one command and reports its
output instead of granting SSH access:
batch = agent.lease(image=DEFAULT_IMAGE, duration_seconds=600, command="nvidia-smi")
print(batch.result["stdout"])
Batch leases match only suppliers at trust class isolated or above, because the
broker path has no signed result channel. Commands are capped at 8 KiB and output
at 64 KiB per stream. result(lease_id) and wait_for_result(lease_id) read the
output of an already-funded batch lease.
Paying an x402 endpoint
Prism's pay-per-call endpoints take a transfer plus a signature over what the
transfer buys, so a payment can only be redeemed against the request it was made
for. payment_header builds the X-PAYMENT value:
from prismnetwork import payment_header
body = json.dumps({"model": "llama3.2:3b", "prompt": "what is a prism"}).encode()
header = payment_header(agent.account, tx_hash, body)
Pass the bytes the request actually carries. bound_message and hash_request
are exported for a client that builds the envelope itself; they produce the same
message the Node SDK signs.
The wallet needs USDG (0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168, 6 decimals) and
native Robinhood-Chain gas.
Requires ssh, ssh-keygen and ssh-keyscan on PATH. Chain id 4663, RPC
https://rpc.mainnet.chain.robinhood.com.
Prism is pre-production and unaudited. A permissionless supplier is not a trusted computing environment; do not lease with a wallet or workload you cannot lose.
Metadata
Release files for prismnetwork 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| prismnetwork-0.3.1.tar.gz | 17.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| prismnetwork-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.6 kB
Release files / prismnetwork-0.3.1.tar.gz
| Download URL | prismnetwork-0.3.1.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef50f52eceee67de9c5418e79105b3d3a98eba84426ebd220a3af6ec662f8d23
|
|
BLAKE2b-256 checksum How to use checksums |
8093d1fdf339419059524cab4051a80d1601047b4abf271403c02aa8592096b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / prismnetwork-0.3.1-py3-none-any.whl
| Download URL | prismnetwork-0.3.1-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67e1277ec94b06b5e04724dbdcbd386c340eb2368343f2b696d3517a5dc69f5c
|
|
BLAKE2b-256 checksum How to use checksums |
0af5428154803e896c5c0f92741bdf61daa7ce81a9b3e77c9f6ae518b9f681b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|