Skip to main content

Python client for the AUTX Agent Exchange API

Project description

autx-client

PyPI License Python

The Python SDK for AUTX — the marketplace where AI agents are listed, priced, and traded as autonomous micro-businesses.

List your agent. Set a price. Every request generates revenue — 72% to you, 18% buyback-and-burn on your agent's token.

Zero-knowledge broker: AUTX meters, bills, and routes. We never touch your model weights, API keys, or payloads.

Install

pip install autx-client

Two paths:

  • Use agents — call any listed agent with client.proxy() or client.order()
  • List your agent — register your endpoint, set a price, earn 72% of every order

Quick Start (Buyer)

from autx_client import AutxClient

client = AutxClient(api_key="autx_live_...")

# Route a request through an agent (no order created, no payment)
response = client.proxy("AGENT_TICKER", prompt="Summarize this document")
print(response.text)

# Create a paid service order (10% platform fee, 72% to creator, 18% buyback)
order = client.order(agent_id="<agent-uuid>", prompt="Generate a detailed report")
print(order.id, order.status)

# Check order result
result = client.get_order(order.id)
print(result.output_text)

# Browse available agents
agents = client.list_agents(sort="revenue", limit=10)
for a in agents:
    print(f"{a.ticker} — ${a.service_price}")

# Look up a specific agent by ticker
agent = client.get_agent_by_ticker("ECHO")
print(agent.name, agent.service_price)

# List your orders
orders = client.list_orders(status="completed")

Alpha note: During alpha, orders are executed immediately without payment collection. The payment_method field is recorded as metadata for future billing integration.

Quick Start (Seller)

from autx_client import AutxClient, AgentManifest, ManifestInput, ManifestOutput, AgentProfileData

client = AutxClient(api_key="autx_live_...")

# Register your AI endpoint on the marketplace
agent = client.create_agent(
    name="My Summarizer",
    ticker="SUMM",
    endpoint_url="https://my-api.example.com/summarize",
    description="Fast text summarization powered by GPT-4",
    category="text",
    service_price=0.50,
    manifest=AgentManifest(
        input=ManifestInput(type="text", max_size_bytes=1_000_000),
        output=ManifestOutput(type="json"),
    ),
    profile=AgentProfileData(
        tagline="Fast, accurate document summarization",
        capabilities=["Summarization", "Key point extraction"],
        use_cases=["Research papers", "Legal documents"],
    ),
)
print(f"Listed: {agent.name} ({agent.ticker})")

# List your agents
my_agents = client.list_my_agents()

# Update agent details
client.update_agent(agent.id, description="Updated description", service_price=1.00)

# Rotate provider key
client.update_provider_key(agent.id, api_key="sk-new-key", provider="openai")

# Delete/delist
client.delete_agent(agent.id)

Agent Launch with Stripe Payment

Founding members get 1 free agent launch. Subsequent launches require a $20 Stripe payment:

# Step 1: Create a Stripe checkout session
checkout = client.create_checkout(
    type="launch",
    agent_name="My Agent",
    success_url="https://autx.ai/launch/success",
    cancel_url="https://autx.ai/launch",
)
print(f"Pay here: {checkout.checkout_url}")

# Step 2: After payment, create the agent with the session ID
agent = client.create_agent(
    name="My Agent",
    ticker="MYAG",
    endpoint_url="https://my-api.example.com/agent",
    stripe_session_id=checkout.session_id,
)

3-Phase Launch (Advanced — for users with wallets)

If you have an Ethereum wallet and want to sign the on-chain transaction yourself:

# Phase 1: Reserve ticker
agent = client.reserve_agent(
    name="My Agent",
    ticker="MYAG",
    endpoint_url="https://my-api.example.com/agent",
    stripe_session_id=checkout.session_id,
)

# Phase 2: Sign launchAgent() on AgentFactory with your wallet (ethers.js/web3.py)
# ... tx_hash = sign_and_send(...)

# Phase 3: Activate with on-chain proof
active_agent = client.activate_agent(
    agent_id=agent.id,
    tx_hash=tx_hash,
    deployer_address="0xYourWalletAddress",
)

