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: update test assertion and Python alias param for CI

abir97b996474cf1
diff --git a/python/composio/core/models/tool_router_session.py b/python/composio/core/models/tool_router_session.py
index 67671b551..38eff4475 100644
--- a/python/composio/core/models/tool_router_session.py
+++ b/python/composio/core/models/tool_router_session.py
@@ -396,12 +396,14 @@ class ToolRouterSession(t.Generic[TTool, TToolCollection]):
:param alias: Human-readable alias for the connection. Must be unique
per userId and toolkit within the project.
"""
- response = self._client.tool_router.session.link(
- session_id=self.session_id,
- toolkit=toolkit,
- callback_url=callback_url if callback_url else omit,
- alias=alias if alias is not None else omit,
- )
+ link_params: dict = {
+ "session_id": self.session_id,
+ "toolkit": toolkit,
+ "callback_url": callback_url if callback_url else omit,
+ }
+ if alias is not None:
+ link_params["alias"] = alias
+ response = self._client.tool_router.session.link(**link_params) # type: ignore[arg-type]
return ConnectionRequest(
id=response.connected_account_id,
redirect_url=response.redirect_url,
diff --git a/ts/packages/core/test/models/toolRouter.test.ts b/ts/packages/core/test/models/toolRouter.test.ts
index ad40ddb73..51c21f58a 100644
--- a/ts/packages/core/test/models/toolRouter.test.ts
+++ b/ts/packages/core/test/models/toolRouter.test.ts
@@ -1266,7 +1266,7 @@ describe('ToolRouter', () => {
await toolRouter.create(userId, {});
const callArgs = mockClient.toolRouter.session.create.mock.calls[0][0];
- expect(callArgs).not.toHaveProperty('multi_account');
+ expect(callArgs.multi_account).toBeUndefined();
});
it('should create a session with multiAccount combined with other options', async () => {