--- title: Runtime globals group: Getting started order: 20 summary: Variables every script can read. --- ## System globals - `BUILD_VERSION` - `INTERNAL_VERSION` - `LOADED_MODULES` - `LOADED_STORAGES` - `__FILE__` - `HTTP_RESP` - `HTTP_HEADER` ## User globals - `USERNAME` - `USERICON` - `USERQUOTA_TOTAL` - `USERQUOTA_USED` - `USER_VROOTS` - `USER_MODULES` ## Detached-script globals (`execd` child) - `BUILD_VERSION`: Current system build version - `INTERNAL_VERSION`: Internal version number - `LOADED_MODULES`: Array of loaded system modules - `LOADED_STORAGES`: Array of available storage pools - `__FILE__`: Current script file path - `HTTP_RESP`: Response content (automatically set) - `HTTP_HEADER`: Response content type (automatically set) - `USERNAME`: Current user's username - `USERICON`: Current user's icon path - `USERQUOTA_TOTAL`: User's total storage quota - `USERQUOTA_USED`: User's used storage quota - `USER_VROOTS`: User's accessible virtual root paths - `USER_MODULES`: User's accessible modules - `EXECUTION_ID`: UUIDv4 that uniquely identifies this script invocation — useful for correlating log lines across concurrent executions - `PARENT_DETACHED` (`true`) - `PARENT_PAYLOAD` (string payload) ## Request parameters How a script reads the request that started it depends on how it was called. - **Front-end calls** (`ao_module_agirun`, `/system/ajgi/interface`): every form field of the request becomes a global variable of the same name. A JSON request body sets one global per top-level field instead, plus `POST_data` holding the raw body. - **Serverless and user-run scripts**: `REQ_METHOD` holds the HTTP method, `getPara(key)` and `postPara(key)` return a query or form value (or `null`), and `readBody()` returns the raw request body. ```javascript // Called as ao_module_agirun("MyApp/backend.agi", {name: "Alice"}, ...) if (typeof(name) == "undefined") { sendResp("missing name"); } else { sendJSONResp({ greeting: "Hello " + name }); } ```