Skip to main content

agentdyne

Official Python SDK for AgentDyne — The Global Microagent Marketplace.

PyPI version Python License: MIT

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.27 for the async client (pip install agentdyne[async])

License

MIT © 2026 AgentDyne, Inc.

Release files for agentdyne 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentdyne 1.0.0
File Size Uploaded
agentdyne-1.0.0.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentdyne 1.0.0
File Interpreter ABI Platform
agentdyne-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.8 kB

Release files / agentdyne-1.0.0.tar.gz

Download URL agentdyne-1.0.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
99f6838e43f71cfdfccb57d80a2c99d3a09022f752929d19c3bdc18fe1b17560
BLAKE2b-256 checksum
How to use checksums
bf63e75aa7e533ec8c34e3d5bdd685d5087f1882d1353a677e64bc9f45051c28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / agentdyne-1.0.0-py3-none-any.whl

Download URL agentdyne-1.0.0-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7833a22818e603edad71da544bf2ed565d80f4b0c129df48a3934c2ad3132c06
BLAKE2b-256 checksum
How to use checksums
b82f83a1cb3377d39e4da8b49cca65d242b38b028981b02b45c68984a6fd5747
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page