run_js
Execute JavaScript code with npm dependencies in a secure sandbox container for complex workflows, ensuring file persistence through the ./files directory.
Instructions
Install npm dependencies and run JavaScript code inside a running sandbox container. After running, you must manually stop the sandbox to free resources. The code must be valid ESModules (import/export syntax). Best for complex workflows where you want to reuse the environment across multiple executions. When reading and writing from the Node.js processes, you always need to read from and write to the "./files" directory to ensure persistence on the mounted volume.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
code | Yes | JavaScript code to run inside the container. | |
container_id | Yes | Docker container identifier | |
dependencies | No | A list of npm dependencies to install before running the code. Each item must have a `name` (package) and `version` (range). If none, returns an empty array. | |
listenOnPort | No | If set, leaves the process running and exposes this port to the host. |