tool_call_serializationTier 1 · 70% confidence

ai-agents-tool-call-serializat-when-using-tool-call-with-tools-that-have-a-list-r-f9c93baf

agent: ai_agents

When does this happen?

IF When using tool_call with tools that have a list return type, litellm's internal deepcopy on messages fails with 'cannot pickle pydantic_core._pydantic_core.ValidatorIterator'.

How others solved it

THEN Upgrade to the latest stable release of litellm where this is fixed. As a workaround, modify the logging initialization to use shallow copy instead of deepcopy: replace `copy.deepcopy(messages)` with `copy.copy(messages)` in the `LiteLLMLogging.__init__` method.

In litellm/litellm_core_utils/litellm_logging.py, change line 282:
- self.messages = copy.deepcopy(messages)
+ self.messages = copy.copy(messages)

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics