Both agriculture and oil have their important roles to play in the economic success of a country. Countries that have very fertile land for agriculture but low oil reserves can grow produce and trade such products with countries that have abundant oil reserves but in turn don't have the fertile land to grow agricultural produce, develop good international relations with such countries and could also import oil from such countries and vice versa.
International trade plays a good role in this perspective, when you don't have what you need, you use what you have to get what you need from who has what you need but doesn't have what you have and are in need of it.