The general meaning of Āgama (Agama) is śāstra (sastra; scriptures), at least as it appears in the ślokas (sloka; verses) in Śāntiparva(Santiparva) of Mahābhārata (Mahabharata). These ślokas maintain that scholars all know that nobody has seen svarga (the heaven) or naraka (the hell). So those who work according to the thought of the other world, do so because they believe in the śāstras. Since nobody has seen svarga or naraka,  āgama become the eye though which we can get a picture of them. So one should follow the śāstras (sastra; scriptures)–

* āgamāstvanatikramya śraddhatavyaṁ vibhūṣata

 *na caiva puruṣo draṣta svargasya narakasya ca.

  āgamastu satāṁ cakṣurnṛpate tamihācara.

* dharmaṁ carāmi suśroṇi na dharmaphalakāraṇāṭ 

   āgamānanatikramya satāṁ vṛttamavekṣya ca.

* āgamādhigamad yogād vaśī tatve prasīdati.

But in the very Śāntiparva, in the famous conversation between Kapila and Syumaraśmi (Syumarasmi), while talking of his knowledge in śāstra, Syumaraśmi says that he has properly known all the śastras excluding the nāstika (nastika; atheist) ones — the Buddhist and other kinds of atheist logic. And he considers that besides the Vedas, other śastras that seek to clarify the Vedas, such as Purvamimāṁsā (Purvamimamsa; a priori philosophy ), Uttaramimāṁsa (Uttaramimamsa; a- posteriori philosophy), and the Sāṁkhya-Pātanjala (Samkhya Patanjala) logic, are also āgama (agama)–

anyatra tarkaśāstrebhya āgamārthaṁ yathāgamam 

āgamo vedavādaśca tarkaśastrāṇi cāgamaḥ.

So in these beautiful words, Mahābhārata (Mahabharata) maintains that by āgama, we are to understand the Vedas as well as all the Veda-following logistic scriptures. Researchers have argued that besides āgama, we have another well-know term called ‘nigama‘. But nigama is strictly śrutiśāstra (srutisastra; scriptures that belong to an oral tradition of preaching and hearing) like the Vedas and the Upaniṣad, and in this very sense, Bhāgavatapurāṇa (Bhagavatapurana) is called the ripened fruit of the nigama, imaged as kalpataru (the wish-fulfilling tree)

nigama-kalpatarorgalitaṁ phalam.

On the contrary, the non-Vedic scriptures are popularly known as āgama; even the unconventional, non-Vedic texts such as the Pañcarātra (Pancharatra)-texts, and saṁhitā (samhita)- texts–like Jayākhyasaṁhita (Jayakhya Samhita)and Ahirbudhnyasaṁhitā (Ahirbudhnya Samhita)– are also referred to as āgama. Kulārṇavatantra (Kularnavatantra) says that the instructions of the Vedas and the Purāṇas are open and clear, while those of the Śaiva (Saiva)and Śākta(Sakta) āgama are mysterious —

śaivaśāktāgamaḥ sarve rahasya parikīrtitaḥ.

Again, towards the end, Kulārṇavatantra defines āgama as the discourse of the divine state and the mysterious ways of attaining that state —

ācārakathanaddivyagat-prāpti nidānataḥ

mahārthatavakathanād āgamḥ kathitaḥ priye.

From this Tantra-definition, it appears that besides the Veda-following scriptures, non-Vedic texts were also called āgama.

[Kulārṇavatantra 3.4. 17.43, p 63,439][V.S. Lalrinawana, Major Faith Traditions in India, p. 119-120]

In the general classification of śāstras in India, the name of āgama comes along with the Vedas, Upaniṣad and Purāṇas, and there are several scholars who believe that since the post-Mahābhārata period, the people follow the āgama more than the theories , Vedas and Upaniṣad. The major three ways of religious faith have been founded on the basis of these āgama (agama).  The Vaiṣnava āgamas (Vaishnava agama) hail the glory of  Srī Viṣnu ( Sri Vishnu), just as the Śaiva āgamas commomorate Śiva’s greatness and the Śaivite creeds, the Śākta āgamas glorify the śakti-goddesses like Durgā(Durga) and Kālī (Kali). According to the scholars, there are 108 Vaiṣnava (Vaishnava), 28 Śaiva (Saiva) and 77 Śākta (Sakta) āgama-texts.

[P.T. Srinivasa Iyenger, History of Tamils, pp.3-15, Surendranath Dasgupta][ A History of Indian Philosophy, Vol.5, pp. 20-23.]

Āgamaśāstra, however transformed much into the Tāntrik thoughts in later periods, was believed to be the mantras or hymns containing Sri Hari’s own power and energy in the Bhāgavatapurāṇa. So we can understand that traditionally, āgama refers to those  traditional texts that carry on ( ā-gamana) the fundamental messages of the Vedas and Upaniṣad. In Patanjali’s (the author of Mahābhāṣya) usage (circa 150 A.D.) it is clear that the Vedic-Brāhminical practices and creeds were denoted by ‘āgama.’ Mentioning the term āgama, he writes that the Brahman’s niṣkāraṇa (nishkarana; unconditional) duty is to study and know ṣaḍaṇga (sardanga; six-limbed or having six components) Veda

yathā āgamaḥ khalvapi — brāhmaṇena niṣkāraṇo

dharmaḥ śaḍaṅga vedodhyeyo jñeyaśca.

According to those who discourse about  modes of proof like pratyakṣa (pratyaksha; direct perception) and  anumāna (anumana;intuition), what āpta-jana( aptajana; wise men) — who know the meaning of śāstra and theories, through an analysis of hetu-pramāṇa-siddhi (hetu-pramana-siddhi;cause-proof-conclusion ), consider as beneficial for this world and the other world, is āgama — this is the śastra of the wise —

siddhaṁ siddhi pramāṇaistu hitaṁ mātra paratra va 

āgamaḥ śāstramāptānāṁ āptastatvārtha vedinam .

Tantra-śāstra (Tantra-sastra; Tantrik Scriptures) considers that āgama came down from the mouth of God Śiva (Siva) and stayed in the mouth of Girisutā ( Girisuta; the daughter of the Mountain, or Goddess Pārvati) — and this is the opinion of Vāsudeva(Vasudeva) — this ‘coming down’ itself is āgama

āgataṁ pañcabaktrāttu (Śivabaktrebhyo) gataṅca girijānane

matañca Vāsudevasya tasmād āgamamucyate.