Submit Circuit For Analytics
Submit a QASM circuit and persist core analytics for MCP workflows.
Use this tool when the caller has experiment_id plus circuit_qasm
and needs a persisted circuit before running, compressing, transpiling, or
inspecting related jobs. The endpoint computes and stores core analytics
such as qubit count, depth, and gate counts, and it deduplicates by circuit
hash within the authenticated user and experiment scope.
The returned object is a ContextCircuitModel, which represents a
persisted Haiqu circuit entity for MCP and API workflows rather than a raw
Qiskit QuantumCircuit instance. This Haiqu model carries stable IDs,
experiment ownership, stored analytics, and MCP context so later tools can
reference the circuit directly without serializing or passing around the
in-memory Qiskit circuit object itself.
When to Use:
- Call this when a workflow starts from inline QASM and needs a stable
circuit_idfor later MCP tools. - Call this before
run_circuits_on_qpu_or_simulatororcompress_circuit_with_state_compressionwhen the circuit is not already stored.
Constraints:
experiment_idmust refer to an accessible experiment owned by the authenticated caller.- Circuit deduplication is hash-based within the caller and experiment scope, so this route may return an existing circuit instead of creating a new row.
Notes:
- The response is the full
ContextCircuitModelobject, not a lightweight acknowledgment wrapper. - For agent-facing output, surface
id,name, and the key analytics fields instead of repeating the raw QASM payload.
Args: user: Authenticated user resolved from the API key. data: Circuit payload containing the parent experiment ID, QASM source, and optional MCP context text. db: Active database session.
Returns: The created or reused circuit object.
Raises:
HTTPException: Raised with 400 when the QASM payload cannot be
parsed, or 404 when the parent experiment is not available to
the caller.
Authorizations
Body
Define payload for creating an MCP circuit from QASM.
Attributes: experiment_id: Parent experiment identifier. circuit_qasm: Quantum circuit source in QASM format. name: circuit name. description: Optional circuit description. context: Agent-facing reason for creating the circuit.
Response
Successful Response
Extend a stored circuit model with MCP context text.
Attributes: context: ai summary describing the circuit role in the workflow.
Class for circuit analytics calculation job status.
Submitted, Running analytics computation, Core metrics computation is done, Advanced metrics computation is done, Evolution computation is done, Done, Error Data model for circuit metrics.