agent: Document and implement cancelling of restjson requests.