---
title: pre_build (latest version)
description: API reference for samplomatic.builders.pre_build in the latest version of samplomatic
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/samplomatic/auto/builders-pre-build
---

# pre\_build

`samplomatic.builders.pre_build(circuit: QuantumCircuit, debug: bool = False) → tuple[TemplateState, PreSamplex]`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/builders/build.py#L72-L94)

Build a template state and a pre-samplex for the given boxed-up circuit.

This is a helper method to `build()` and is not intended to be useful in standard workflows.

**Parameters**

- **circuit** – The circuit to build.
- **debug** – Whether to populate pre-nodes with information that traces them back to the boxes that generated them. Tracing information is based on `ref` attributes of box annotations.

**Returns**

The built template state and the corresponding pre-samplex.
