-
Notifications
You must be signed in to change notification settings - Fork 0
fix: enable FunctionTool serialization for Temporal worker nodes #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
chakrris
commented
Aug 19, 2025
- RunAgent*Params objects must be serializable for over-the-wire transmission to Temporal workers/backend. Previous implementation failed when users specified FunctionTool with callable on_invoke_tool params.
- This commit adds cloudpickle-based serialization support to resolve serialization errors
- During testing, also had to pin OpenAI to v1.99.9 to avoid LiteLLM incompatibility issue (#13711)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds cloudpickle-based serialization support for FunctionTool objects to enable Temporal worker node communication. The primary purpose is to resolve serialization errors that occurred when users specified FunctionTool instances with callable on_invoke_tool parameters for over-the-wire transmission to Temporal workers/backend.
Key changes include:
- Refactored FunctionTool class to support automatic serialization/deserialization of callable functions using cloudpickle and base64 encoding
- Added comprehensive test suite covering various callable types (functions, lambdas, closures) and error scenarios
- Pinned OpenAI dependency to version 1.99.9 to resolve LiteLLM compatibility issues
Reviewed Changes
Copilot reviewed 3 out of 6 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/agentex/lib/core/temporal/activities/adk/providers/openai_activities.py |
Core implementation of FunctionTool serialization with cloudpickle support and property-based callable management |
tests/test_function_tool.py |
Comprehensive test suite for FunctionTool serialization covering various callable types and error handling scenarios |
pyproject.toml |
Dependency updates: pinned OpenAI version and added cloudpickle requirement |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/agentex/lib/core/temporal/activities/adk/providers/openai_activities.py
Outdated
Show resolved
Hide resolved
src/agentex/lib/core/temporal/activities/adk/providers/openai_activities.py
Show resolved
Hide resolved
- RunAgent*Params objects must be serializable for over-the-wire transmission to Temporal workers/backend. Previous implementation failed when users specified FunctionTool with callable on_invoke_tool params. - This commit adds cloudpickle-based serialization support to resolve serialization errors - During testing, also had to pin OpenAI to v1.99.9 to avoid LiteLLM incompatibility issue ([#13711](BerriAI/litellm#13711))
f9da219 to
7fcd840
Compare
varunursekar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious - is there a limit on the size of the payload in temporal? i might be misremembering but i think it might be like 4 mb
varunursekar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
I think it's 2 MB: https://dev.agentex.scale.com/docs/concepts/acp/agentic/temporal/?h=size#when-to-use-each-approach |