imp and agent code