Skip to main content

Strangeworks SDK

The Strangeworks SDK facilitates interaction with the Strangeworks quantum computing platform, offering a suite of methods to manage workspaces, resources, and execute quantum jobs.

Authentication

To interact with the Strangeworks platform, you must first authenticate using your API key. This is crucial for accessing your workspace and performing any operations.

  • authenticate(api_key)

Workspaces

Workspaces serve as the foundational structure for organizing and managing your quantum computing projects on the Strangeworks platform. By invoking the workspace_info() method, you can retrieve comprehensive details about your current workspace. This includes the workspace's unique identifier (ID), its slug, name, and status regarding whether it is disabled. Such information is instrumental in segregating project data and managing billing information distinctly for each workspace.

Example output from workspace_info():

Workspace(slug='example_slug', is_disabled=False, id='example_id', name='Team')

Resources

The Strangeworks platform allows for the management of multiple resources within your current workspace. Resources are essentially computational assets that can be associated with different quantum computing products. Managing resources effectively enables you to optimize your quantum computing tasks by selecting the most suitable computational backend for each job.

List Resources

  • resources()

    This method retrieves a list of all resources available within the current workspace. Each resource is uniquely identified and can be associated with different products for quantum computing tasks.

    Example of a resource:

    Resource(slug='resource_slug', resource_id=None, status='ACTIVE', name=None, is_deleted=False, product=Product(slug='product_slug', product_id=None, name='Product Name'))

Multiple Resources

While the platform supports the management of multiple resources, they are disabled by default to streamline the user experience and manage computational costs effectively. However, enabling and managing multiple resources can be particularly useful in scenarios where different tasks require different computational backends or when tasks are optimized for specific hardware.

To enable and manage multiple resources, users can specify the resource_slug when associating a resource with a product, allowing for more granular control over the computational resources used for quantum computing tasks.

Set Resource

  • set_resource_for_product(product_slug, resource_slug)

    This method allows you to associate a specific resource with a product. Associating the right resource with a product is crucial for optimizing performance and resource utilization.

  • get_resource_for_product(product_slug)

    Fetch the resource currently associated with a product. This is useful for verifying which resources are being utilized by different products.

Files

  • upload_file(file_path)

    Upload a file to the current workspace.

  • download_job_files(job_slug)

    Download files associated with a specific job.

Backends

  • backends()

    List available quantum backends.

Jobs

  • execute(res, payload, endpoint=None)

    Execute a job on a specified resource.

  • jobs()

    Retrieve a list of jobs submitted to the platform.

  • get_error_messages(job_slug)

    Fetch error messages for a given job.