Also if I add an error handling to the function like this:
let details = await contractInstance.getAgentDetails.call({from:this.state.account},function(error,result){
console.log("error when executing the function",result);
});
It is weird because i receive the expected output as an error in the result but in a weird format.(note the Xs):