is_hosted_session: Detect if running in a hosted session

View source: R/import-funs.R

is_hosted_sessionR Documentation

Detect if running in a hosted session

Description

Determines whether the current R session is running in a hosted environment such as Google Colab or RStudio Server (non-localhost).

Usage

is_hosted_session()

Details

This function checks for:

  • Google Colab: presence of the COLAB_RELEASE_TAG environment variable

  • RStudio Server: RSTUDIO_PROGRAM_MODE is "server" and RSTUDIO_HTTP_REFERER does not contain "localhost"

Value

A logical value: TRUE if running in a hosted session (Google Colab or remote RStudio Server), FALSE otherwise.

Examples

if (is_hosted_session()) {
  message("Running in a hosted environment")
}

azr documentation built on Feb. 18, 2026, 1:07 a.m.