Runtime Context lets your ODC apps know which stage they're running on — and whether it's Production — at runtime, with zero configuration.
ODC has no built-in way to read the current stage; the usual workaround is a per-stage app Setting you maintain everywhere. Runtime Context reads the stage tier straight from the platform, so it just works out of the box.
Use it to:• Gate logic to Production — or to non-Production — with IsProductionStage• Stamp logs and telemetry with the current stage• Branch behaviour safely across Development, Test, and Production
Server Actions:
Stateless, thread-safe, and fails safe: anything not clearly Production is treated as non-production, so you never get a false positive. No third-party dependencies.
runnp
StageId
ExplainClassification
RuntimeDetails.MachineName
169
LambdaFunctionName
AwsRegion
Read this first
IsProductionStage() is directional. It returns False both when the stage is confirmed non-production and when the stage could not be determined.
IsProductionStage()
If IsProductionStage() Then
If Not IsProductionStage() Then
The unsafe pattern routes real production traffic into test behavior on any stage where the platform signal is missing. When the distinction matters, read GetCurrentStage() and branch on IsClassified — True only when the stage was positively identified.
GetCurrentStage()
Requires Secure Gateway on the stage
Stage classification reads a signal that only exists when Secure Gateway is configured. On a stage without it — a personal or trial tenant, typically — every classification action returns Unknown with reason SignalAbsent, and IsProductionStage() returns False.
Unknown
SignalAbsent
That is the fail-closed design working, not a defect. GetStageId, GetRuntimeUrl, GetRuntimeDetails, GetTraceContext and GetRuntimeLifecycle are unaffected and still return real values. Run ExplainClassification to confirm which case you are in.
GetStageId
GetRuntimeUrl
GetRuntimeDetails
GetTraceContext
GetRuntimeLifecycle
The library deliberately does not guess the stage from the URL. A subdomain ending in -dev is a customer-controlled naming convention, not a platform fact, and inferring from it would turn an honest Unknown into a confident wrong answer.
-dev
Actions
All actions take no input parameters. Call them anywhere in server-side logic and read the outputs.
Classification values
StageDetails.Classification is one of Production, NonProduction, Development or Unknown.
StageDetails.Classification
Production
NonProduction
Development
Unknown means the stage was not identified — either the signal was absent, or it carried a realm token this version does not recognize, so a future ODC tier is never reported as a stage the library claims to understand. Read IsClassified rather than inferring anything from Unknown: it is False in exactly those cases, and Unknown must never be treated as evidence of a non-production stage.
Verified
Validated on a live ODC tenant across all four stages (eu-central-1):
https://opensource.org/licenses/BSD-3-Clause