Code Execution Node

执行自定义函数代码的节点。

配置字段

字段类型说明
runtimestring运行时
codestring代码
entryPointstring入口函数
dependenciesList<string>依赖列表
timeoutInteger超时时间(毫秒)
memoryInteger内存限制(MB)

示例

- id: calc_score
  name: 计算评分
  type: CODE_EXECUTION
  config:
    _nodeConfigType: CODE_EXECUTION
    runtime: python3.11
    entryPoint: main
    code: |
      def main(ctx):
          return {"score": ctx["amount"] * 0.1}
    timeout: 30000
    memory: 256