this looks weird...

shouldn't it be:
agent->getAgentId()