Skip to content

Conversation

@chakrris
Copy link
Contributor

  • 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)

@chakrris chakrris requested a review from Copilot August 19, 2025 14:56
Copy link

Copilot AI left a 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.

- 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))
@chakrris chakrris force-pushed the chakrris/oai-function-tool-2 branch from f9da219 to 7fcd840 Compare August 19, 2025 15:03
Copy link

@varunursekar varunursekar left a 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

Copy link

@varunursekar varunursekar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@chakrris
Copy link
Contributor Author

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

I think it's 2 MB: https://dev.agentex.scale.com/docs/concepts/acp/agentic/temporal/?h=size#when-to-use-each-approach

@chakrris chakrris merged commit 3a72043 into main Aug 19, 2025
7 of 8 checks passed
@chakrris chakrris deleted the chakrris/oai-function-tool-2 branch August 19, 2025 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants