Yes, it’s definitely possible. Technically, such a task would involve calling a subflow (or child flow), and Prefect would orchestrate those subflows as if they would belong to a single (parent) flow.
Check out this topic for details on how you can use that with a Docker or Kubernetes agent: