Example 39c_serverless_code_execution.py needs to be changed for it to work
維護者通常 1 天內回覆
評估
研究方向
問題位於檔案 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
- 分支
- 46
- 平均合併
- 8 天 16 小時
- 30 天內合併 PR
- 3
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
conductor-oss/python-sdk 的其他 Issue
-
Async SSE client reuses httpx.AsyncClient across event loops -> "Event loop is closed"可能已有人在做 @abhinavrastogi2627 於 20 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 78/100
conductor-oss/python-sdk#507 ·
維護者通常 1 天內回覆
-
`.[agents]` extra omits `langchain-anthropic`, so a shipped example cannot run可能已有人在做 @abhinavrastogi2627 於 21 天前認領。 未關閉bug dependencies
難度 2/5 1-3 小時 新手友好度 88/100
conductor-oss/python-sdk#486 ·
維護者通常 1 天內回覆
-
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 ·
維護者通常 1 天內回覆
-
Runtime does not start workers for tools declared on a `planner=` agent可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉bug
難度 2/5 1-3 小時 新手友好度 82/100
conductor-oss/python-sdk#478 ·
維護者通常 1 天內回覆
-
TaskType.NOOP missing — NOOP system task has no enum value or builder class可能已有人在做 @abhinavrastogi2627 於 21 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 88/100
conductor-oss/python-sdk#430 ·
維護者通常 1 天內回覆
查看 conductor-oss/python-sdk 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
nansencenter/geodataset#39 ·
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
awslabs/visual-asset-management-system#804 ·
維護者通常 1 天內回覆
-
follow-up
難度 2/5 1-3 小時 新手友好度 65/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
link-rot
難度 1/5 1 小時以內 新手友好度 67/100