conductor-oss / conductor-oss/conductor

Example 39c_serverless_code_execution.py needs to be changed for it to work

Open Beginner friendly
#1,509 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
32.2k
Forks
1k
Avg merge
2d 5h
Merged PRs (30d)
41

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open 39c_serverless_code_execution.py and start by running the example to reproduce the address-in-use failure. Review the mock server setup and the main entry point; done means the example starts the server once and completes remote execution without the worker failing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.