---
title: InstructionSet (latest version)
description: API reference for qiskit.circuit.InstructionSet in the latest version of qiskit
source: https://quantum.cloud.ibm.com/docs/en/api/qiskit/qiskit.circuit.InstructionSet
---

# InstructionSet

*class* `qiskit.circuit.InstructionSet(*, resource_requester=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/circuit/instructionset.py#L31-L133)

Bases: [`object`](https://docs.python.org/3/library/functions.html#object)

Instruction collection, and their contexts.

New collection of instructions.

The context (`qargs` and `cargs` that each instruction is attached to) is also stored separately for each instruction.

**Parameters**

**resource\_requester** (*Callable\[...,* [*ClassicalRegister*](/docs/api/qiskit/circuit#qiskit.circuit.ClassicalRegister "qiskit.circuit.ClassicalRegister")  *|*[*Clbit*](/docs/api/qiskit/circuit#qiskit.circuit.Clbit "qiskit.circuit.Clbit")*] | None*) –

A callable that takes in the classical resource used in the condition, verifies that it is present in the attached circuit, resolves any indices into concrete [`Clbit`](/docs/api/qiskit/circuit#qiskit.circuit.Clbit "qiskit.circuit.Clbit") instances, and returns the concrete resource. If this is not given, specifying a condition with an index is forbidden, and all concrete [`Clbit`](/docs/api/qiskit/circuit#qiskit.circuit.Clbit "qiskit.circuit.Clbit") and [`ClassicalRegister`](/docs/api/qiskit/circuit#qiskit.circuit.ClassicalRegister "qiskit.circuit.ClassicalRegister") resources will be assumed to be valid.

> **Note**
>
> The callback `resource_requester` assumes that a call implies that the resource will now be used. It may throw an error if the resource is not valid for usage.

## Attributes

### cargs

Legacy getter for the cargs components of an instruction set. This does not support mutation.

### instructions

Legacy getter for the instruction components of an instruction set. This does not support mutation.

### qargs

Legacy getter for the qargs components of an instruction set. This does not support mutation.

## Methods

### add

`add(instruction, qargs=None, cargs=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/circuit/instructionset.py#L77-L85)

Add an instruction and its context (where it is attached).

### inverse

`inverse(annotated=False)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/circuit/instructionset.py#L92-L109)

Invert all instructions.

> **Note**
>
> It is preferable to take the inverse *before* appending the gate(s) to the circuit.

**Parameters**

**annotated** ([*bool*](https://docs.python.org/3/library/functions.html#bool))
