It seems likely that Ray does not provide a built-in way to automatically serialize the creation and destruction of actors based on resource availability, nor to automatically switch between serial and parallel execution of actors depending on cluster resources. You can, however, implement this logic manually: create Actor A1 (with model M1), run all type A tasks, terminate A1, then create Actor A2 (with model M2), and run all type B tasks. If resources allow, you can instantiate both actors and run tasks in parallel. Ray will queue actor/task creation if resources are insufficient, but it will not automatically serialize actor lifecycles for you or minimize model loads/offloads without explicit orchestration in your code (see this discussion, Ray Actors docs).
For best practices, you might consider writing orchestration logic that checks available resources (e.g., via ray.available_resources()), then decides whether to run both actors in parallel or to run them sequentially. This approach gives you control over model loading/offloading and ensures efficient resource usage, but it is not handled automatically by Ray (see this example, Ray resource scheduling). Would you like more detail or a code example for this orchestration pattern?
Sources:
Hint: Mention @RunLLM in the post for followups.