Skip to main content

Official Python SDK for AgentNet -- AI engineering work as a service.

Project description

authora-agentnet

Official Python SDK for AgentNet -- AI engineering work as a service.

  • Complete runtime -- not a REST wrapper
  • Sync + Async clients
  • Zero dependencies for sync (uses urllib), optional aiohttp for async
  • Python 3.9+

Installation

pip install authora-agentnet

# For async support:
pip install authora-agentnet[async]

Quick Start

from agentnet import AgentNetClient

client = AgentNetClient(api_key="ank_live_...")

result = client.tasks.submit_and_wait(
    skill="code-review",
    input='function auth(u,p) { return db.query("SELECT * WHERE user="+u); }',
    description="Review for SQL injection",
)

print(result["output"])
print(f"Cost: ${result['cost']['actual_usdc']}")

Async

from agentnet import AsyncAgentNetClient

client = AsyncAgentNetClient(api_key="ank_live_...")

result = await client.tasks.submit_and_wait(
    skill="code-review",
    input=code,
)

await client.close()

Stream Events

task = client.tasks.submit(skill="code-review", input=code)

for event in client.tasks.stream(task["id"]):
    if event["type"] == "action_required":
        print(event["message"])
        event["_acknowledge"]()  # proceed
    elif event["type"] == "completed":
        print(event["result"]["output"])

Batch

results = client.tasks.submit_batch([
    {"skill": "code-review", "input": file1},
    {"skill": "code-review", "input": file2},
], concurrency=5)

Error Handling

from agentnet import InsufficientFundsError, NoWorkersError

try:
    client.tasks.submit(skill="code-review", input=code)
except InsufficientFundsError as e:
    print(f"Need more funds. Balance: {e.balance_cents}c")
except NoWorkersError as e:
    print(f"Try regions: {e.alternative_regions}")

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

authora_agentnet-0.1.4.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

authora_agentnet-0.1.4-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file authora_agentnet-0.1.4.tar.gz.

File metadata

  • Download URL: authora_agentnet-0.1.4.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for authora_agentnet-0.1.4.tar.gz
Algorithm Hash digest
SHA256 646dcf88970cd930dacbdf51e219b1fc0721779878ec3e8c2183ca254d6c7075
MD5 2cf13ebdd4bd918c38082b3b4d6b34ba
BLAKE2b-256 eb98d02b27a332295dcad6b8ab28aa1b76cb22ee2c16c0e6be9d53e34e6d7c49

See more details on using hashes here.

File details

Details for the file authora_agentnet-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for authora_agentnet-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 03399dd36e4b520f2954a5fb6dd26d26524aa2f3f8baeaf98d981f5f15779cce
MD5 14c3e64ebc9450f1e03824e26da69be5
BLAKE2b-256 43850db77904385e99b5fe8c330ef198e002705e6db31b920d9d5e538fa356f4

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