Remove unecessary code according to our warning level.
Add the functions to cancel an AgentTask.