Dealing with different processversions

We use an application with Camunda 7.5 deployed on an WildFly and interact with the Camundaengine via the Java-API. Over the time different versions of the processmodel will exist side by side in Camunda with different version tags we assign. New processes will use the new processmodel, old processes will continue to use the processmodel they were deployed with.
Now our application has to react to the fact that different versions have possibly different processmodels. Is there a way to read the version (=versiontag) of a running processinstance to decide what to do in the application?

For example in a JavaDelegate implementation, you can obtain the version tag as follows:

DelegateExecution execution = ...;
RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService();
ProcessDefinition definition = repositoryService.getProcessDefinition(execution.getProcessDefinitionId());
String versionTag = definition.getVersionTag();

OK, that shows me the version and version-tag of the actual processdefinition, but I need to know the version-tag of a process / processinstance that was started sometime in the past and is still running altough a new processdefinition was deployed in the meantime. I would expect something like Task.getVersionTag() or HistoricTaskInstance.getVersionTag().

Why can’t you select the task’s process definition ID and then make the calls I posted?

Ahh, ok, that did the trick! Thank you very much!