antd-py -- Python SDK for Autonomi
Python SDK for the antd daemon. Provides synchronous and asynchronous clients with both REST and gRPC transports.
Installation
# REST transport (recommended)
pip install antd[rest]
# gRPC transport
pip install antd[grpc]
# Both transports
pip install antd[all]
# From source (development)
pip install -e ".[all]"
Compatibility
This package talks to a running antd daemon; it does not join the network itself. Python 3.10+. Tested against antd 0.12.x; health() fields such as version/evm_network need antd 0.4.0 or newer. For a daemon-less client see the ant-sdk package (import ant_ffi). Not related to the Ant Design UI library.
Quick Start
from antd import AntdClient
client = AntdClient() # REST transport, localhost:8082
# Health check
status = client.health()
print(f"{status.network} -- healthy: {status.ok}")
# Store and retrieve data
result = client.data_put_public(b"Hello, Autonomi!")
print(f"Address: {result.address}, chunks: {result.chunks_stored}")
data = client.data_get_public(result.address)
print(data.decode()) # "Hello, Autonomi!"
Transports
from antd import AntdClient, AsyncAntdClient
# REST (default)
client = AntdClient(transport="rest", base_url="http://localhost:8082", timeout=30)
# gRPC (wallet operations and payment_mode are available via REST only)
client = AntdClient(transport="grpc", target="localhost:50051")
# Async REST
aclient = AsyncAntdClient(transport="rest")
status = await aclient.health()
await aclient.close()
API Reference
Factory Functions
| Function | Description |
|---|---|
AntdClient(transport="rest", **kwargs) |
Create a synchronous client |
AsyncAntdClient(transport="rest", **kwargs) |
Create an asynchronous client |
Client Methods
Health
| Method | Returns | Description |
|---|---|---|
health() |
HealthStatus |
Check daemon health — also surfaces antd version, EVM network, uptime, build commit, and payment contract addresses (antd ≥ 0.4.0) |
Data
| Method | Returns | Description |
|---|---|---|
data_put_public(data, payment_mode=...) |
DataPutPublicResult |
Store public data — DataMap is stored on-network |
data_get_public(address: str) |
bytes |
Retrieve public data by address |
data_put(data, payment_mode=...) |
DataPutResult |
Store private (encrypted) data — DataMap returned to caller (NOT stored on-network) |
data_get(data_map: str) |
bytes |
Retrieve private data using a caller-held DataMap |
data_cost(data, payment_mode=...) |
UploadCostEstimate |
Estimate storage cost — size, chunks, gas, payment mode |
Chunks
| Method | Returns | Description |
|---|---|---|
chunk_put(data: bytes) |
PutResult |
Store a raw chunk |
chunk_get(address: str) |
bytes |
Retrieve a chunk |
Files
| Method | Returns | Description |
|---|---|---|
file_put(path, payment_mode=...) |
FilePutResult |
Upload a file privately — DataMap returned to caller (NOT stored on-network) |
file_get(data_map, dest_path) |
None |
Download a private file using a caller-held DataMap |
file_put_public(path, payment_mode=...) |
FilePutPublicResult |
Upload a file publicly — DataMap is stored on-network |
file_get_public(address, dest_path) |
None |
Download a public file by address |
file_cost(path, is_public, payment_mode=...) |
UploadCostEstimate |
Estimate file cost — size, chunks, gas, payment mode |
External Signer
Two-phase upload — daemon prepares the payment intent, caller signs + submits the payForQuotes tx, daemon finalizes once the chain confirms. See examples/07_external_signer.py + docs/external-signer-flow.md.
| Method | Returns | Description |
|---|---|---|
prepare_upload(path, visibility=None) |
PrepareUploadResult |
Prepare a file upload for external signing |
prepare_upload_public(path) |
PrepareUploadResult |
Convenience for prepare_upload(path, visibility="public") |
prepare_data_upload(data, visibility=None) |
PrepareUploadResult |
Prepare a data upload for external signing |
prepare_chunk_upload(data) |
PrepareChunkResult |
Prepare a single chunk for external-signer publish |
finalize_upload(upload_id, tx_hashes) |
FinalizeUploadResult |
Submit a prepared upload after external payment. data_map_address populated when prepare used visibility="public" |
finalize_chunk_upload(upload_id, tx_hashes) |
str |
Submit a prepared chunk after external payment; returns the chunk address |
Models
All models are frozen dataclasses (immutable).
| Model | Fields | Description |
|---|---|---|
HealthStatus |
ok, network, version, evm_network, uptime_seconds, build_commit, payment_token_address, payment_vault_address |
Health check result (diagnostic fields require antd ≥ 0.4.0) |
PutResult |
cost, address |
Result of chunk_put only |
DataPutResult |
data_map, chunks_stored, payment_mode_used |
Private data put — DataMap returned to caller |
DataPutPublicResult |
address, chunks_stored, payment_mode_used |
Public data put — DataMap stored on-network |
FilePutResult |
data_map, storage_cost_atto, gas_cost_wei, chunks_stored, payment_mode_used |
Private file put — DataMap returned to caller |
FilePutPublicResult |
address, storage_cost_atto, gas_cost_wei, chunks_stored, payment_mode_used |
Public file put — DataMap stored on-network |
UploadCostEstimate |
cost, file_size, chunk_count, estimated_gas_cost_wei, payment_mode |
Pre-upload cost breakdown |
Error Handling
All errors inherit from AntdError:
from antd import AntdClient, AntdError, NotFoundError, PaymentError
client = AntdClient()
try:
data = client.data_get_public("nonexistent_address")
except NotFoundError:
print("Data not found on the network")
except PaymentError:
print("Insufficient funds")
except AntdError as e:
print(f"Error ({e.status_code}): {e}")
| Exception | HTTP | gRPC | Description |
|---|---|---|---|
BadRequestError |
400 | INVALID_ARGUMENT |
Invalid request parameters |
PaymentError |
402 | FAILED_PRECONDITION |
Wallet/payment issue |
NotFoundError |
404 | NOT_FOUND |
Resource not found |
AlreadyExistsError |
409 | ALREADY_EXISTS |
Resource already exists |
ForkError |
409 | ABORTED |
Version conflict |
TooLargeError |
413 | RESOURCE_EXHAUSTED |
Payload too large |
InternalError |
500 | INTERNAL |
Server error |
NetworkError |
502 | UNAVAILABLE |
Network unreachable |
Examples
Run examples from the examples/ directory:
# Requires antd daemon running on local testnet
python examples/01_connect.py # Health check
python examples/02_data.py # Store/retrieve data
python examples/03_chunks.py # Raw chunks
python examples/04_files.py # File upload/download
python examples/06_private_data.py # Private data with data maps
python examples/07_external_signer.py # External-signer file + chunk upload
python examples/08_grpc.py # gRPC transport (requires antd[grpc])
python examples/08_grpc.py # gRPC transport (instead of REST)
Or use the dev CLI:
ant dev example data
ant dev example all
Release files for antd 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| antd-0.1.0.tar.gz | 35.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| antd-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 92.3 kB
Release files / antd-0.1.0.tar.gz
| Download URL | antd-0.1.0.tar.gz |
|---|---|
| Size | 35.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c8071dd1320a7fe5d6c433a0ae6a855a28deef8863a18341f34abd4c933053e
|
|
BLAKE2b-256 checksum How to use checksums |
c07a7b8013dfec29f5d6f58fb624b4dfacefdca9183e2f4d9a79446f3ae13072
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency logRelease files / antd-0.1.0-py3-none-any.whl
| Download URL | antd-0.1.0-py3-none-any.whl |
|---|---|
| Size | 56.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed83cb350f4442350a9e8ad43270e2deda1e96850670aa9dcb8054f9756cab65
|
|
BLAKE2b-256 checksum How to use checksums |
cc1ceb26090e4d04c8ce48628c134d556537fc11018357f5f3d4c515cf00af75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency log