Skip to main content

Official Python client for the Ardyn Liability Verification Substrate API

Project description

Ardyn Python SDK

Official Python client for the Ardyn AI Liability Infrastructure API.

Installation

pip install ardyn

Quick Start

import asyncio
from ardyn import ArdynClient, TenantConfig

async def main():
    async with ArdynClient(
        gateway_url="https://api.ardyn.ai",
        api_key="your-api-key",
    ) as client:
        # Register a tenant (admin-only route)
        tenant = await client.register_tenant(
            "My Company",
            TenantConfig(plan="pro")
        )
        print(f"Tenant ID: {tenant.tenant_id}")
        print(f"API Key: {tenant.api_key}")

        # Register an agent
        agent = await client.register_agent(
            platform="apple_silicon",
            capabilities=["sram_eviction"],
            public_key="your-ed25519-public-key-hex",
        )
        print(f"Agent ID: {agent.agent_id}")

        # Create an attestation
        attestation = await client.attest(
            tool_name="web_search",
            input_hash="sha256:abc123...",
            output_hash="sha256:def456...",
        )
        print(f"Attestation ID: {attestation.attestation_id}")
        print(f"DDC ID: {attestation.ddc_id}")

        # Verify a DDC
        result = await client.verify(attestation.ddc_id)
        print(f"Valid: {result.valid}")

        # Get usage stats
        usage = await client.get_usage(tenant.tenant_id)
        print(f"Total SCU: {usage.total_scu}")

asyncio.run(main())

Features

  • Async-first: Built on httpx for modern async Python
  • Type-safe: Full type annotations and dataclass models
  • Auto-retry: Exponential backoff on transient failures (3 attempts: 1s, 2s, 4s)
  • Connection pooling: Efficient HTTP/2 connection reuse
  • Comprehensive errors: Typed exceptions for auth, not-found, validation, and server errors

API Reference

ArdynClient

ArdynClient(
    gateway_url: str,        # Base URL of the Ardyn gateway
    api_key: str,            # API key for authentication
    timeout: float = 30.0,   # Request timeout in seconds
    max_retries: int = 3,    # Max retry attempts
)

Methods

Method Description
register_tenant(name, config?) Register a new tenant via the admin-only route
register_agent(platform, capabilities, public_key, manifest_signature?, cert_fingerprint?) Register an agent
heartbeat(agent_id, status, uptime_secs, attestations_performed, agent_instance_id?) Send agent heartbeat
attest(tool_name, input_hash, output_hash, metadata?) Create attestation
submit_proof(request_id, agent_id, proof_type, proof_data, timestamp, signature, input_hash?, output_hash?) Submit proof
verify(ddc_id) Verify a DDC
get_usage(tenant_id) Get usage statistics
get_settlement(tenant_id, period) Get settlement details
get_dashboard(tenant_id) Get dashboard data
health() Check gateway health

Error Types

  • ArdynError - Base exception
  • AuthError - Authentication failed (401/403)
  • NotFoundError - Resource not found (404)
  • ValidationError - Request validation failed (400/422)
  • ServerError - Server error (5xx)

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ardyn-0.2.1.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ardyn-0.2.1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file ardyn-0.2.1.tar.gz.

File metadata

  • Download URL: ardyn-0.2.1.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ardyn-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b7ad381356990340aa90e434b1e003418ac049b33b93ebd82f26bfbf75eaba73
MD5 3442b92c10690893e3012d7e49f5430b
BLAKE2b-256 47079f817b341f0a829ee67bb199ea20a175d7c53e9678a98c50413683e57430

See more details on using hashes here.

File details

Details for the file ardyn-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ardyn-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ardyn-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bc57d6dbfb1ff348e6f201bcb680574e1b066f3d85fb56b86ae35906a3048918
MD5 d9e0299f4ec9e2d0ce090aded3bfadd2
BLAKE2b-256 330246751feb659939862e6835d103889609f5254c081b50d6e3b5318929b79f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page