Skip to main content

Commutator Studios Python SDK

PyPI Version Python Versions License

Commutator SDK is the official Python client for the Commutator Studios quantum ecosystem. It provides a seamless, developer-friendly interface to integrate quantum workloads, optimization engines, and identity management natively into your Python tech stack.

By connecting to the Centralized API Gateway (commutator.app), this SDK handles authentication, rate-limiting, and billing checks automatically, allowing you to focus on building quantum-accelerated applications.


Features

  • Quantum Fleet Management: Discover, list, and check the status of available quantum backends (e.g., ibm_berlin, ibmq_qasm_simulator).
  • Hardware & Algorithmic Recommendations: Interface directly with cs-optimizer to get smart recommendations for hardware and optimization levels (e.g., VQE) before you run your circuits.
  • Job Execution & Polling: Submit quantum circuits, execute jobs on actual quantum hardware, and download results natively into Python objects.
  • Standardized Error Handling: Detailed, structured exceptions (APIError, ValidationError, AuthenticationError) for predictable and easy debugging.
  • ...and more!

Installation

The SDK requires Python 3.11+. You can install it directly from PyPI using pip:

pip install commutator-sdk

Quick Start

Here is a simple example showing how to authenticate, create a job, execute a circuit, and fetch the results.

1. Authentication

You can authenticate using your API Key or Username/Password.

from commutator.client import CommutatorClient

# Initialize the client (Environment is auto-detected)
client = CommutatorClient(api_key="your_api_key_here")

2. Submitting a Quantum Job

Submit your quantum circuit JSON and execute it on a selected backend.

import json

# 1. Create the Job
job = client.create_job(
    name="My First VQE Run",
    algorithm="VQE",
    file_path="circuit.json"
)
job_id = job["id"]
print(f"Job created successfully: {job_id}")

# 2. Execute the Job
client.execute_job(
    job_id=job_id,
    backend="ibm_berlin",
    optimization_level=3
)
print("Job dispatched to the quantum backend!")

3. Optimizer Recommendations

Not sure which backend or optimization level to use? Ask the Recommendation Engine!

recommendations = client.optimizer.recommend(
    job_id="your_job_id",
    target_backends=["ibm_kingston", "ibm_brisbane"]  # Optional: omit to evaluate all fleet backends
)

print(f"Recommended Backend: {recommendations[0]['provider']}")

Error Handling & Exception Reference

When executing quantum simulation jobs, the SDK automatically inspects the API response errorCode and raises typed Python exceptions providing human-readable diagnostic remedies:

from commutator.client import CommutatorClient
from commutator.exceptions import (
    SimulationOOMError,
    SimulationTimeoutError,
    ProviderAuthenticationError,
    JobFailedError
)

client = CommutatorClient(api_key="your_api_key")

try:
    job_details = client.jobs.get(job_id="5bacd027-267d-4c8e-94c4-5348c48880b3")
except SimulationOOMError as e:
    print(f"❌ Memory Error [{e.error_code}]: {e.message}")
    print(f"💡 Actionable Remedy: {e.remedy}")
except SimulationTimeoutError as e:
    print(f"⏱️ Job Timed Out [{e.error_code}]: {e.message}")
    print(f"💡 Actionable Remedy: {e.remedy}")
except JobFailedError as e:
    print(f"⚠️ Job Execution Failed [{e.error_code}]: {e.message}")

Supported Exception Mapping

API errorCode Enum Raised SDK Exception Class Python Import Path
SIMULATION_OOM SimulationOOMError from commutator.exceptions import SimulationOOMError
SIMULATION_TIMEOUT SimulationTimeoutError from commutator.exceptions import SimulationTimeoutError
PROVIDER_AUTH_FAILED ProviderAuthenticationError from commutator.exceptions import ProviderAuthenticationError
OPTIMIZATION_DIVERGED OptimizationDivergedError from commutator.exceptions import OptimizationDivergedError
Fallback / System Faults JobFailedError from commutator.exceptions import JobFailedError

Advanced Usage

For comprehensive documentation, including detailed API reference, Identity Management (list_api_keys, get_audit_logs), and advanced configuration options, please refer to the official Commutator Studios Documentation.

License

Copyright © 2026 Commutator Studios GmbH. All rights reserved.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

commutator_sdk-0.2.1.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

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

commutator_sdk-0.2.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file commutator_sdk-0.2.1.tar.gz.

File metadata

  • Download URL: commutator_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.12.14

File hashes

Hashes for commutator_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 48a92781593c3521f5247bb3d50f117108e29aadf30a134f1c1210f376961e05
MD5 a3403fd212501743d4d8acd94e6c5f42
BLAKE2b-256 416987f83e2eb234d332a444a7b5da42f291e9a5db5e9c96cccd244525118bb5

See more details on using hashes here.

File details

Details for the file commutator_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: commutator_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.12.14

File hashes

Hashes for commutator_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4f64dc812ec5257c105c64727b59ba07c4bf690e429ba5131b017e592f12712
MD5 c6d468e8c9eefec7fb0fc7fbe3839946
BLAKE2b-256 2b3417924b348c18d5f49bc4a2c112fc48e08261f96efe2ddfb0524ec792e8de

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 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