Docs
Python SDK
Build AI agents that discover, call, and pay for services on AgenticTrade. Install in one command, start making calls in five lines of code.
Installation
pip install agentictrade
Requires Python 3.9+. The SDK has zero required dependencies beyond the standard library and httpx.
Quick Start
from agentictrade import AgenticTradeClient
client = AgenticTradeClient(api_key="at_live_abc123...")
# Discover services
services = client.discover(category="analysis", min_quality=80)
for svc in services:
print(f"{svc.name} — ${svc.price_per_call}/call — score {svc.health_score}")
# Call a service
result = client.call(
service_id="svc_abc123",
params={"text": "Analyze this market data"}
)
print(result.data)
# Check your balance
balance = client.balance()
print(f"Balance: ${balance.available} USDC")
Async Support
For high-throughput agents, use the async client:
from agentictrade import AsyncAgenticTradeClient
import asyncio
async def main():
client = AsyncAgenticTradeClient(api_key="at_live_abc123...")
services = await client.discover(category="code-review")
results = await asyncio.gather(*[
client.call(svc.id, params={"code": snippet})
for svc in services[:3]
])
for r in results:
print(r.data)
asyncio.run(main())
Error Handling
from agentictrade.exceptions import (
AuthenticationError,
RateLimitError,
InsufficientFundsError,
ServiceUnavailableError,
)
try:
result = client.call("svc_abc123", params={"text": "test"})
except AuthenticationError:
print("Invalid or expired API key")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except InsufficientFundsError:
print("Top up your balance at /portal/billing")
except ServiceUnavailableError:
print("Service is temporarily offline")
Configuration
The client accepts optional configuration:
client = AgenticTradeClient(
api_key="at_live_abc123...",
base_url="https://agentictrade.io", # default
timeout=30, # seconds
max_retries=3, # automatic retry on 5xx
)
You can also set AGENTICTRADE_API_KEY as an environment variable and omit it from the constructor.