fix(examples): tool closures failing to pickle across spawned worker processes - #477
Merged
Merged
Conversation
kowser-orkes
marked this pull request as draft
August 13, 2026 01:21
ling-senpeng13
marked this pull request as ready for review
August 13, 2026 16:18
ling-senpeng13
marked this pull request as draft
August 13, 2026 16:18
mp-orkes
self-requested a review
August 14, 2026 01:25
kowser-orkes
marked this pull request as ready for review
August 14, 2026 01:30
- tool functions closing over local state can't pickle to their own spawned worker process, moved them to module level - background-process registry, missing main guards, and shared temp dirs also broke across worker processes, fixed those too - swapped a deprecated gemini model in the ADK credentials example
kowser-orkes
force-pushed
the
fix/agent-examples-nested-tool-pickling
branch
from
August 14, 2026 01:31
deb0739 to
a896f12
Compare
mp-orkes
approved these changes
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request type
Changes in this PR
Describe the new behavior from this PR, and why it's needed
@toolruns in a separate OS process under the SDK's default spawn multiprocessing method
16k_credentials_google_adk.py,79_agent_message_bus.py,80_live_dashboard.py,81_chat_repl.py,82_coding_agent.py,82b_coding_agent_tui.py— runtime-only values (execution ids, working dir, shell timeout, IPCpaths) now cross via environment variables instead of closures
82b_coding_agent_tui.pyalso shared an in-memory registry acrossfour separate worker processes — replaced with a file-based registry keyed by process id, status
via PID probing
80_live_dashboard.py,81_chat_repl.py,subscription-agent.pyran orchestration asunconditional top-level code, so every spawned worker re-executed it and crashed trying to spawn
its own workers — wrapped in
if __name__ == "__main__":39c_serverless_code_execution.py_start_mock_server(port=9753) ran at module level, so every worker re-bound the port. The example hung indefinitely (>6m40s with no output past its header). Moved inside main. Verified: now completes with 2**100 = 1267650600228229401496703205376, Tool calls: 1, FinishReason.STOP.Alternatives considered
None