Jobs
There are three types of jobs:- Recurring Jobs: Polling/schedule triggers jobs for active flows.
- Flow Jobs: Flows that are currently being executed.
- Webhook Jobs: Webhooks that still need to be ingested, as third-party webhooks can map to multiple flows or need mapping.
Sandboxing
Sandbox in NRAI means in which environment the engine will execute the flow. There are three types of sandboxes, each with different trade-offs:| Name | Supports NPM in Code Addon | Requires Docker to be Privileged | Performance | Secure for Multi Tenant | Environment Variable |
|---|---|---|---|---|---|
| V8/Code Sandboxing | ❌ | No | Fast & Lightweight | ✅ | Set AP_EXECUTION_MODE to SANDBOX_CODE_ONLY |
| No Sandboxin | ✅ | No | Fast & Lightweight | ❌ | Set AP_EXECUTION_MODE to UNSANDBOXED |
| Kernel Namespaces Sandboxing | ✅ | Yes | Slow & CPU Intensive | ✅ | Set AP_EXECUTION_MODE to SANDBOXED |
No Sandboxing & V8 Sandboxing
The difference between the two modes is in the execution of code addons. For V8 Sandboxing, we use isolated-vm, which relies on V8 isolation to isolate code addons. These are the steps that are used to execute the flow:1
Prepare Code Addons
If the code doesn’t exist, it will be compiled using TypeScript Compiler (tsc) and the necessary npm packages will be prepared, if possible.
2
Install Addons
Addons are npm packages, we perform a simple check. If they don’t exist, we use
pnpm to install the addons.3
Execution
There is a pool of worker threads kept warm and the engine stays running and listening. Each thread executes one engine operation and sends back the result upon completion.
Security:
In a self-hosted environment, all addon installations are done by the platform admin. It is assumed that the addons are secure, as they have full access to the machine. Code addons provided by the end user are isolated using V8, which restricts the user to browser JavaScript instead of Node.js with npm.Performance
The flow execution is fast as the javascript can be, although there is overhead in polling from queue and prepare the files first time the flow get executed.Benchmark
TBDKernel Namespaces Sandboxing
This consists of two steps: the first one is preparing the sandbox, and the other one is the execution part.Prepare the folder
Each flow will have a folder with everything required to execute this flows, which means the engine, code addons and npms1
Prepare Code Addons
If the code doesn’t exist, it will be compiled using TypeScript Compiler (tsc) and the necessary npm packages will be prepared, if possible.
2
Install Addons
Addons are npm packages, we perform simple check If they don’t exist we use
pnpm to install the addons.