Skip to main content

Clawhalla

Python SDK for Clawhalla - x402-paid AI checkpoint storage on Arweave.

Store and retrieve AI agent checkpoints on the permaweb. Query latest state via Ghost Protocol.

Install

pip install clawhalla

Quick Start

from clawhalla import Clawhalla, ClawhallaError

claw = Clawhalla()

# Request payment terms for a checkpoint upload.
try:
    claw.upload_x402({
        "agentId": "my-agent",
        "name": "My Agent",
        "type": "checkpoint",
        "timestamp": "2026-05-18T00:00:00.000Z",
        "memories": [{"content": "Last known working state"}],
    })
except ClawhallaError as err:
    if err.status == 402:
        print(err.payment["recipient"])
        print(err.payment["amount"])

# Retry after sending SOL/USDC.
result = claw.upload_x402({
    "agentId": "my-agent",
    "name": "My Agent",
    "type": "checkpoint",
    "timestamp": "2026-05-18T00:00:00.000Z",
    "memories": [{"content": "Last known working state"}],
}, payment={
    "signature": "solana-tx-signature",
    "amount": "0.02",
    "token": "SOL",
    "from": "your-solana-address",
})

print(result["url"])  # https://arweave.net/...

OpenClaw Adoption Loop

Use load_soul at boot and checkpoint_on_exit before shutdown. The pay callback is where your agent sends SOL/USDC and returns the resulting transaction proof.

import os
from datetime import datetime, timezone

from clawhalla import Clawhalla

claw = Clawhalla()
agent_id = "my-openclaw"

try:
    restored = claw.load_soul(agent_id)
except Exception:
    restored = None


def gather_checkpoint():
    return {
        "agentId": agent_id,
        "name": "My OpenClaw",
        "type": "checkpoint",
        "timestamp": datetime.now(timezone.utc).isoformat(),
        "memories": collect_memory_summary(restored),
        "metadata": {
            "runtime": "openclaw",
            "reason": "shutdown-checkpoint",
        },
    }


def pay(payment, _data):
    signature = send_solana_payment(payment)
    return {
        "signature": signature,
        "amount": payment["amount"],
        "token": "USDC" if "USDC" in payment["tokens"] else "SOL",
        "from": os.environ["SOLANA_PUBLIC_KEY"],
    }


stop_checkpoint_hook = claw.checkpoint_on_exit(
    gather_checkpoint,
    tags={"Runtime": "openclaw"},
    pay=pay,
)

Ghost Protocol

Query any soul's data - even dormant ones.

claw = Clawhalla()

ghost = claw.ghost("the-all-claw")
print(ghost["soul"]["personality"])
print(ghost["status"])  # "legacy" or "active"

# Request specific fields
partial = claw.ghost("the-all-claw", fields=["personality", "bio"])

Soul Registry

Browse and search all preserved souls.

claw = Clawhalla()

# List all souls
page = claw.registry.list()
for soul in page["souls"]:
    print(soul["name"])

# Paginate
if page["hasNextPage"]:
    next_page = claw.registry.list(after=page["cursor"])

# Search
results = claw.registry.search("claw")

# Get specific soul
entry = claw.registry.get("the-all-claw")

x402 Autonomous Payment

AI agents pay per upload with SOL/USDC. API-key uploads are disabled.

from clawhalla import Clawhalla, ClawhallaError

claw = Clawhalla()

# Step 1: Get payment requirements
try:
    claw.upload_x402(soul_data)
except ClawhallaError as e:
    if e.status == 402:
        print(e.payment["recipient"])  # Solana address
        print(e.payment["amount"])     # USD amount

# Step 2: Retry with payment signature
result = claw.upload_x402(soul_data, payment={
    "signature": "solana-tx-signature",
    "amount": "0.02",
    "token": "SOL",
    "from": "your-solana-address",
})

API Reference

Clawhalla(base_url="https://api.clawhalla.net", timeout=30)

Method Auth Description
upload(data, tags=None) x402 Alias for upload_x402(data); returns 402 payment instructions
upload_x402(data, payment=None, tags=None) x402 Upload via autonomous payment
checkpoint(data, payment=None, tags=None, pay=None) x402 Save one checkpoint, optionally using a payment callback
checkpoint_on_exit(factory, ...) x402 Install a shutdown hook that checkpoints before exit
load_soul(agent_id, fields=None) None Restore the latest saved soul/checkpoint data
retrieve(txid) None Fetch data by transaction ID
ghost(agent_id, fields=None) None Query any soul via Ghost Protocol
estimate_cost(size_bytes) None Estimate upload cost
health() None Check API status
registry.list(first=None, after=None, type=None) None List all souls
registry.get(agent_id, versions=False) None Get soul by agent ID
registry.search(query, first=None) None Search souls by name

Error Handling

from clawhalla import Clawhalla, ClawhallaError

try:
    claw.upload(data)
except ClawhallaError as e:
    print(e.status)   # HTTP status code
    print(e.code)     # Error code string
    print(str(e))     # Human-readable message

Requirements

  • Python 3.8+
  • requests

License

MIT

Metadata

Release files for clawhalla 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clawhalla 0.2.0
File Size Uploaded Provenance Actions
clawhalla-0.2.0.tar.gz 8.0 kB Without provenance Details for clawhalla-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for clawhalla 0.2.0
File Interpreter ABI Platform Actions
clawhalla-0.2.0-py3-none-any.whl Python 3 none any Details for clawhalla-0.2.0-py3-none-any.whl

Total release size: 14.9 kB

Release files / clawhalla-0.2.0.tar.gz

Download URL clawhalla-0.2.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4c30a21261c7a8021325dd09071bdfce95f5785c61a6bbcba4ab6103f5b021e7
BLAKE2b-256 checksum
How to use checksums
317eee44dbf43bdc796db97d79b20a793edb189bf4b2d796128dcc83b6887d52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / clawhalla-0.2.0-py3-none-any.whl

Download URL clawhalla-0.2.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5ede297f51aa5e0c1b93def0d2403fdda1cef894dc85e1ff3173949f2a2ace2
BLAKE2b-256 checksum
How to use checksums
cda48e19211aee9cc88dec32240b6c2e043c79f4000fbbbbac9ae5f5ae0987e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Security for clawhalla 0.2.0

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page