How can add task in the already running instance in Camunda 8?

how we can migrate process instances from one version to another while instance is running in camunda 8?

Suppose we have 3 user tasks created initially and deployed it.

Now I want to add user task-4 but not from the modeler may be from the code side. I should not touch the modeler. Based on any condition if I want to add another task how can I do that?

Hi @Manish_Tiwari - you are looking for process instance migrations. There are some limitations, which are explained in that link.

However, you cannot do it with an API call; you need model a new version of your process (which can be achieved using milestones in Modeler without needing a new file or losing your changes), and that process needs to be deployed as new version. Then you can migrate running instances of the previous version to the new version.