Modal Sandbox
The Modal Sandbox component acts as a protected workspace where you can safely execute automation scripts and data processing tasks. It ensures that your code runs in an isolated environment, keeping your main system secure and stable while it processes your instructions. Think of it as a safe, sandboxed room where your automation tasks can run without affecting the rest of your system.
How it Works
When you connect this component to your workflow, it acts as a secure gateway. You provide configuration settings and context data, and the component passes them to a trusted cloud-based execution engine (provided by Modal). Behind the scenes, this engine automatically handles memory limits, execution time, security rules, and error catching. You don’t need to manage these technical details; the system ensures your code runs safely and returns the final result back to your dashboard for review or further processing.
Connection & Credentials
This component requires configuring a credential in the Nappai panel before interacting with the external service:
- Go to the Credentials section in your Nappai panel.
- Create a new credential of the type Modal API and fill in your Modal Token ID and Modal Token Secret. You can generate these tokens in the official Modal Settings portal.
- In your workflow, select the saved credential in the Credential input field of this node.
Inputs
Input Fields
The following fields are available to configure this component. Each field may be visible in different operations:
- Environment Configuration: A set of parameters that define how the sandbox should behave, such as memory limits, execution time, and security rules. Leave blank or use the default values to let the system apply safe, standard settings.
- Context Data: A collection of variables or session information that the sandbox needs to understand the current state of your automation. This is typically empty by default and is automatically populated by the system based on your workflow’s previous steps.
Outputs
This component returns a structured result containing the status of your automation, any relevant logs, and the final processed data. You can use this output to feed into subsequent components, trigger follow-up actions, or log the result for auditing.
Output Data Example (JSON)json
{ “status”: “success”, “execution_logs”: “Script executed successfully in isolated environment.”, “data”: { “result”: “Automation completed”, “processed_items”: 42 }, “error”: null }
Connectivity
In a typical workflow, this component acts as a bridge between data preparation or code execution nodes and downstream processing steps. You would usually connect it to the outputs of a script editor, data transformer, or trigger component that provides the configuration and context. After execution, its output connects to components that handle the results, such as data savers, notification senders, or conditional routing nodes. This flow ensures that automation steps are executed safely before impacting downstream tasks.
Tips and Best Practices
- Keep your Context Data lean to improve execution speed and reduce memory usage.
- Rely on the default Environment Configuration unless you have a specific need for custom memory or time limits.
- Always check the
statusfield in the output to handle errors gracefully in subsequent steps. - Use this component for data processing, AI agent calls, or any task that requires a secure, isolated execution environment.
Security Considerations
- Isolated Execution: All code runs in a completely separate environment, preventing accidental interference with your core systems or data.
- Credential Management: Never share or hardcode API tokens. Always use the Nappai credential manager to securely store and inject your Modal API keys.
- Resource Limits: The sandbox automatically enforces memory and time limits to prevent runaway processes. Avoid sending extremely large datasets to keep executions fast and reliable.
- Audit Logging: Every execution is logged internally. Review logs through the component output if you need to troubleshoot unexpected behavior.