Compress Circuit With State Compression
Submit state-compression jobs for existing or inline circuits.
Use this tool when the caller wants to run Haiqu state compression on
either an existing stored circuit or a new inline QASM payload. At least
one of circuit_ids or circuit_qasm must be supplied, and the
response schema is a lightweight {"context": ...} wrapper rather than a
structured job object.
When to Use:
- Call this when the workflow needs a compressed or optimized circuit derived from an existing circuit or from inline QASM.
- Call this before later execution or circuit analysis when the user wants Haiqu state compression applied first.
Constraints:
- Provide at least one of
circuit_idsorcircuit_qasm. - The response is a lightweight context wrapper; use
get_job_results_and_statusto retrieve terminal outputs such as the generated circuit ID. - This docstring does not promise normalized
404handling for every invalid circuit reference because the lower-layer compression path owns part of that behavior.
Notes:
- If inline QASM is provided, the endpoint may create a circuit first and then submit compression.
- The created or reused input circuit is stored as
input_circuit_idin the job record.
The batch of compression jobs could be submitted via circuit_ids. If both
circuit_ids and circuit_id are provided, circuit_ids will be used and
circuit_id will be ignored, it is deprecated.
Args:
user: Authenticated user resolved from the API key.
data: Compression payload. One of circuit_ids or circuit_qasm
must be provided.
db: Active database session.
Returns: A lightweight context wrapper summarizing the submission and next polling step.
Raises:
HTTPException: Raised with 400 when neither circuit input mode is
provided, 402 when the caller cannot submit billable jobs, or
404 when the experiment is not available to the caller.
Authorizations
Body
Define payload for MCP state-compression submissions.
The request may reference either an existing circuit_id or inline
circuit_qasm; endpoint-level validation enforces that at least one is
present.
Attributes: experiment_id: Parent experiment identifier for the compression job. name: Optional name to use when a new circuit must be created from inline QASM. circuit_id: Existing circuit ID to compress. Deprecated. circuit_ids: Existing circuit IDs to compress. circuit_qasm: Inline QASM source to persist and compress. compression_type: Compression backend or mode identifier. The default value should normally be left unchanged. parameters: Compression configuration forwarded to the backend.
State compression options: compression_level (low|balanced|high|max), noise_profile (e.g. default, ibm_heron_r2, iqm_garnet), fine_tuning (disabled|low|heavy), and optional approximation_level (int or null).
List of existing circuit IDs to compress.
Name for the circuit to compress. Required if circuit_qasm is provided without circuit_id.
ID of the existing circuit to compress. Deprecated.
Quantum circuit in QASM 2.0 or 3.0 format. Use either this field or circuit_id field to specify the existing circuit ID to compress.
Response
Successful Response
Represent context payload returned after compression job creation.
Attributes:
context: Submission summary text including the created job ID and next
polling step. This response model does not expose structured
job_id or output circuit_id fields outside the text.