axiom-stack
Verifiable on-chain attestations for AI agents — equity + crypto data oracle anchored on Solana.
axiom-stack is the official Python SDK for the Axiom Stack Oracle. One client, two surfaces — synchronous and async — with typed exceptions mapped 1:1 from the API's RFC 7807 error contract.
from axiom_stack import AxiomClient
client = AxiomClient() # reads AXIOM_API_KEY
att = client.attest_instant(asset_class=2, asset_id="AAPL")
print(att.data.price_micros, att.attestation_pda) # 308820000 CuN2…
Install
pip install axiom-stack
Issue a key at axiomstack.dev/dashboard/keys and:
export AXIOM_API_KEY="axm_live_…"
…or write a ~/.axiomrc.json:
{ "default": { "api_key": "axm_live_…" } }
30-second terminal demo
pip install axiom-stack
export AXIOM_API_KEY="axm_live_…"
axiom query BTC --crypto # → JSON attestation, on-chain
axiom query AAPL --format table # ASCII table
Library quickstart
from axiom_stack import AxiomClient
with AxiomClient() as client:
# Equity (live audit + instant)
aapl = client.attest_instant(asset_class=2, asset_id="AAPL")
print(aapl.data.price_micros, aapl.request_id)
# Crypto (whitelist: BTC, ETH, SOL, USDC, USDT; instant only in V1)
btc = client.attest_instant(asset_class=6, asset_id="BTC")
# Idempotent retry
from axiom_stack import new_idempotency_key
key = new_idempotency_key()
nvda1 = client.attest_instant(asset_class=2, asset_id="NVDA", idempotency_key=key)
nvda2 = client.attest_instant(asset_class=2, asset_id="NVDA", idempotency_key=key) # replay
assert nvda1.attestation_pda == nvda2.attestation_pda
Async
import asyncio
from axiom_stack import AsyncAxiomClient
async def main():
async with AsyncAxiomClient() as client:
att = await client.attest_instant(asset_class=2, asset_id="TSLA")
print(att.data.price_micros)
asyncio.run(main())
Typed errors
Every error from the API is application/problem+json with a stable type URI at https://docs.axiomstack.dev/errors/<slug>. The SDK translates each URI into a specific exception class — write except TierUnavailableForClass: instead of parsing error strings.
from axiom_stack import AxiomClient, TierUnavailableForClass, InsufficientQuota
client = AxiomClient()
try:
client.attest_audit(asset_class=6, asset_id="BTC") # crypto audit not in V1
except TierUnavailableForClass as e:
print("available tiers:", e.tiers_available) # ['instant']
# downgrade gracefully
client.attest_instant(asset_class=6, asset_id="BTC")
try:
client.attest_instant(asset_class=2, asset_id="AAPL")
except InsufficientQuota as e:
print(f"retry in {e.retry_after_seconds}s; request_id={e.request_id}")
Full exception hierarchy: AxiomError → AxiomAPIError → Unauthorized / Forbidden / InvalidRequest / TierUnavailableForClass / NotFound / IdempotencyReplayMismatch / InsufficientQuota / ServiceUnavailable / InternalServerError. Plus AxiomConnectionError for transport-level failures.
Read an on-chain attestation by PDA
state = client.fetch_attestation("CuN2LbSuw227fu2aHLpN6y7sbXun2DPNz6DjncRqJ9RW")
print(state.asset_id, state.asset_data.variant_type) # "AAPL" "EquityData"
print(len(state.attestations), "writers")
Discover supported classes + tiers
for c in client.list_asset_classes():
print(c.id, c.name, c.status, c.tiers_available)
Configuration precedence
| # | Source | Note |
|---|---|---|
| 1 | constructor arg (AxiomClient(api_key=…)) |
wins over all |
| 2 | AXIOM_API_KEY env var |
recommended for prod |
| 3 | AXIOM_CONFIG env (path to JSON file) |
flexible |
| 4 | ~/.axiomrc.json |
local dev default |
The same precedence applies to base_url (env: AXIOM_BASE_URL). The base URL defaults to https://api.axiomstack.dev.
CLI reference
axiom query <asset_id> [--class equity|crypto|<int>] [--latency instant|audit]
[--format json|table] [--key <axm_live_…>] [--base-url URL]
# Shortcuts
axiom query AAPL # equity instant
axiom query BTC --crypto # equivalent to --class crypto
axiom query AAPL --latency audit # audit tier (equity only in V1)
API reference
Full OpenAPI 3.1 spec + endpoint reference: axiomstack.dev/developers/api. Machine-readable spec: api.axiomstack.dev/v1/openapi.json.
Publishing checklist (maintainers)
Pre-publish gates for python -m twine upload:
pytest— all unit + mocked tests green (real_apimarker deselected by default).pytest -m real_api— end-to-end roundtrip againstapi.axiomstack.devwith a liveAXIOM_API_KEY. Required before bumping the version on PyPI.python -m build— wheel + sdist build clean.python -m twine check dist/*— PyPI metadata sanity.
Codified at G6.12 P5 from feedback_sdk_mocked_tests_dont_catch_type_drift
(G6.11 SDK 0.3.0 publish — mocked tests missed a wire/SDK type drift; Mark
caught it on the first real query against prod).
License
MIT © Axiom Stack LLC
Metadata
Release files for axiom-stack 0.5.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 | Provenance | Actions |
|---|---|---|---|---|
| axiom_stack-0.5.0.tar.gz | 33.9 kB | Without provenance | Details for axiom_stack-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| axiom_stack-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for axiom_stack-0.5.0-py3-none-any.whl |
Total release size: 69.0 kB
Release files / axiom_stack-0.5.0.tar.gz
| Download URL | axiom_stack-0.5.0.tar.gz |
|---|---|
| Size | 33.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c35f57a9b4fa1256ff51c75b548a3b39791b04799bdca750f03e81895f85a970
|
|
BLAKE2b-256 checksum How to use checksums |
e9fb7f8b42697031d7bc377aaf91fa24465e8a43edeca023db05daeb180db97d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Release files / axiom_stack-0.5.0-py3-none-any.whl
| Download URL | axiom_stack-0.5.0-py3-none-any.whl |
|---|---|
| Size | 35.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2635b74f7157be7ee012e429c4772c1643b57d6fc68caea02fa206b24bf11bb4
|
|
BLAKE2b-256 checksum How to use checksums |
6c3dfcb35362f0c7a021a91299830aed5e16864ae3f8c7e65b5b94b63bfeaea3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Security for axiom-stack 0.5.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.