Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix: make deep copy of pydantic models when caching `Tool` objects

angrybayblade6493616bb5a9
diff --git a/python/composio/core/models/tools.py b/python/composio/core/models/tools.py
index 47cfdbff9..7e1e98e4e 100644
--- a/python/composio/core/models/tools.py
+++ b/python/composio/core/models/tools.py
@@ -154,7 +154,9 @@ class Tools(Resource, t.Generic[TProvider]):
for tool in tools_list
]
- self._tool_schemas.update({tool.slug: tool for tool in tools_list})
+ self._tool_schemas.update(
+ {tool.slug: tool.model_copy(deep=True) for tool in tools_list}
+ )
for tool in tools_list:
tool.input_parameters = self._file_helper.process_schema_recursively(
schema=tool.input_parameters,