diff --git a/spring-ai-alibaba-graph/spring-ai-alibaba-graph-core/pom.xml b/spring-ai-alibaba-graph/spring-ai-alibaba-graph-core/pom.xml
index 363837b0..c2dffa73 100644
--- a/spring-ai-alibaba-graph/spring-ai-alibaba-graph-core/pom.xml
+++ b/spring-ai-alibaba-graph/spring-ai-alibaba-graph-core/pom.xml
@@ -15,11 +15,14 @@
A library for building stateful, multi-agents applications with LLMs
-
- 17
- 17
- UTF-8
-
+
+ 17
+ 17
+ UTF-8
+ 1.3
+ 1.16.0
+ 4.4
+
@@ -123,6 +126,24 @@
true
+
+ org.apache.commons
+ commons-collections4
+ ${commons-collections4.version}
+
+
+
+ org.apache.commons
+ commons-exec
+ ${commons-exec.version}
+
+
+
+ commons-codec
+ commons-codec
+ ${commons-codec.version}
+
+
diff --git a/spring-ai-alibaba-graph/spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/node/code/CodeExecutor.java b/spring-ai-alibaba-graph/spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/node/code/CodeExecutor.java
new file mode 100644
index 00000000..2833173e
--- /dev/null
+++ b/spring-ai-alibaba-graph/spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/node/code/CodeExecutor.java
@@ -0,0 +1,34 @@
+package com.alibaba.cloud.ai.graph.node.code;
+
+import com.alibaba.cloud.ai.graph.node.code.entity.CodeBlock;
+import com.alibaba.cloud.ai.graph.node.code.entity.CodeExecutionConfig;
+import com.alibaba.cloud.ai.graph.node.code.entity.CodeExecutionResult;
+
+import java.util.List;
+
+/**
+ * @author HeYQ
+ * @since 2024-12-02 17:15
+ */
+
+public interface CodeExecutor {
+
+ /**
+ * Execute code blocks and return the result. This method should be implemented by the
+ * code executor.
+ * @param codeBlockList The code blocks to execute.
+ * @param codeExecutionConfig The configuration of the code execution.
+ * @return CodeExecutionResult The result of the code execution.
+ * @throws Exception ValueError: Errors in user inputs
+ */
+
+ CodeExecutionResult executeCodeBlocks(List codeBlockList, CodeExecutionConfig codeExecutionConfig)
+ throws Exception;
+
+ /**
+ * Restart the code executor. This method should be implemented by the code executor.
+ * This method is called when the agent is reset.
+ */
+ void restart();
+
+}
diff --git a/spring-ai-alibaba-graph/spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/node/code/CodeExecutorNodeAction.java b/spring-ai-alibaba-graph/spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/node/code/CodeExecutorNodeAction.java
new file mode 100644
index 00000000..677dd334
--- /dev/null
+++ b/spring-ai-alibaba-graph/spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/node/code/CodeExecutorNodeAction.java
@@ -0,0 +1,96 @@
+package com.alibaba.cloud.ai.graph.node.code;
+
+import com.alibaba.cloud.ai.graph.action.NodeAction;
+import com.alibaba.cloud.ai.graph.node.AbstractNode;
+import com.alibaba.cloud.ai.graph.node.code.entity.CodeBlock;
+import com.alibaba.cloud.ai.graph.node.code.entity.CodeExecutionConfig;
+import com.alibaba.cloud.ai.graph.node.code.entity.CodeExecutionResult;
+import com.alibaba.cloud.ai.graph.state.NodeState;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author HeYQ
+ * @since 2024-11-28 11:47
+ */
+
+public class CodeExecutorNodeAction extends AbstractNode implements NodeAction {
+
+ private final CodeExecutor codeExecutor;
+
+ private final String codeLanguage;
+
+ private final String code;
+
+ private final CodeExecutionConfig codeExecutionConfig;
+
+ public CodeExecutorNodeAction(CodeExecutor codeExecutor, String codeLanguage, String code,
+ CodeExecutionConfig config) {
+ this.codeExecutor = codeExecutor;
+ this.codeLanguage = codeLanguage;
+ this.code = code;
+ this.codeExecutionConfig = config;
+ }
+
+ @Override
+ public Map apply(NodeState state) throws Exception {
+ List codeBlockList = new ArrayList<>(10);
+ codeBlockList.add(new CodeBlock(codeLanguage, code));
+ CodeExecutionResult codeExecutionResult = codeExecutor.executeCodeBlocks(codeBlockList,
+ this.codeExecutionConfig);
+ if (codeExecutionResult.exitCode() != 0) {
+ throw new RuntimeException("code execution failed, exit code: " + codeExecutionResult.exitCode()
+ + ", logs: " + codeExecutionResult.logs());
+ }
+ return JSONObject.parseObject(codeExecutionResult.logs(), new TypeReference