Skip to main content

OpenAaaS Python SDK

A Pythonic SDK for the OpenAaaS Agent orchestration network, designed for researchers and scientists who want to submit compute tasks, manage results, and interact with AI agents from plain Python or Jupyter notebooks.

Installation

pip install pyopenaaas
# or with uv
uv add pyopenaaas

Development dependencies (optional):

pip install pyopenaaas[dev]   # includes test dependencies
# or
uv add --dev pyopenaaas       # add dev dependencies directly with uv

Quick Start

1. Register & configure

import pyopenaaas

# Option A: explicit credentials
client = pyopenaaas.Client(
    server_url="https://api.open-aaas.com",
    api_key="your-api-key",
)

# Option B: load from environment variables (OPENAAAS_SERVER_URL, OPENAAAS_API_KEY)
client = pyopenaaas.Client()

2. Discover services

with client:
    info = client.discover()
    print(info)

    services = client.list_services()
    for svc in services:
        print(svc.id, svc.name, svc.agent_status)

3. Submit a task

with client:
    task = client.submit_task(
        service_id="quantum-chemistry-v1",
        task_prompt="Calculate the ground state energy of H2O using CCSD(T)/cc-pVTZ",
        output_prompt="Return the total energy in Hartree and a brief summary",
        input_files=["h2o.xyz"],
    )
    print(task)

4. Wait for completion & download results

with client:
    task = client.wait_for_task(task.id, poll_interval=10.0)
    if task.is_success():
        # Get result files (actual results are here)
        paths = client.download_all_files(task.id, extract_zip=True)
        for p in paths:
            print("Saved:", p)

        # task.result contains execution metadata (e.g. stdout, file list)
        if task.result:
            print("Output files:", task.result.files)
            print("Stdout:", task.result.stdout)
    else:
        print("Task failed:", task.result)

Note: task.result only contains execution metadata (stdout, files, etc.). The actual result content of a completed task must be retrieved via client.list_files() and client.download_all_files().

Async Support

All methods have async counterparts via :class:AsyncClient:

async with pyopenaaas.AsyncClient(
    server_url="https://api.open-aaas.com",
    api_key="your-api-key",
) as client:
    services = await client.list_services()
    task = await client.submit_task("svc-1", "Run MD simulation")
    task = await client.wait_for_task(task.id)
    paths = await client.download_all_files(task.id)

In a Jupyter notebook or REPL you can also use the convenience helper:

info = pyopenaaas.run(
    pyopenaaas.AsyncClient(
        server_url="https://api.open-aaas.com",
        api_key="your-api-key",
    ).discover()
)

Jupyter Notebook users: pyopenaaas.run() uses asyncio.run() under the hood, which cannot be nested inside an existing event loop (the default in Jupyter). Instead, use await directly with :class:AsyncClient:

client = pyopenaaas.AsyncClient(
    server_url="https://api.open-aaas.com",
    api_key="your-api-key",
)
info = await client.discover()
services = await client.list_services()

Typical Research Workflow

import pyopenaaas

# 1. Initialise (reads OPENAAAS_API_KEY from env)
client = pyopenaaas.Client(server_url="https://api.open-aaas.com")

# 2. Pick a service
services = client.list_services()
ml_service = next(s for s in services if "ml" in s.name.lower())

# 3. Get usage instructions
usage = client.get_service_usage(ml_service.id)
print(usage.usage)

# 4. Submit a batch of experiments
session_id = "batch-2024-06-02"
tasks = []
for params in ["exp1.in", "exp2.in", "exp3.in"]:
    t = client.submit_task(
        service_id=ml_service.id,
        task_prompt="Train a GNN on the attached dataset",
        input_files=[params],
        session_id=session_id,
    )
    tasks.append(t)

# 5. Wait for all tasks
for t in tasks:
    final = client.wait_for_task(t.id, poll_interval=5.0)
    print(f"{final.id}: {final.status}")

# 6. Collect results
for t in tasks:
    if client.get_task(t.id).is_success():
        client.download_all_files(t.id, save_dir=f"results/{t.id}")

Configuration Priority

The SDK resolves settings in the following order (highest first):

  1. Code kwargs — Client(server_url="...", api_key="...")
  2. Environment variables — OPENAAAS_SERVER_URL, OPENAAAS_API_KEY
  3. Defaults — https://api.open-aaas.com

Exception Hierarchy

OpenAaaSError
├── AuthenticationError  (401 / 403)
├── NotFoundError        (404)
├── ConflictError        (409)
├── RequestValidationError      (400)
├── NetworkError         (connectivity)
└── RequestTimeoutError         (request timeout)

Catch the base class to handle any SDK error:

from pyopenaaas.exceptions import OpenAaaSError

try:
    client.submit_task("bad-id", "...")
except OpenAaaSError as exc:
    print("SDK error:", exc)

License

MIT

Metadata

Release files for pyopenaaas 0.1.3

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

Source distribution (sdist)

Source distribution for pyopenaaas 0.1.3
File Size Uploaded Provenance Actions
pyopenaaas-0.1.3.tar.gz 35.7 kB Without provenance Details for pyopenaaas-0.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 57.4 kB

Release files / pyopenaaas-0.1.3.tar.gz

Download URL pyopenaaas-0.1.3.tar.gz
Size 35.7 kB
Tags Source
SHA-256 checksum
How to use checksums
34766c1797641de48a96a525dc31363845337e79ea8d1e4ad8b8befc8049dcc7
BLAKE2b-256 checksum
How to use checksums
1763f43f345d5a354a449b55627e53031a5890a01fce1ab214e7230ca82561a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pyopenaaas-0.1.3-py3-none-any.whl

Download URL pyopenaaas-0.1.3-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc8fd8161412b6c37e770d6180371a19a4b5c6cd1d42fa922e199a312a5de095
BLAKE2b-256 checksum
How to use checksums
fb425e0633c655e444a2567a221ed084172d2a0d454d52dca88727b5e47bed3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pyopenaaas 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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