Hardware and cloud

Using Strawberry Fields, you can submit quantum programs to be executed on photonic hardware or to be run on a cloud simulator via the Xanadu Quantum Cloud.


An authentication token is required to access the Xanadu cloud platform. In the following, replace AUTHENTICATION_TOKEN with your personal API token.

If you do not have an authentication token, you can request hardware access via the sign up form on the Xanadu website.

Configuring your account

Before using the Xanadu cloud platform, you will need to configure your credentials. This can be done using several methods:

  • Configuration file (recommended). Use the Strawberry Fields store_account() function from within Python or a Jupyter notebook,

    >>> sf.store_account("AUTHENTICATION_TOKEN")

    or the sf configure command line interface,

    $ sf configure --token AUTHENTICATION_TOKEN

    to store a configuration file containing your credentials. Replace AUTHENTICATION_TOKEN above with your Xanadu cloud access token.


    The above configuration file need only be created once. Once created, Strawberry Fields will automatically load the stored authentication credentials.

  • Environment variables. Set the SF_API_AUTHENTICATION_TOKEN environment variable with your API token.

  • Keyword argument. Pass the keyword argument token when initializing the RemoteEngine.

See also

For more details on configuring Strawberry Fields for cloud access, including creating local per-project configuration files, see the configuration module and store_account() function.

Verifying your connection

To verify that your account credentials correctly authenticate against the cloud platform, the ping() function can be used from within Python,

>>> sf.ping()
You have successfully authenticated to the platform!

or the ping flag can be used on the command line:

$ sf --ping
You have successfully authenticated to the platform!

Submitting jobs on hardware

Once connected to the Xanadu cloud platform, the Strawberry Fields RemoteEngine can be used to submit quantum programs to available photonic hardware:

>>> eng = sf.RemoteEngine("chip_name")
>>> result = eng.run(prog)

In the above example, eng.run() is a blocking method; Python will wait until the job result has been returned from the cloud before further lines will execute.

Jobs can also be submitted using the non-blocking eng.run_async() method. Unlike eng.run(), which returns a Results object once the computation is complete, this method instead returns a Job object directly that can be queried to get the job’s status.

>>> job = engine.run_async(prog, shots=3)
>>> job.status
>>> job.refresh()
>>> job.status
>>> result = job.result
>>> result.samples
array([[0, 0, 1, 0, 1, 0, 1, 0],
       [0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 2]])

Job objects have the following properties and methods:


The job ID.


Returns the current job status, with possible values including "open", "queued", "cancelled", "complete", and "failed".


Returns the Result of a completed job.


Refreshes the status and metadata of an open or queued job, along with the job result if the job is newly completed.


Cancels an open or queued job.

Alternatively, if you have your quantum program available as a Blackbird script, you can submit the Blackbird script file to be executed remotely using the Strawberry Fields command line interface:

$ sf run blackbird_script.xbb --output out.txt

After executing the above command, the result will be stored in out.txt in the current working directory. You can also omit the --output parameter to print the result to the screen.

Cloud simulator

In addition to submitting jobs to be run on quantum hardware, it is also possible to run jobs on cloud simulators (which we refer to as “simulons”) via the Xanadu Quantum Cloud. The process is very similar to running jobs on hardware. You will need to configure your account, as described above, and submit a job via the RemoteEngine, using a simulator as the target instead of a specific chip:

>>> eng = sf.RemoteEngine("simulon_gaussian")
>>> result = eng.run(prog)

Simulator jobs can also be submitted asynchronously using eng.run_async, or by submitting a Blackbird script with the target set to a simulator target in the Blackbird header.

See the Submitting jobs on hardware section above for more details.


The simulon_gaussian simulator runs on the gaussian backend (see Simulating your program) and thus only supports Gaussian operations, including homodyne and heterodyne measurements, as well terminal Fock measurements. Note that there are limits to how many measurements a circuit can have depending on the type of measurement. These can be retrieved by calling engine.device_spec.modes with engine = sf.RemoteEngine("simulon_gaussian").


For more details on submitting jobs to photonic hardware, check out the following tutorials.