# Stages Management

To capture the full lifecycle of the IoT devices, the device model has multiple stages. This captures the whole behaviour of the devices as they can behave differently in different scenarios.&#x20;

In any device model two stages, the Init and the Finished are always present and cannot be deleted. They represent the first stage of the device lifecycle as it is initialised and the final stage of the device when it needs to shut down.

Apart from these two stages, an additional stage named Running is created by default. This stage is supposed to be the active stage of the device. The bulk of the device logic should go in the running stage and other stages that can be created between Init and Finished. There is no limitations to the number of such stages.

<figure><img src="/files/SfP2eTAaSfR2uYiy9ucX" alt=""><figcaption></figcaption></figure>

Having the device model broken into such stages makes it easier to work with the device and allows for a high degree of complexity to be implemented in the device model.

Let's now look at how to work with these stages. Starting with the Init Stage.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.iotify.io/concepts/understanding-a-test/stages-management.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
