Added unit test for agent writer