getAgentContext returning null

I have a Java agent that runs perfectly well on our 8.0.2 server. The agent is triggered through a RunOnServer command in another agent (in LotusScript)

Testing our processes on an 8.5 server, we are getting a NullPointerException error which I have traced back to the getAgentContect session property returning null

Looking at the 8.5 document, getAgentConte=xt mentions “getAgentContext returns null if the program is not running as an agent.”

What setting on the server would make the agent think it is not an agent/cause this null return value?

Many thanks

Mike