I would not try to get any deadline classes into you script. If you need to access anything in deadline fron an external script you should ony use the standalone API. Getting the task that caused this very script to run through the API is not super trivial though and IMHO a somewhat backward approach.
It would be more straightforward if plugin at execution would pass the needed info to your script directy. A possible approach to this would be what I suggested here.