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: custom tools lookup before execution

angrybaybladee8fc4dd22582
diff --git a/python/composio/core/models/custom_tools.py b/python/composio/core/models/custom_tools.py
index bfdad0de3..1a10edeb6 100644
--- a/python/composio/core/models/custom_tools.py
+++ b/python/composio/core/models/custom_tools.py
@@ -163,7 +163,7 @@ class CustomTools:
return None
@t.overload
- def register(self, f: t.Optional[CustomToolProtocol] = None) -> t.Callable: ...
+ def register(self, f: CustomToolProtocol) -> CustomTool: ...
@t.overload
def register(
diff --git a/python/composio/core/models/tools.py b/python/composio/core/models/tools.py
index 7e1e98e4e..93a46e210 100644
--- a/python/composio/core/models/tools.py
+++ b/python/composio/core/models/tools.py
@@ -354,6 +354,10 @@ class Tools(Resource, t.Generic[TProvider]):
:return: The response from the tool.
"""
tool = self._tool_schemas.get(slug)
+ if tool is None:
+ tool = self._custom_tools[slug].info
+ self._tool_schemas[slug] = tool
+
if tool is None:
tool = t.cast(Tool, self._client.tools.retrieve(tool_slug=slug))
self._tool_schemas[slug] = tool