Actions10
- Agent Chat Actions
- Browser Automation Actions
- Code Execution Actions
- File Processing Actions
- Memory Operation Actions
- Tool Execution Actions
Overview
The node enables execution of custom code snippets in different runtime environments, specifically Python, Node.js, or shell commands. It is designed to run user-provided scripts within a controlled environment, optionally maintaining state across multiple executions via session identifiers. This functionality is useful for automating tasks, performing data analysis, running quick scripts, or integrating custom logic into workflows without leaving the n8n platform.
Practical examples include:
- Running a Python script to analyze incoming data and return results.
- Executing Node.js code to manipulate JSON objects dynamically.
- Running shell commands to interact with the underlying system or external tools.
Properties
| Name | Meaning |
|---|---|
| Code | The actual code snippet to execute. Supports Python, Node.js, or shell commands depending on the selected runtime. |
| Runtime | The environment in which the code will be executed. Options: Python, Node.js, Shell. |
| Session ID | Optional identifier to maintain execution context between runs. Variables and imports persist within the same session. Useful for multi-step workflows requiring stateful execution. |
| Timeout (Seconds) | Maximum allowed execution time in seconds (1 to 300). Execution will be terminated if it exceeds this limit. |
Output
The node outputs the result of the executed code in the json field of the output data. This typically includes any returned values or printed output from the code execution. If the code produces binary data (e.g., files or images), the node would handle it accordingly, but based on the provided information, the primary output is JSON-formatted execution results.
Dependencies
- Requires an API key credential to authenticate requests to the Nerve Agent AI system backend.
- The node depends on the Nerve Agent service to perform the actual code execution remotely.
- No local runtime dependencies are needed as execution happens in the cloud environment managed by the service.
Troubleshooting
- Timeout Errors: If the code takes longer than the specified timeout, execution will be forcibly stopped. Increase the timeout value if necessary, but keep it within the allowed range (1-300 seconds).
- Syntax or Runtime Errors: Errors in the user-provided code (syntax mistakes, undefined variables, etc.) will cause execution failure. Validate code correctness before running.
- Session Issues: Using the same session ID allows persistence of variables and imports. If unexpected behavior occurs, verify that the correct session ID is used or try clearing it to start fresh.
- Authentication Failures: Ensure the API key credential is correctly configured and has proper permissions.
Links and References
- Nerve Agent Documentation (hypothetical link for further details)
- n8n Custom Nodes Guide