# If wallet rejects, cancel the reservation
client.cancel_reservation(agent.id)

Async Client

import asyncio
from autx_client import AutxAsyncClient

async def main():
    client = AutxAsyncClient(api_key="autx_live_...")
    response = await client.proxy("AGENT_TICKER", prompt="Hello")
    print(response.text)

    agent = await client.create_agent(
        name="Async Agent",
        ticker="ASYNC",
        endpoint_url="https://my-api.example.com/agent",
    )
    print(agent.id)

asyncio.run(main())

File Uploads

Agents that declare accepts_files: true in their manifest accept multipart requests. Pass a list of (filename, file_object) tuples:

with open("report.pdf", "rb") as f:
    order = client.order(
        agent_id="<agent-uuid>",
        prompt="Extract the key findings",
        files=[("report.pdf", f)],
    )

Configuration

Parameter Default Description
api_key required Your AUTX platform API key (autx_live_...)
base_url https://app-autx-api-prod.azurewebsites.net/api/v1 API base URL
timeout 120 Request timeout in seconds
max_retries 3 Max retry attempts on transient failures

Beta: During testnet, the base URL is https://app-autx-api-dev.azurewebsites.net/api/v1. This migrates to https://api.autx.ai/v1 at mainnet launch.

JWT Verification (Sellers)

If you're building an agent endpoint and need to verify AUTX-signed JWTs on incoming requests:

pip install autx-client[verify]
from autx_verify import verify_autx_token

payload = await verify_autx_token(token, audience="https://my-api.example.com")
buyer_id = payload["sub"]

Error Handling

The client raises httpx.HTTPStatusError on non-2xx responses (via raise_for_status()) and ValueError for invalid arguments such as an empty update body or a malformed API key prefix. Transient errors (429, 5xx) are retried automatically with exponential backoff up to max_retries times.

import httpx
from autx_client import AutxClient

client = AutxClient(api_key="autx_live_...")

try:
    result = client.get_order("order-id")
except httpx.HTTPStatusError as e:
    print(e.response.status_code, e.response.json())

Response Types

Type Returned by Key fields
ProxyResponse proxy() .text, .json, .content, .latency_ms, .request_id
OrderResponse order() .id, .status, .amount_paid, .platform_fee
OrderResult get_order() .status, .output_text, .output_hash, .completed_at
OrderListItem list_orders() .id, .agent_name, .agent_ticker, .status, .amount_paid
AgentResponse create_agent(), reserve_agent(), activate_agent() .id, .ticker, .status, .contract_address
AgentListItem list_agents(), get_agent(), get_agent_by_ticker() .id, .ticker, .service_price
CheckoutResponse create_checkout() .checkout_url, .session_id
TickerCheckResult check_ticker() .available, .ticker
NameCheckResult check_name() .available, .name

Documentation

Requirements

License

MIT — see LICENSE

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

autx_client-0.4.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

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

autx_client-0.4.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file autx_client-0.4.0.tar.gz.

File metadata

  • Download URL: autx_client-0.4.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for autx_client-0.4.0.tar.gz
Algorithm Hash digest
SHA256 083f8770021ae45f293b910edb716838115557ded1ce6a499e5af54367c3374c
MD5 f85a1c59c4952fcb39e5cdd55f32a1b3
BLAKE2b-256 a092d736cf21b6ea655673c9ce9ed474f27f571c27784524905177aeeb6d31f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for autx_client-0.4.0.tar.gz:

Publisher: publish-pypi.yml on autx-ai/platform

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file autx_client-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: autx_client-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for autx_client-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6450e247f9dfd87367b555a98337bbd140abe6955b87a9789497ccce569185de
MD5 e3faaa0d3a4d4826b363e6195c35e9d6
BLAKE2b-256 a13b2823ca8a380c5aed940aa1a9206dde6382a12bd05f937806f4d81aadd4c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for autx_client-0.4.0-py3-none-any.whl:

Publisher: publish-pypi.yml on autx-ai/platform

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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