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(py): apply skip_default to agentic provider signatures (langchain, langgraph, autogen) (#3730)

Alberto Schiabel2e42d75259c6
diff --git a/.github/workflows/py.test.yml b/.github/workflows/py.test.yml
index f0de28a8f..d7d85f38d 100644
--- a/.github/workflows/py.test.yml
+++ b/.github/workflows/py.test.yml
@@ -75,6 +75,7 @@ jobs:
source .venv/bin/activate
uv pip install -e .
uv pip install -e providers/langchain
+ uv pip install -e providers/autogen
uv pip install pytest pytest-mock
- name: Run Import Tests
@@ -82,6 +83,10 @@ jobs:
cd python/
source .venv/bin/activate
python -c "from composio import Composio; print('✓ Basic import successful')"
+ # Guards against the autogen provider becoming un-importable on a fresh
+ # install (e.g. a broken framework dependency). A hard import here fails
+ # loudly, unlike the importorskip-guarded unit tests, which would skip.
+ python -c "import composio_autogen; print('✓ Autogen provider import successful')"
- name: Run Unit Tests
run: |
diff --git a/python/noxfile.py b/python/noxfile.py
index 7a68c7d32..6ec9970d4 100644
--- a/python/noxfile.py
+++ b/python/noxfile.py
@@ -78,6 +78,7 @@ def tst(session: Session):
"""Run the Python unit test suite."""
session.install(".", "--group", "dev")
session.install("./providers/langchain")
+ session.install("./providers/autogen")
test_paths = session.posargs or ["tests/"]
session.run("pytest", *test_paths, "-v", "--tb=short")
diff --git a/python/providers/autogen/composio_autogen/provider.py b/python/providers/autogen/composio_autogen/provider.py
index f62618288..4c763d735 100644
--- a/python/providers/autogen/composio_autogen/provider.py
+++ b/python/providers/autogen/composio_autogen/provider.py
@@ -95,6 +95,7 @@ class AutogenProvider(
# Set signature and annotations
params = get_signature_format_from_schema_params(
schema_params=schema_params,
+ skip_default=self.skip_default,
)
function.__doc__ = tool.description
setattr(function, "__signature__", Signature(parameters=params))
diff --git a/python/providers/langchain/composio_langchain/provider.py b/python/providers/langchain/composio_langchain/provider.py
index 0a3d36f25..03689594b 100644
--- a/python/providers/langchain/composio_langchain/provider.py
+++ b/python/providers/langchain/composio_langchain/provider.py
@@ -63,7 +63,8 @@ class LangchainProvider(
)
action_func.__signature__ = Signature( # type: ignore
parameters=get_signature_format_from_schema_params(
- schema_params=schema_params
+ schema_params=schema_params,
+ skip_default=self.skip_default,
)
)
action_func.__doc__ = tool.description
diff --git a/python/providers/langgraph/composio_langgraph/provider.py b/python/providers/langgraph/composio_langgraph/provider.py
index 8eb14e883..72e573a60 100644
--- a/python/providers/langgraph/composio_langgraph/provider.py
+++ b/python/providers/langgraph/composio_langgraph/provider.py
@@ -59,7 +59,8 @@ class LanggraphProvider(
)
action_func.__signature__ = Signature( # type: ignore
parameters=get_signature_format_from_schema_params(
- schema_params=schema_params
+ schema_params=schema_params,
+ skip_default=self.skip_default,
)
)
action_func.__doc__ = description
diff --git a/python/tests/test_provider.py b/python/tests/test_provider.py
index 6a5e5bcd6..7f2c81659 100644
--- a/python/tests/test_provider.py
+++ b/python/tests/test_provider.py
@@ -1107,3 +1107,101 @@ class TestProviderIntegration:
assert result2["successful"] is True
assert result2["data"]["starred"] is True
+
+
+class TestAgenticSkipDefaultsParity:
+ """Regression: agentic providers must honor skip_defaults in __signature__.
+
+ The langchain and langgraph providers strip schema defaults from
+ args_schema when schema_config={"skip_defaults": True}, but kept the
+ defaults in the function __signature__, so the signature and args_schema
+ disagreed about which optional params were required. They now pass the
+ same skip_default to both, matching the sibling llamaindex provider.
+
+ autogen only builds __signature__ (no args_schema), so it never had the
+ mismatch, but its signature likewise ignored skip_defaults; it is aligned
+ too and checked on the signature alone.
+
+ Provider packages are optional (the unit-test job installs langchain and
+ autogen), so each case skips via importorskip when its provider is absent.
+ """
+
+ def _make_tool_with_default(self):
+ return Tool(
+ name="Test Tool",
+ slug="TEST_TOOL",
+ description="A tool with a defaulted optional param",
+ input_parameters={
+ "type": "object",
+ "title": "TestToolRequest",
+ "properties": {
+ "limit": {
+ "type": "integer",
+ "description": "Max results",
+ "default": 5,
+ },
+ },
+ "required": [],
+ },
+ output_parameters={},
+ available_versions=["12012025_00"],
+ version="12012025_00",
+ scopes=[],
+ toolkit=tool_list_response.ItemToolkit(name="Test", slug="test", logo=""),
+ deprecated=tool_list_response.ItemDeprecated(
+ available_versions=["12012025_00"],
+ displayName="Test Tool",
+ version="12012025_00",
+ toolkit=tool_list_response.ItemDeprecatedToolkit(logo=""),
+ is_deprecated=False,
+ ),
+ is_deprecated=False,
+ no_auth=False,
+ tags=[],
+ )
+
+ def _provider(self, name, schema_config=None):
+ module = pytest.importorskip(f"composio_{name}")
+ provider_cls = getattr(module, f"{name.capitalize()}Provider")
+ return (
+ provider_cls(schema_config=schema_config)
+ if schema_config
+ else provider_cls()
+ )
+
+ @pytest.mark.parametrize("name", ["langchain", "langgraph"])
+ def test_skip_defaults_signature_matches_args_schema(self, name):
+ from inspect import Parameter
+
+ provider = self._provider(name, {"skip_defaults": True})
+ wrapped = provider.wrap_tool(self._make_tool_with_default(), Mock())
+
+ limit = wrapped.func.__signature__.parameters["limit"]
+ assert limit.default is Parameter.empty
+ assert wrapped.args_schema.model_fields["limit"].is_required()
+
+ @pytest.mark.parametrize("name", ["langchain", "langgraph"])
+ def test_default_preserved_without_skip_defaults(self, name):
+ provider = self._provider(name)
+ wrapped = provider.wrap_tool(self._make_tool_with_default(), Mock())
+
+ limit = wrapped.func.__signature__.parameters["limit"]
+ assert limit.default == 5
+ assert not wrapped.args_schema.model_fields["limit"].is_required()
+
+ def test_autogen_signature_honors_skip_defaults(self):
+ from inspect import Parameter
+
+ provider = self._provider("autogen", {"skip_defaults": True})
+ wrapped = provider.wrap_tool(self._make_tool_with_default(), Mock())
+
+ # autogen exposes the wrapped function as `_func` and has no args_schema.
+ limit = wrapped._func.__signature__.parameters["limit"]
+ assert limit.default is Parameter.empty
+
+ def test_autogen_signature_preserves_default(self):
+ provider = self._provider("autogen")
+ wrapped = provider.wrap_tool(self._make_tool_with_default(), Mock())
+
+ limit = wrapped._func.__signature__.parameters["limit"]
+ assert limit.default == 5