LogoLogo
  • Introduction
    • What Is an Agent Application?
    • Core Concepts
    • Getting Started
  • GLIK Cloud
    • Getting Started
      • GLIK Cloud vs. GLIK Studio
    • Prompt Orchestration Interface
    • What Is a Workflow?
    • Workflow Editor
    • App Types (Overview)
    • Workspaces & Permissions
    • Enterprise Readiness & Compatibility
    • Security & Data Handling
  • Enterprise SaaS
    • Expense Policy Decision Engine
    • Compliance & Audit Automation
    • Compliance Advisor Copilot
  • App Types
    • Overview
    • Chatbot
    • Agent
    • Advanced Chat
    • Workflow
  • Templates
    • Overview
    • Policy Automation
      • Overview
        • Expense Policy Validator — Summary Sheet
        • Enterprise Policy Intelligence
      • Expense Policy Decision Engine
        • Expense Policy Decision Engine (Starter)
          • Practice Exercises
        • Expense Policy Decision Engine (Threshold Memory)
          • Practice Exercises
          • Threshold Agent Response Tuning Exercises
        • Expense Policy Decision Engine (Policy API Integration)
          • Practice Exercises
        • Expense Policy Decision Engine (Escalation & Conflict Resolution)
        • Expense Policy Decision Engine (Audit & Logging)
    • Compliance and Audit Automation
      • KYC/AML Review Copilot
        • Learning Track
      • Compliance Copilot – MiCA Reporting
        • Workflow Phases
        • Block-by-Block Guide
    • Compliance Advisors
      • Global Control Copilot – Cross-Jurisdiction Policy Interpreter
        • Input Combinations & Workflow Outcomes
        • Reference Input Payloads
        • Policy Retrieval via Input Routing
        • Input Logic & Routing Behavior
        • Predefined Policy Thresholds
    • Knowledge Systems
      • Overview
      • Compliance SOP Agent
    • Process Automation
    • Task Resolution Agents
      • Why Agentify Task Resolution
    • Work Coordination Agents
      • Escrow Agent Orchestration
    • Embedded Operational Copilots
    • Expense & ERP Agents
      • ERP Vendor AI Copilots and Agents
      • Custody Approval Workflow for Token Issuance
    • Inventory & Logistics Agents
    • Sales & Forecasting Agents
    • Plugin-Based Agent Platforms
  • Marketplace
    • Overview
    • Publishing Templates
  • System Architecture
    • Overview
    • Blocks & Nodes
      • Utilities
        • Start Block
        • End Node
        • HTTP Request
        • List Operator
      • Classifier Nodes
        • Question Classifier
      • Logic Blocks
        • IF/ELSE Branch
        • Iteration
        • Loop
      • Transform Blocks
        • Variable Assigner
        • Variable Aggregator
        • Parameter Extractor
        • Data Enrichment
        • Prompt Template
        • Code
      • Input & Extraction
        • Doc Extractor
        • Knowledge Retrieval
        • LLM Block
          • LLM Reasoning
          • Fallback to LLM Reasoning
        • Tool Node
        • Agent
        • Answer
    • GLIK Knowledge
      • Creating & Managing Knowledge
      • GLIK Knowledge Retrieval
      • Writing to Knowledge
      • Scoped Memory & Access Control
      • Injection & Variable Binding
      • Performance & Limits
    • Execution Model
      • Workflow Architecture
      • Flow Engine
      • Node Lifecycle
      • Protocol Compatibility & Schema Interoperability
      • Input Binding & Value Resolution
    • Memory & Variable Scope
      • Conversation Variables
      • Memory Layers (User, App, Org)
      • Memory Slot Injection
      • Memory Retention Policy
    • Decision Routing
      • Conditional Logic Engine
      • LLM Fallthrough Patterns
      • Policy Enforcement & Escalation Paths
    • Enterprise Orchestration
      • Policy-Driven Automation
      • Enterprise Modularity
      • Auditability & Governance
      • Explainability & Decision Transparency
    • Agentifying Legacy Systems
      • Why Legacy Systems Resist Change
      • Best Practices for Agentifying ERP Workflows
      • GLIK’s Wrap-Around Model
      • Agent Surfaces (PDF, OCR, API, UI)
      • No-API Memory-Based Control
      • Compliance & Risk Considerations
    • System Observability
      • Execution Logs
      • Save Points & Snapshots
      • Variable Debugging
      • Session Trace Viewer
  • Developers
    • Overview
    • GLIK Open Core
      • Deployment & Installation
      • CLI Reference
      • Security & Compliance
      • Customization Guide
      • Versioning & Updates
  • GLIK Roadmap
  • Deprecation
    • Orchestration Interface
      • Node Orchestration
        • Node
          • Start
          • End
          • Direct Reply
          • LLM
          • Question Classifier
          • Knowledge Retrieval
          • Code Execution
          • Doc Extractor
          • HTTP Request
          • Conditional Branch IF/ELSE
          • Iteration
          • List Operator
          • Parameter Extraction
          • Template
          • Tools
          • Variable Aggregator
          • Variable Assigner
      • Variables
      • Application Toolkits
      • File Upload
    • Chatbot Features
    • Dataset
      • Dataset Creation
      • Text Preprocessing and Cleaning
        • Advanced Configuration
      • Retrieval Test/Citation
    • Studio
  • Brand Kit & Identity
    • Logos & Visual Assets
    • Typography & Colors
    • Messaging Pillars
    • Product Screenshots
    • Diagrams & Icons
    • Company Boilerplate
    • Downloads (.zip)
  • Legal
    • Terms of Service
    • Privacy Policy
    • Cookie Policy
    • Trademark Notice
    • Acceptable Use Policy
    • Open Core License
