feat(py): remove legacy custom tools (#3508)

This PR is **part 1 of 3** splitting
https://github.com/ComposioHQ/composio/pull/3505 to make the removal of
the old 2025 custom tools easier to review. It carries the **Python**
slice.

- removes the legacy `composio.tools.custom_tool` registry path:
`core.models.custom_tools`, `ExecuteRequestFn`, the old fallback
execution wiring, the security tests, and the example
- preserves the 2026 tool-router APIs: `composio.experimental.tool()`,
`composio.experimental.Toolkit`, inline custom-tool execution,
preload/attach/use flows, and `session.custom_tools()`
- bumps the Python workspace and all provider packages `0.13.1` →
`0.14.0`

## Notes

- This slice is a byte-identical subset of #3505 — the three split
branches recombine to that PR's exact tree. See #3505 for the original
local verification logs (`uv run --frozen nox -s chk`, targeted pytest);
CI re-runs per PR.
This commit is contained in:
Alberto Schiabel
2026-06-05 10:53:26 +04:00
committed by GitHub
parent b69cef123f
commit 2758287c87
34 changed files with 53 additions and 854 deletions
-53
View File
@@ -715,59 +715,6 @@ class TestToolExecution:
assert call_args.kwargs["user_id"] == "user-123"
assert call_args.kwargs["text"] == "Additional context"
def test_execute_custom_tool(self):
"""Test that execute works with custom tools."""
# Mock client and provider
mock_client = Mock()
mock_provider = Mock()
mock_provider.name = "test_provider"
# Create Tools instance
tools = Tools(
client=mock_client,
provider=mock_provider,
toolkit_versions={"custom": "20251201_01"},
)
# Create a mock custom tool with proper structure
custom_tool_info = self.create_mock_tool("CUSTOM_TOOL", "custom")
custom_tool_info.input_parameters = {"type": "object", "properties": {}}
# Mock the custom tool registry
mock_custom_tool = Mock()
mock_custom_tool.info = custom_tool_info
tools._custom_tools.custom_tools_registry = {"CUSTOM_TOOL": mock_custom_tool}
# Mock the get method to return the tool
def mock_get(slug):
return mock_custom_tool if slug == "CUSTOM_TOOL" else None
tools._custom_tools.get = Mock(side_effect=mock_get)
# Mock the execute method of custom tool
def mock_execute(slug, request, user_id):
return {"custom_result": "success"}
tools._custom_tools.execute = Mock(side_effect=mock_execute)
# Execute the custom tool
result = tools.execute(
slug="CUSTOM_TOOL",
arguments={"param": "value"},
user_id="user-123",
)
# Verify execution succeeded
assert result["successful"] is True
assert result["data"]["custom_result"] == "success"
# Verify custom tool execute was called
tools._custom_tools.execute.assert_called_once_with(
slug="CUSTOM_TOOL",
request={"param": "value"},
user_id="user-123",
)
def test_execute_with_modifiers_before_execute(self):
"""Test that execute applies before_execute modifiers correctly."""
from composio.core.models._modifiers import before_execute