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): keep the custom logger on the without_retries client

jkomyno2832c0a0651f
diff --git a/python/composio/client/__init__.py b/python/composio/client/__init__.py
index f72bdb514..b7aa15875 100644
--- a/python/composio/client/__init__.py
+++ b/python/composio/client/__init__.py
@@ -270,6 +270,10 @@ class HttpClient(BaseComposio, WithLogger):
# (False) even when the original had it enabled — keeping the sibling
# a faithful copy that differs from the parent only in `max_retries`.
"_strict_response_validation": self._strict_response_validation,
+ # Share the parent's logger; otherwise constructing the clone
+ # rebinds the process-wide client log forwarder to the default
+ # `composio` logger.
+ "logger": self._logger.logger,
**_extra_kwargs,
},
**kwargs,
diff --git a/python/tests/test_sdk_logging.py b/python/tests/test_sdk_logging.py
index fd1d21bca..265d2e32f 100644
--- a/python/tests/test_sdk_logging.py
+++ b/python/tests/test_sdk_logging.py
@@ -116,6 +116,19 @@ class TestCustomLogger:
assert logging.getLogger(CLIENT_LOGGER_NAME).level == logging.WARNING
assert "path=/api/v3.1/toolkits" not in output.getvalue()
+ def test_without_retries_clone_keeps_custom_logger(self, custom_logger):
+ logger, output = custom_logger
+ composio = Composio(
+ api_key="test-key", http_client=_mock_transport(), logger=logger
+ )
+
+ composio.client.without_retries.toolkits.list()
+
+ forwarders = _forwarders()
+ assert len(forwarders) == 1
+ assert forwarders[0].wrapper.logger is logger
+ assert "path=/api/v3.1/toolkits" in output.getvalue()
+
def test_client_logger_does_not_propagate_to_root(self, custom_logger):
logger, _ = custom_logger
Composio(api_key="test-key", logger=logger)