Example 39c_serverless_code_execution.py needs to be changed for it to work
评估
调研方向
问题位于文件 Example 39c_serverless_code_execution.py 中。修复方法是将行 mock_server = _start_mock_server(port=9753) 移动到 if __name__ == "__main__": 代码块内,以防止模块被重新导入时发生端口冲突。进行更改后,运行脚本以验证其启动时没有 'Address already in use' 错误,并且成功执行代理代码。
由索引模型根据 Issue 内容生成。
描述
currently we have start_mock_server not inside main. Moving it to main works
── Agent setup ───────────────────────────────────────────────────────
mock_server = _start_mock_server(port=9753)
serverless_coder = Agent(
name="serverless_coder",
model=settings.llm_model,
code_execution=CodeExecutionConfig(
executor=ServerlessCodeExecutor(
endpoint="http://127.0.0.1:9753/execute",
language="python",
timeout=15,
),
),
instructions=(
"You write Python code that runs on a remote execution service. "
"Use the execute_code tool to run code remotely."
),
)
if name == "main":
### #mock_server = _start_mock_server(port=9753). -> ADD THIS
with AgentRuntime() as runtime:
print("--- Serverless Code Execution ---")
result = runtime.run(
serverless_coder,
"Calculate 2**100 and print the result.",
)
result.print_result()
This was a claude code suggested fix and it works.
Claude's reasoning:
Before: mock_server = _start_mock_server(9753) was outside. You start the script — port 9753 grabbed. Worker starts, re-imports the file, hits that same line, tries to grab 9753 again. Already taken → Address already in use → worker dies.
After: it's inside the if. You start the script — port grabbed once. Worker re-imports, reaches the if, sees it's false, skips it. No second bind. Worker lives.
- 主要语言
- Python
- 星标
- 104
- 派生
- 44
- 平均合并
- 4 天 18 小时
- 30 天内合并 PR
- 3
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
conductor-oss/python-sdk 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
conductor-oss/python-sdk#507 ·
-
`.[agents]` extra omits `langchain-anthropic`, so a shipped example cannot run可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug dependencies
难度 2/5 1-3 小时 新手友好度 88/100
conductor-oss/python-sdk#486 ·
-
Framework-agent failures return `None` instead of the failed task's reason可能重新可做 关联的 PR 已关闭且未合并。 未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
conductor-oss/python-sdk#483 ·
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
conductor-oss/python-sdk#478 ·
-
TaskType.NOOP missing — NOOP system task has no enum value or builder class可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug
难度 2/5 1-3 小时 新手友好度 88/100
conductor-oss/python-sdk#430 ·
查看 conductor-oss/python-sdk 的全部 Issue
相似的 Issue
-
bug llm translation
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Arkansas 2025 tax is $1.70 high above $100,000 net taxable income ($3,809 + 3.9% rule)可能已有人在做 @PavelMakarchuk 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
PolicyEngine/policyengine-us#9828 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
jellyfin/jellyfin-mpv-shim#800 ·
维护者通常 1 天内回复
-
skillfs: one malformed chat-log line aborts the entire skill-usage analysis (skill_usage_from_chat_logs.py)可能已有人在做 @zjncs 今天认领。 未关闭component:skillfs
难度 2/5 1-3 小时 新手友好度 82/100
agentic-os-org/ANOLISA#6116 · 1 条评论 ·
维护者通常 1 天内回复
-
P4: low query
难度 2/5 1-3 小时 新手友好度 76/100
jeffknupp/association#336 ·