Powered by GitBook

Platform

  • Open GLIK Cloud
  • Getting Started
  • Templates

Documentation

  • Core Concepts
  • GLIK Open Core
  • Security & Data Handling
  • Workspaces & Permissions

Company

  • RIvalz AI
  • Contact Support
  • Status Page

© 2023–2025 Rivalz Technologies Ltd.

On this page
  • Definition
  • Configuration
  • Scenarios
  • Structured Data Processing
  • Mathematical Calculations
  • Data Concatenation
  • Local Deployment
  • Security Policies
  • FAQ

Was this helpful?

  1. Deprecation
  2. Orchestration Interface
  3. Node Orchestration
  4. Node

Code Execution

Definition

The code node supports running Python/NodeJS code to perform data transformations within a workflow. It can simplify your workflow and is suitable for scenarios such as arithmetic operations, JSON transformations, text processing, and more.

This node significantly enhances the flexibility for developers, allowing them to embed custom Python or JavaScript scripts within the workflow and manipulate variables in ways that preset nodes cannot achieve. Through configuration options, you can specify the required input and output variables and write the corresponding execution code:

Configuration

If you need to use variables from other nodes in the code node, you must define the variable names in the input variables and reference these variables. You can refer to Variable References.

Scenarios

Using the code node, you can perform the following common operations:

Structured Data Processing

In workflows, you often have to deal with unstructured data processing, such as parsing, extracting, and transforming JSON strings. A typical example is data processing from an HTTP node. In common API return structures, data may be nested within multiple layers of JSON objects, and you need to extract certain fields. The code node can help you perform these operations. Here is a simple example that extracts the data.name field from a JSON string returned by an HTTP node:

def main(http_response: str) -> str:
    import json
    data = json.loads(http_response)
    return {
        # Note to declare 'result' in the output variables
        'result': data['data']['name'] 
    }

Mathematical Calculations

When you need to perform complex mathematical calculations in a workflow, you can also use the code node. For example, calculating a complex mathematical formula or performing some statistical analysis on data. Here is a simple example that calculates the variance of an array:

def main(x: list) -> float:
    return {
        # Note to declare 'result' in the output variables
        'result': sum([(i - sum(x) / len(x)) ** 2 for i in x]) / len(x)
    }

Data Concatenation

Sometimes, you may need to concatenate multiple data sources, such as multiple knowledge retrievals, data searches, API calls, etc. The code node can help you integrate these data sources together. Here is a simple example that merges data from two knowledge bases:

def main(knowledge1: list, knowledge2: list) -> list:
    return {
        # Note to declare 'result' in the output variables
        'result': knowledge1 + knowledge2
    }

Local Deployment

docker-compose -f docker-compose.middleware.yaml up -d

Security Policies

Both Python and JavaScript execution environments are strictly isolated (sandboxed) to ensure security. This means that developers cannot use functions that consume large amounts of system resources or may pose security risks, such as direct file system access, making network requests, or executing operating system-level commands. These limitations ensure the safe execution of the code while avoiding excessive consumption of system resources.

FAQ

Why can't I save the code it in the code node?

Please check if the code contains potentially dangerous behaviors. For example:

def main() -> dict:
    return {
        "result": open("/etc/passwd").read(),
    }

This code snippet has the following issues:

  • Unauthorized file access: The code attempts to read the "/etc/passwd" file, which is a critical system file in Unix/Linux systems that stores user account information.

  • Sensitive information disclosure: The "/etc/passwd" file contains important information about system users, such as usernames, user IDs, group IDs, home directory paths, etc. Direct access could lead to information leakage.

Dangerous code will be automatically blocked by Cloudflare WAF. You can check if it's been blocked by looking at the "Network" tab in your browser's "Web Developer Tools".

PreviousKnowledge RetrievalNextDoc Extractor

Last updated 3 months ago

Was this helpful?

If you are a local deployment user, you need to start a sandbox service to ensure that malicious code is not executed. This service requires the use of Docker. You can find specific information about the sandbox service . You can also start the service directly via docker-compose:

here