Official Python SDK for AgentDyne — The Global Microagent Marketplace
Project description
agentdyne
Official Python SDK for AgentDyne — The Global Microagent Marketplace.
Installation
pip install agentdyne
# With async support (adds httpx)
pip install agentdyne[async]
Quick Start
from agentdyne import AgentDyne
client = AgentDyne(api_key="agd_your_key_here")
# Execute an agent
result = client.execute("agent_id", "Summarize this email thread...")
print(result.output)
# → {'summary': '...', 'action_items': [...], 'urgency': 'high'}
# Stream output token-by-token
for chunk in client.stream("agent_id", "Explain quantum computing"):
if chunk.type == "delta" and chunk.delta:
print(chunk.delta, end="", flush=True)
Authentication
export AGENTDYNE_API_KEY=agd_your_key_here
# From environment (recommended)
client = AgentDyne()
# Or pass directly
client = AgentDyne(api_key="agd_your_key_here")
Usage
Agents
# List with filters
page = client.list_agents(category="coding", sort="rating", limit=10)
for agent in page.data:
print(agent.name, agent.average_rating, agent.pricing_model)
print(f"Total: {page.pagination.total}")
# Get single agent
agent = client.get_agent("agent_id")
# Search
results = client.search_agents("email summarizer")
# Iterate ALL agents automatically
for agent in client.paginate_agents(category="finance"):
print(agent.name)
Execute Agents
import uuid
# Synchronous execution
result = client.execute(
"code-review-agent",
{"code": "def add(a, b):\n return a + b", "language": "python"},
idempotency_key=str(uuid.uuid4()), # Safe to retry
)
print(result.output)
print(f"Latency: {result.latency_ms}ms Cost: ${result.cost:.6f}")
# Streaming
for chunk in client.stream("content-writer", "Write a product description for AirPods"):
if chunk.type == "delta" and chunk.delta:
print(chunk.delta, end="", flush=True)
elif chunk.type == "done":
print() # newline
Executions
# Get single execution
execution = client.get_execution("exec_id")
print(execution.status, execution.output)
# List history
page = client.list_executions(status="failed", limit=20)
# Poll until terminal
result = client.poll_execution("exec_id", interval_seconds=0.5, timeout_seconds=60)
User & Quota
me = client.me()
print(me.subscription_plan) # "pro"
print(me.full_name)
quota = client.my_quota()
print(f"{quota.used}/{quota.quota} calls ({quota.percent_used:.1f}%)")
print(f"Resets: {quota.resets_at}")
# Update profile
client.update_profile(full_name="Ada Lovelace", bio="AI researcher")
Reviews
# List reviews
page = client.list_reviews("agent_id")
for review in page.data:
print(f"★{review.rating} — {review.title}")
# Post a review
review = client.create_review(
"agent_id",
rating=5,
title="Incredible",
body="Handles every edge case perfectly.",
)
Webhooks
from agentdyne import AgentDyne, WebhookSignatureError
client = AgentDyne()
# Flask example
from flask import Flask, request
app = Flask(__name__)
@app.route("/webhook", methods=["POST"])
def webhook():
payload = request.get_data(as_text=True)
signature = request.headers.get("X-AgentDyne-Signature", "")
try:
event = client.construct_webhook_event(
payload, signature, "your_webhook_secret"
)
except WebhookSignatureError:
return "Invalid signature", 400
if event.type == "execution.completed":
print("Execution done:", event.data)
elif event.type == "payout.processed":
print("Payout:", event.data)
return "OK"
Async Usage
import asyncio
from agentdyne import AsyncAgentDyne
async def main():
async with AsyncAgentDyne(api_key="agd_...") as client:
# Execute
result = await client.execute("agent_id", "Hello!")
print(result.output)
# Stream
async for chunk in client.stream("agent_id", "Write a poem"):
if chunk.type == "delta" and chunk.delta:
print(chunk.delta, end="", flush=True)
asyncio.run(main())
Error Handling
from agentdyne.errors import (
AgentDyneError,
AuthenticationError,
QuotaExceededError,
RateLimitError,
NotFoundError,
SubscriptionRequiredError,
)
import time
try:
result = client.execute("agent_id", "Hello")
except QuotaExceededError:
print("Upgrade at agentdyne.com/billing")
except RateLimitError as e:
time.sleep(e.retry_after_seconds)
except SubscriptionRequiredError as e:
print(f"Subscribe to use agent: {e.agent_id}")
except NotFoundError:
print("Agent not found")
except AuthenticationError:
print("Check your API key")
except AgentDyneError as e:
print(f"Error: {e} (HTTP {e.status_code}, code={e.code})")
Requirements
- Python 3.9+
- No required dependencies for the sync client
httpx>=0.27for the async client (pip install agentdyne[async])
License
MIT © 2026 AgentDyne, Inc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
agentdyne-1.0.0.tar.gz
(18.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
agentdyne-1.0.0-py3-none-any.whl
(16.0 kB
view details)
File details
Details for the file agentdyne-1.0.0.tar.gz.
File metadata
- Download URL: agentdyne-1.0.0.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99f6838e43f71cfdfccb57d80a2c99d3a09022f752929d19c3bdc18fe1b17560
|
|
| MD5 |
9ac5c8c2573d2da5468c1ac814fdf4ca
|
|
| BLAKE2b-256 |
bf63e75aa7e533ec8c34e3d5bdd685d5087f1882d1353a677e64bc9f45051c28
|
File details
Details for the file agentdyne-1.0.0-py3-none-any.whl.
File metadata
- Download URL: agentdyne-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7833a22818e603edad71da544bf2ed565d80f4b0c129df48a3934c2ad3132c06
|
|
| MD5 |
928af15d479f1deb5369f12cd3455447
|
|
| BLAKE2b-256 |
b82f83a1cb3377d39e4da8b49cca65d242b38b028981b02b45c68984a6fd5747
|