背景

在Ragflow的工作流中使用代码执行节点时出现以下报错

AttributeError("module 'agent.tools' has no attribute 'CodeExecParam'")
{
  "_ERROR": "Exception executing code: HTTPConnectionPool(host='none', port=9385): Max retries exceeded with url: /run (Caused by NameResolutionError(\"<urllib3.connection.HTTPConnection object at 0x7fd843508160>: Failed to resolve 'none' ([Errno -2] Name or service not known)\"))",
  "_created_time": 9212.44730328,
  "_elapsed_time": 7.343587491999642,
  "result": null
}
{
  "_ERROR": "Exception executing code: HTTPConnectionPool(host='sandbox-executor-manager', port=9385): Read timed out. (read timeout=10)",
  "_created_time": 11175.078221754,
  "_elapsed_time": 10.011153232000652,
  "result": null
}

1.修改.env

将以下代码取消注释

SANDBOX_ENABLED=1
SANDBOX_HOST=sandbox-executor-manager
SANDBOX_EXECUTOR_MANAGER_IMAGE=infiniflow/sandbox-executor-manager:latest
SANDBOX_EXECUTOR_MANAGER_POOL_SIZE=3
SANDBOX_BASE_PYTHON_IMAGE=infiniflow/sandbox-base-python:latest
SANDBOX_BASE_NODEJS_IMAGE=infiniflow/sandbox-base-nodejs:latest
SANDBOX_EXECUTOR_MANAGER_PORT=9385
SANDBOX_ENABLE_SECCOMP=false
SANDBOX_MAX_MEMORY=256m # b, k, m, g
SANDBOX_TIMEOUT=10s # s, m, 1m30s

2.拉取sandbox基础镜像

docker pull infiniflow/sandbox-base-python:latest

docker pull infiniflow/sandbox-base-nodejs:latest

3.使用最新ragflow镜像

镜像名

infiniflow/ragflow:v0.20.3

启动容器

docker-compose -f docker-compose.yml up -d

4.修改sandbox容器内py文件

文件地址

/app/core/container.py

修改点

将以下代码注释掉

"--runtime=runsc",

4.重启容器

docker-compose restart

5.修改host文件

文件地址

Linux

/etc/hosts

Windows

C:\Windows\System32\drivers\etc

添加内容

127.0.0.1 sandbox-executor-manager

刷新DNS

Linux

不需要刷新

Windows
ipconfig /flushdns

结束

以上操作结束即可使用代码执行节点。

Logo

火山引擎开发者社区是火山引擎打造的AI技术生态平台,聚焦Agent与大模型开发,提供豆包系列模型(图像/视频/视觉)、智能分析与会话工具,并配套评测集、动手实验室及行业案例库。社区通过技术沙龙、挑战赛等活动促进开发者成长,新用户可领50万Tokens权益,助力构建智能应用。

更多推荐