Amazon Braket does not have native support for converting circuits to OpenQASM 2. So besides implementing your own Python script, there's not currently a way to do this that does not involve going through an "intermediate" library.
As mentioned by @Callum in the comments, you could go through pytket + pytket-braket:
from pytket.qasm import circuit_to_qasm_str
from pytket.extensions.braket import braket_to_tk
circuit = # Amazon Braket circuit
qasm_str = circuit_to_qasm_str(braket_to_tk(circuit))
You could also go through qBraid:
from qbraid import circuit_wrapper
circuit = # Amazon Braket circuit
qasm_str = circuit_wrapper(circuit).transpile("qasm2")
Integrations through mitiq, amazon-braket-pennylane-plugin-python, or qiskit-braket-provider could also be equally if not more efficient than direct qasm conversions depending on your use-case.
Edit: Was not considering OpenQASM 3 conversions, which are supported! See answer above :)
braket_to_tk
function from the pytket-braket extension will give you a pytketCircuit
. You can then convert theCircuit
to qasm with thecircuit_to_qasm
function. $\endgroup$