Added JSON metadata support to agent