Islamic Republic of Iran and Pakistan have agreed to launch joint forces to confront terrorist groups in the first visit made by Pakistani top official as he pledges not to join any anti-Iran campaign.