Summary
Several framework example files fail immediately with SpawnSafetyError because they define their tool callables inside main() (local/nested functions). The SDK's spawn-safety probe requires tools to be importable by qualified name, and its own error message states the fix. This is an examples defect — the tools should be defined at module level.
Environment
conductor-oss/python-sdk @ main (also repros on the released conductor-agent-sdk)
- conductor-oss server
3.32.0-rc.10, model anthropic/claude-sonnet-4-6, macOS
Repro
cd examples/agents
export CONDUCTOR_SERVER_URL=http://localhost:8080/api \
AGENTSPAN_SERVER_URL=http://localhost:8080/api \
AGENTSPAN_LLM_MODEL=anthropic/claude-sonnet-4-6 \
PYTHONPATH=$PWD
python3 adk/14_callbacks.py
Actual
AttributeError: Can't get local object 'main.<locals>.lookup_customer'
...
conductor.ai.agents.runtime._worker_entries.SpawnSafetyError: worker 'lookup_customer'
is not spawn-safe (AttributeError("Can't get local object 'main.<locals>.lookup_customer'")).
Define the callable at module level (importable by qualified name).
Cause
The tool functions are declared inside main(), so they can't be pickled/imported by worker processes → the SDK's probe_spawn_safety (intentionally) rejects them. The SDK behavior is correct and even prints the remedy: "Define the callable at module level." Passing examples already define tools at module scope.
Affected files (17)
adk/14_callbacks.py
adk/15_global_instruction.py
adk/16_customer_service.py
adk/17_financial_advisor.py
adk/18_order_processing.py
adk/19_supply_chain.py
adk/20_blog_writer.py
langgraph/03_memory.py
langgraph/13_multi_turn.py
langgraph/27_persistent_memory.py
openai/02_function_tools.py
openai/04_handoffs.py
openai/05_guardrails.py
openai/07_streaming.py
openai/08_agent_as_tool.py
openai/09_dynamic_instructions.py
openai/10_multi_model.py
Suggested fix
Move each example's @tool/tool functions from inside main() to module level so they're importable by qualified name (matching the pattern used by the examples that run successfully).
Summary
Several framework example files fail immediately with
SpawnSafetyErrorbecause they define their tool callables insidemain()(local/nested functions). The SDK's spawn-safety probe requires tools to be importable by qualified name, and its own error message states the fix. This is an examples defect — the tools should be defined at module level.Environment
conductor-oss/python-sdk@main(also repros on the releasedconductor-agent-sdk)3.32.0-rc.10, modelanthropic/claude-sonnet-4-6, macOSRepro
Actual
Cause
The tool functions are declared inside
main(), so they can't be pickled/imported by worker processes → the SDK'sprobe_spawn_safety(intentionally) rejects them. The SDK behavior is correct and even prints the remedy: "Define the callable at module level." Passing examples already define tools at module scope.Affected files (17)
Suggested fix
Move each example's
@tool/tool functions from insidemain()to module level so they're importable by qualified name (matching the pattern used by the examples that run successfully).