  In the multi-messenger era, coordinating observations between astronomical
facilities is mandatory to study transient phenomena (e.g. Gamma-ray bursts)
and is achieved by sharing information with the scientific community through
networks such as the Gamma-ray Coordinates Network. The facilities usually
develop real-time scientific analysis pipelines to detect transient events,
alert the astrophysical community, and speed up the reaction time of science
alerts received from other observatories. We present in this work the RTApipe
framework, designed to facilitate the development of real-time scientific
analysis pipelines for present and future gamma-ray observatories. This
framework provides pipeline architecture and automatisms, allowing the
researchers to focus on the scientific aspects and integrate existing science
tools developed with different technologies. The pipelines automatically
execute all the configured analyses during the data acquisition. This framework
can be interfaced with science alerts networks to perform follow-up analysis of
transient events shared by other facilities. The analyses are performed in
parallel and can be prioritised. The workload is highly scalable on a cluster
of machines. The framework provides the required services using
containerisation technology for easy deployment. We present the RTA pipelines
developed for the AGILE space mission and the prototype of the SAG system for
the ground-based future Cherenkov Telescope Array observatory confirming that
the RTApipe framework can be used to successfully develop pipelines for the
gamma-ray observatories, both space and ground-based.
