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.

feat(connected-accounts-py): namespace SHARED-connection surface under experimental

venkat82706b01ce75b3
diff --git a/python/composio/core/models/connected_accounts.py b/python/composio/core/models/connected_accounts.py
index e76158522..69572ecb3 100644
--- a/python/composio/core/models/connected_accounts.py
+++ b/python/composio/core/models/connected_accounts.py
@@ -7,10 +7,10 @@ import typing as t
import warnings
import typing_extensions as te
+from composio_client import BadRequestError, omit
from composio import exceptions
from composio.client import HttpClient
-from composio_client import BadRequestError, omit
from composio.client.types import (
connected_account_create_params,
connected_account_patch_params,
@@ -559,8 +559,7 @@ class ConnectedAccounts:
callback_url: t.Optional[str] = None,
alias: t.Optional[str] = None,
allow_multiple: bool = False,
- account_type: t.Optional[t.Literal["PRIVATE", "SHARED"]] = None,
- acl_config_for_shared: t.Optional[link_create_params.ACLConfigForShared] = None,
+ experimental: t.Optional[link_create_params.Experimental] = None,
) -> ConnectionRequest:
"""
Create a Composio Connect Link for a user to connect their account to a given auth config.
@@ -577,17 +576,10 @@ class ConnectedAccounts:
``ComposioMultipleConnectedAccountsError`` if the user already has an
``ACTIVE`` connection on this auth config. Pair with ``alias`` and a
session-level ``multi_account`` config to disambiguate at execution time.
- :param account_type: Sharing model for the new connection. ``PRIVATE``
- (default) is usable only by the owning ``user_id``. ``SHARED`` can
- be used by other ``user_id``s — but only when the connection is
- explicitly pinned in a tool-router session's config and only when
- the requesting ``user_id`` passes the connection's ACL.
- :param acl_config_for_shared: Per-user ACL for SHARED connections.
- Only valid when ``account_type == 'SHARED'``; raises
- ``ComposioAclOnlyForSharedError`` on a PRIVATE connection. Pass
- an ``ACLConfigForShared`` dict with any combination of
- ``allow_all_users``, ``allowed_user_ids``, ``not_allowed_user_ids``.
- Omit to keep deny-by-default (only the creator can use).
+ :param experimental: Experimental options for this connection. Pass an
+ ``Experimental`` dict with ``account_type`` and/or
+ ``acl_config_for_shared`` to create a SHARED connection with a
+ per-user ACL. Experimental — shape may change in future releases.
:return: Connection request object.
Example:
@@ -612,14 +604,16 @@ class ConnectedAccounts:
# Wait for the connection to be established
connected_account = composio.connected_accounts.wait_for_connection(connection_request.id)
- Example creating a SHARED connection with an ACL:
+ Example creating a SHARED connection with an ACL (experimental):
connection_request = composio.connected_accounts.link(
'user_creator',
'auth_config_123',
- account_type='SHARED',
- acl_config_for_shared={
- 'allow_all_users': True,
- 'not_allowed_user_ids': ['user_bob'],
+ experimental={
+ 'account_type': 'SHARED',
+ 'acl_config_for_shared': {
+ 'allow_all_users': True,
+ 'not_allowed_user_ids': ['user_bob'],
+ },
},
)
"""
@@ -646,10 +640,7 @@ class ConnectedAccounts:
user_id=user_id,
callback_url=callback_url if callback_url is not None else omit,
alias=alias if alias is not None else omit,
- account_type=account_type if account_type is not None else omit,
- acl_config_for_shared=(
- acl_config_for_shared if acl_config_for_shared is not None else omit
- ),
+ experimental=experimental if experimental is not None else omit,
)
except BadRequestError as error:
# The server rejects ACL on PRIVATE connections — surface that
@@ -667,70 +658,6 @@ class ConnectedAccounts:
client=self._client,
)
- def update_acl(
- self,
- nanoid: str,
- *,
- allow_all_users: t.Optional[bool] = None,
- allowed_user_ids: t.Optional[t.List[str]] = None,
- not_allowed_user_ids: t.Optional[t.List[str]] = None,
- ) -> connected_account_patch_response.ConnectedAccountPatchResponse:
- """
- Update the per-user ACL on a SHARED connected account.
-
- Only valid on SHARED connections; raises
- ``ComposioAclOnlyForSharedError`` on a PRIVATE connection. Omit a
- parameter to leave it unchanged; pass an empty list to clear an
- allow/deny list. At least one parameter must be provided.
-
- :param nanoid: The connected account ID (``ca_xxx``).
- :param allow_all_users: When True, any ``user_id`` may use this
- SHARED connection (subject to the deny list).
- :param allowed_user_ids: Explicit list of allowed ``user_id`` strings.
- Pass ``[]`` to clear.
- :param not_allowed_user_ids: Explicit deny list (wins over allow on
- conflict). Pass ``[]`` to clear — note that clearing the deny
- list silently re-grants access to previously-blocked users.
- :return: Response with ``id``, ``status``, and ``success``.
-
- Example:
- composio.connected_accounts.update_acl(
- 'ca_abc',
- allow_all_users=True,
- not_allowed_user_ids=['user_bob'],
- )
- """
- if (
- allow_all_users is None
- and allowed_user_ids is None
- and not_allowed_user_ids is None
- ):
- raise exceptions.ValidationError(
- "update_acl requires at least one of allow_all_users, "
- "allowed_user_ids, or not_allowed_user_ids"
- )
-
- acl: t.Dict[str, t.Any] = {}
- if allow_all_users is not None:
- acl["allow_all_users"] = allow_all_users
- if allowed_user_ids is not None:
- acl["allowed_user_ids"] = allowed_user_ids
- if not_allowed_user_ids is not None:
- acl["not_allowed_user_ids"] = not_allowed_user_ids
-
- try:
- return self._client.connected_accounts.patch(
- nanoid,
- acl_config_for_shared=t.cast(
- connected_account_patch_params.ACLConfigForShared, acl
- ),
- )
- except BadRequestError as error:
- message = str(error)
- if "acl_config_for_shared is only valid on SHARED" in message:
- raise exceptions.ComposioAclOnlyForSharedError(message) from error
- raise
-
def wait_for_connection(
self,
id: str,
diff --git a/python/composio/core/models/custom_tool.py b/python/composio/core/models/custom_tool.py
index 86ede61ae..0a7bf7e75 100644
--- a/python/composio/core/models/custom_tool.py
+++ b/python/composio/core/models/custom_tool.py
@@ -486,12 +486,90 @@ class ExperimentalToolkit:
class ExperimentalAPI:
"""Experimental APIs accessed via ``composio.experimental``.
- Provides decorators for creating custom tools and toolkits
- that run in-process alongside remote Composio tools.
+ Provides decorators for creating custom tools and toolkits that run
+ in-process alongside remote Composio tools, plus experimental SDK
+ methods whose shape may change in future releases.
"""
Toolkit = ExperimentalToolkit
+ def __init__(self, client: t.Optional[t.Any] = None) -> None:
+ self._client = client
+
+ def update_acl(
+ self,
+ nanoid: str,
+ *,
+ allow_all_users: t.Optional[bool] = None,
+ allowed_user_ids: t.Optional[t.List[str]] = None,
+ not_allowed_user_ids: t.Optional[t.List[str]] = None,
+ ) -> t.Any:
+ """
+ Update the per-user ACL on a SHARED connected account. Experimental —
+ shape may change in future releases.
+
+ Only valid on SHARED connections; raises
+ ``ComposioAclOnlyForSharedError`` on a PRIVATE connection. Omit a
+ parameter to leave it unchanged; pass an empty list to clear an
+ allow/deny list. At least one parameter must be provided.
+
+ :param nanoid: The connected account ID (``ca_xxx``).
+ :param allow_all_users: When True, any ``user_id`` may use this
+ SHARED connection (subject to the deny list).
+ :param allowed_user_ids: Explicit list of allowed ``user_id`` strings.
+ Pass ``[]`` to clear.
+ :param not_allowed_user_ids: Explicit deny list (wins over allow on
+ conflict). Pass ``[]`` to clear — note that clearing the deny
+ list silently re-grants access to previously-blocked users.
+ :return: Response with ``id``, ``status``, and ``success``.
+
+ Example:
+ composio.experimental.update_acl(
+ 'ca_abc',
+ allow_all_users=True,
+ not_allowed_user_ids=['user_bob'],
+ )
+ """
+ from composio_client import BadRequestError, omit
+
+ from composio import exceptions
+
+ if self._client is None:
+ raise exceptions.ValidationError(
+ "update_acl requires a Composio client. Access it via "
+ "composio.experimental.update_acl(...)."
+ )
+ if (
+ allow_all_users is None
+ and allowed_user_ids is None
+ and not_allowed_user_ids is None
+ ):
+ raise exceptions.ValidationError(
+ "update_acl requires at least one of allow_all_users, "
+ "allowed_user_ids, or not_allowed_user_ids"
+ )
+
+ acl: t.Dict[str, t.Any] = {}
+ if allow_all_users is not None:
+ acl["allow_all_users"] = allow_all_users
+ if allowed_user_ids is not None:
+ acl["allowed_user_ids"] = allowed_user_ids
+ if not_allowed_user_ids is not None:
+ acl["not_allowed_user_ids"] = not_allowed_user_ids
+
+ try:
+ return self._client.connected_accounts.patch(
+ nanoid,
+ experimental={"acl_config_for_shared": acl},
+ alias=omit,
+ connection=omit,
+ )
+ except BadRequestError as error:
+ message = str(error)
+ if "acl_config_for_shared is only valid on SHARED" in message:
+ raise exceptions.ComposioAclOnlyForSharedError(message) from error
+ raise
+
@t.overload
def tool(self, fn: t.Callable[..., t.Any], /) -> CustomTool: ...
diff --git a/python/composio/core/models/tool_router_session.py b/python/composio/core/models/tool_router_session.py
index 223524b41..19470043a 100644
--- a/python/composio/core/models/tool_router_session.py
+++ b/python/composio/core/models/tool_router_session.py
@@ -14,13 +14,12 @@ from dataclasses import dataclass
from composio_client import BadRequestError, Omit, omit
from composio_client._types import SequenceNotStr
-from composio_client.types.tool_router import session_link_params, session_patch_params
-from composio.client.types import Tool
from composio_client.types.tool_list_response import (
ItemDeprecated,
ItemDeprecatedToolkit,
ItemToolkit,
)
+from composio_client.types.tool_router import session_link_params, session_patch_params
from composio_client.types.tool_router.session_execute_response import (
SessionExecuteResponse,
)
@@ -33,6 +32,8 @@ from composio_client.types.tool_router.session_search_response import (
from composio import exceptions
from composio.client import HttpClient
+from composio.client.types import Tool
+from composio.core.models._modifiers import Modifiers, apply_modifier_by_type
from composio.core.models.connected_accounts import ConnectionRequest
from composio.core.models.custom_tool import find_custom_tool_map_entry_by_final_slug
from composio.core.models.custom_tool_execution import (
@@ -50,7 +51,6 @@ from composio.core.models.inline_custom_tools_payload import (
inline_custom_tools_execute_experimental,
inline_custom_tools_search_experimental,
)
-from composio.core.models._modifiers import Modifiers, apply_modifier_by_type
from composio.core.models.session_context import SessionContextImpl, proxy_execute_impl
from composio.core.models.tools import ToolExecuteParams, ToolExecutionResponse
from composio.core.provider import TTool, TToolCollection
@@ -58,8 +58,8 @@ from composio.core.provider.base import BaseProvider
if t.TYPE_CHECKING:
from composio.core.models.tool_router import (
- ToolRouterSessionExperimental,
ToolkitConnectionsDetails,
+ ToolRouterSessionExperimental,
)
COMPOSIO_MULTI_EXECUTE_TOOL = "COMPOSIO_MULTI_EXECUTE_TOOL"
@@ -539,10 +539,7 @@ class ToolRouterSession(t.Generic[TTool, TToolCollection]):
*,
callback_url: t.Optional[str] = None,
alias: t.Optional[str] = None,
- account_type: t.Optional[t.Literal["PRIVATE", "SHARED"]] = None,
- acl_config_for_shared: t.Optional[
- session_link_params.ACLConfigForShared
- ] = None,
+ experimental: t.Optional[session_link_params.Experimental] = None,
) -> ConnectionRequest:
"""
Authorize a toolkit for the user and get a connection request.
@@ -551,13 +548,10 @@ class ToolRouterSession(t.Generic[TTool, TToolCollection]):
:param alias: Human-readable alias for the connection. Must be unique
per userId and toolkit within the project.
- :param account_type: Sharing model for the new connection. ``PRIVATE``
- (default) is usable only by the owning ``user_id``. ``SHARED`` can
- be used by other ``user_id``s when the connection is pinned in a
- tool-router session and the requesting user passes its ACL.
- :param acl_config_for_shared: Per-user ACL for SHARED connections.
- Only valid when ``account_type == 'SHARED'``; raises
- ``ComposioAclOnlyForSharedError`` on a PRIVATE connection.
+ :param experimental: Experimental options for this connection. Pass an
+ ``Experimental`` dict with ``account_type`` and/or
+ ``acl_config_for_shared`` to create a SHARED connection with a
+ per-user ACL. Experimental — shape may change in future releases.
"""
try:
response = self._client.tool_router.session.link(
@@ -565,10 +559,7 @@ class ToolRouterSession(t.Generic[TTool, TToolCollection]):
toolkit=toolkit,
callback_url=callback_url if callback_url else omit,
alias=alias if alias is not None else omit,
- account_type=account_type if account_type is not None else omit,
- acl_config_for_shared=(
- acl_config_for_shared if acl_config_for_shared is not None else omit
- ),
+ experimental=experimental if experimental is not None else omit,
)
except BadRequestError as error:
# The server rejects ACL on PRIVATE connections — surface that
@@ -598,11 +589,11 @@ class ToolRouterSession(t.Generic[TTool, TToolCollection]):
Get toolkit connection states for the session.
"""
from composio.core.models.tool_router import (
+ ToolkitConnectedAccount,
ToolkitConnection,
ToolkitConnectionAuthConfig,
- ToolkitConnectionState,
- ToolkitConnectedAccount,
ToolkitConnectionsDetails,
+ ToolkitConnectionState,
)
toolkits_params: t.Dict[str, t.Any] = {}
diff --git a/python/composio/sdk.py b/python/composio/sdk.py
index 7e718600c..882de093e 100644
--- a/python/composio/sdk.py
+++ b/python/composio/sdk.py
@@ -179,10 +179,11 @@ class Composio(t.Generic[TTool, TToolCollection], WithLogger):
self.connected_accounts = ConnectedAccounts(client=self._client)
self.mcp = MCP(client=self._client)
- # experimental API — decorators for custom tools and toolkits
+ # experimental API — decorators for custom tools and toolkits,
+ # plus experimental SDK methods (e.g. update_acl)
from composio.core.models.custom_tool import ExperimentalAPI
- self.experimental = ExperimentalAPI()
+ self.experimental = ExperimentalAPI(client=self._client)
# initialize tool router methods
self.tool_router = ToolRouter(
diff --git a/python/pyproject.toml b/python/pyproject.toml
index 0f5f32347..58ea07e96 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -7,7 +7,7 @@ requires-python = ">=3.10,<4"
dependencies = [
"pysher>=1.0.8",
"pydantic>=2.6.4",
- "composio-client==1.38.0",
+ "composio-client==1.39.0",
"typing-extensions>=4.0.0",
"openai",
"json-schema-to-pydantic>=0.4.8",
diff --git a/python/tests/test_connected_accounts.py b/python/tests/test_connected_accounts.py
index 4e789e66d..86a3a429b 100644
--- a/python/tests/test_connected_accounts.py
+++ b/python/tests/test_connected_accounts.py
@@ -543,8 +543,8 @@ def _make_bad_request_error(message: str):
class TestConnectedAccountsAcl:
- """Tests for ``account_type`` + per-user ACL surfacing on ``link()``
- and ``update_acl()``."""
+ """Tests for SHARED accounts surface on ``link()`` and
+ ``composio.experimental.update_acl()``."""
@pytest.fixture
def mock_client(self):
@@ -573,68 +573,63 @@ class TestConnectedAccountsAcl:
def connected_accounts(self, mock_client):
return ConnectedAccounts(client=mock_client)
- # -- link() with accountType + ACL forwarding ---------------------------
+ @pytest.fixture
+ def experimental(self, mock_client):
+ from composio.core.models.custom_tool import ExperimentalAPI
- def test_link_forwards_account_type_and_nested_acl(
- self, connected_accounts, mock_client
- ):
- connected_accounts.link(
- user_id="user_creator",
- auth_config_id="auth_config_123",
- account_type="SHARED",
- acl_config_for_shared={
- "allow_all_users": True,
- "not_allowed_user_ids": ["user_bob"],
- },
- )
+ return ExperimentalAPI(client=mock_client)
- call_kwargs = mock_client.link.create.call_args.kwargs
- assert call_kwargs["account_type"] == "SHARED"
- assert call_kwargs["acl_config_for_shared"] == {
- "allow_all_users": True,
- "not_allowed_user_ids": ["user_bob"],
- }
+ # -- link() forwards the experimental block -----------------------------
- def test_link_omits_acl_when_not_provided(self, connected_accounts, mock_client):
+ def test_link_forwards_experimental_block(self, connected_accounts, mock_client):
connected_accounts.link(
user_id="user_creator",
auth_config_id="auth_config_123",
- account_type="SHARED",
+ experimental={
+ "account_type": "SHARED",
+ "acl_config_for_shared": {
+ "allow_all_users": True,
+ "not_allowed_user_ids": ["user_bob"],
+ },
+ },
)
call_kwargs = mock_client.link.create.call_args.kwargs
- assert call_kwargs["account_type"] == "SHARED"
- assert call_kwargs["acl_config_for_shared"] is omit
+ assert call_kwargs["experimental"] == {
+ "account_type": "SHARED",
+ "acl_config_for_shared": {
+ "allow_all_users": True,
+ "not_allowed_user_ids": ["user_bob"],
+ },
+ }
- def test_link_forwards_only_provided_acl_fields(
+ def test_link_omits_experimental_when_not_provided(
self, connected_accounts, mock_client
):
connected_accounts.link(
user_id="user_creator",
auth_config_id="auth_config_123",
- account_type="SHARED",
- acl_config_for_shared={"allowed_user_ids": ["user_alice"]},
)
call_kwargs = mock_client.link.create.call_args.kwargs
- assert call_kwargs["acl_config_for_shared"] == {
- "allowed_user_ids": ["user_alice"]
- }
+ assert call_kwargs["experimental"] is omit
def test_link_preserves_explicit_empty_lists(self, connected_accounts, mock_client):
"""An empty list is meaningful (clear the allow/deny list)."""
connected_accounts.link(
user_id="user_creator",
auth_config_id="auth_config_123",
- account_type="SHARED",
- acl_config_for_shared={
- "allowed_user_ids": [],
- "not_allowed_user_ids": [],
+ experimental={
+ "account_type": "SHARED",
+ "acl_config_for_shared": {
+ "allowed_user_ids": [],
+ "not_allowed_user_ids": [],
+ },
},
)
call_kwargs = mock_client.link.create.call_args.kwargs
- assert call_kwargs["acl_config_for_shared"] == {
+ assert call_kwargs["experimental"]["acl_config_for_shared"] == {
"allowed_user_ids": [],
"not_allowed_user_ids": [],
}
@@ -650,8 +645,10 @@ class TestConnectedAccountsAcl:
connected_accounts.link(
user_id="user_creator",
auth_config_id="auth_config_123",
- account_type="PRIVATE",
- acl_config_for_shared={"allow_all_users": True},
+ experimental={
+ "account_type": "PRIVATE",
+ "acl_config_for_shared": {"allow_all_users": True},
+ },
)
def test_link_rethrows_non_acl_bad_request_errors(
@@ -667,16 +664,16 @@ class TestConnectedAccountsAcl:
user_id="user_creator", auth_config_id="auth_config_123"
)
- # -- update_acl() body construction + mapper ----------------------------
+ # -- experimental.update_acl() body construction + mapper ---------------
- def test_update_acl_serializes_nested_body(self, connected_accounts, mock_client):
+ def test_update_acl_serializes_nested_body(self, experimental, mock_client):
response = Mock()
response.id = "ca_abc"
response.status = "ACTIVE"
response.success = True
mock_client.connected_accounts.patch.return_value = response
- result = connected_accounts.update_acl(
+ result = experimental.update_acl(
"ca_abc",
allow_all_users=True,
not_allowed_user_ids=["user_bob"],
@@ -684,46 +681,56 @@ class TestConnectedAccountsAcl:
mock_client.connected_accounts.patch.assert_called_once_with(
"ca_abc",
- acl_config_for_shared={
- "allow_all_users": True,
- "not_allowed_user_ids": ["user_bob"],
+ experimental={
+ "acl_config_for_shared": {
+ "allow_all_users": True,
+ "not_allowed_user_ids": ["user_bob"],
+ }
},
+ alias=omit,
+ connection=omit,
)
assert result is response
- def test_update_acl_omits_absent_fields(self, connected_accounts, mock_client):
- connected_accounts.update_acl("ca_abc", allowed_user_ids=["user_alice"])
+ def test_update_acl_omits_absent_fields(self, experimental, mock_client):
+ experimental.update_acl("ca_abc", allowed_user_ids=["user_alice"])
mock_client.connected_accounts.patch.assert_called_once_with(
"ca_abc",
- acl_config_for_shared={"allowed_user_ids": ["user_alice"]},
+ experimental={
+ "acl_config_for_shared": {"allowed_user_ids": ["user_alice"]}
+ },
+ alias=omit,
+ connection=omit,
)
- def test_update_acl_preserves_empty_array(self, connected_accounts, mock_client):
- connected_accounts.update_acl("ca_abc", allowed_user_ids=[])
+ def test_update_acl_preserves_empty_array(self, experimental, mock_client):
+ experimental.update_acl("ca_abc", allowed_user_ids=[])
mock_client.connected_accounts.patch.assert_called_once_with(
"ca_abc",
- acl_config_for_shared={"allowed_user_ids": []},
+ experimental={"acl_config_for_shared": {"allowed_user_ids": []}},
+ alias=omit,
+ connection=omit,
)
- def test_update_acl_rejects_all_none(self, connected_accounts, mock_client):
+ def test_update_acl_rejects_all_none(self, experimental, mock_client):
with pytest.raises(exceptions.ValidationError):
- connected_accounts.update_acl("ca_abc")
+ experimental.update_acl("ca_abc")
mock_client.connected_accounts.patch.assert_not_called()
def test_update_acl_maps_acl_only_for_shared_to_typed_error(
- self, connected_accounts, mock_client
+ self, experimental, mock_client
):
mock_client.connected_accounts.patch.side_effect = _make_bad_request_error(
"acl_config_for_shared is only valid on SHARED connections."
)
with pytest.raises(exceptions.ComposioAclOnlyForSharedError):
- connected_accounts.update_acl("ca_abc", allow_all_users=True)
+ experimental.update_acl("ca_abc", allow_all_users=True)
def test_update_acl_rethrows_non_acl_bad_request_errors(
- self, connected_accounts, mock_client
+ self, experimental, mock_client
):
unrelated = _make_bad_request_error("some other 400")
mock_client.connected_accounts.patch.side_effect = unrelated
@@ -731,7 +738,21 @@ class TestConnectedAccountsAcl:
from composio_client import BadRequestError
with pytest.raises(BadRequestError):
- connected_accounts.update_acl("ca_abc", allow_all_users=True)
+ experimental.update_acl("ca_abc", allow_all_users=True)
+
+ def test_update_acl_requires_client(self):
+ from composio.core.models.custom_tool import ExperimentalAPI
+
+ with pytest.raises(exceptions.ValidationError):
+ ExperimentalAPI().update_acl("ca_abc", allow_all_users=True)
+
+ # -- list(account_type=...) — flat experimental filter -----------------
+
+ def test_list_forwards_account_type_filter(self, connected_accounts, mock_client):
+ connected_accounts.list(account_type="SHARED", user_ids=["user_creator"])
+ mock_client.connected_accounts.list.assert_called_once_with(
+ account_type="SHARED", user_ids=["user_creator"]
+ )
# SEC-339: initiate() must gate its DeprecationWarning on the response
diff --git a/python/tests/test_tool_router.py b/python/tests/test_tool_router.py
index b76d9cf16..be51e8f9e 100644
--- a/python/tests/test_tool_router.py
+++ b/python/tests/test_tool_router.py
@@ -6,7 +6,6 @@ import pytest
from composio_client import omit
from pydantic import BaseModel, Field
-from composio.exceptions import ValidationError
from composio.core.models.custom_tool import ExperimentalAPI
from composio.core.models.tool_router import (
SESSION_PRESET_DIRECT_TOOLS,
@@ -24,6 +23,7 @@ from composio.core.models.tool_router import (
from composio.core.models.tool_router_session import (
DIRECT_CUSTOM_TOOL_DESCRIPTION_PREFIX,
)
+from composio.exceptions import ValidationError
experimental_api = ExperimentalAPI()
@@ -1182,6 +1182,30 @@ class TestToolRouter:
call_args = mock_client.tool_router.session.link.call_args
assert call_args.kwargs.get("callback_url") == "https://myapp.com/callback"
+ def test_authorize_forwards_experimental_block(self, tool_router, mock_client):
+ """authorize() should pass the experimental options through verbatim."""
+ session = tool_router.create(user_id="user_123")
+
+ session.authorize(
+ "github",
+ experimental={
+ "account_type": "SHARED",
+ "acl_config_for_shared": {
+ "allow_all_users": True,
+ "not_allowed_user_ids": ["user_bob"],
+ },
+ },
+ )
+
+ call_kwargs = mock_client.tool_router.session.link.call_args.kwargs
+ assert call_kwargs["experimental"] == {
+ "account_type": "SHARED",
+ "acl_config_for_shared": {
+ "allow_all_users": True,
+ "not_allowed_user_ids": ["user_bob"],
+ },
+ }
+
def test_toolkits_function(self, tool_router, mock_client):
"""Test the toolkits function returned by session."""
session = tool_router.create(user_id="user_123")
diff --git a/uv.lock b/uv.lock
index cba364f21..cc3ca28ce 100644
--- a/uv.lock
+++ b/uv.lock
@@ -621,7 +621,7 @@ dev = [
[package.metadata]
requires-dist = [
- { name = "composio-client", specifier = "==1.38.0" },
+ { name = "composio-client", specifier = "==1.39.0" },
{ name = "json-schema-to-pydantic", specifier = ">=0.4.8" },
{ name = "openai" },
{ name = "pydantic", specifier = ">=2.6.4" },
@@ -663,7 +663,7 @@ requires-dist = [
[[package]]
name = "composio-client"
-version = "1.38.0"
+version = "1.39.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
@@ -673,9 +673,9 @@ dependencies = [
{ name = "sniffio" },
{ name = "typing-extensions" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/ea/c0/b0f452d153f5ecf807d7281110a1dea3ea3a6993efa1cdf82782e3daf1f4/composio_client-1.38.0.tar.gz", hash = "sha256:70f248f847f91473413353500862f3944baa829cc2740c32f31c631d755f7f9e", size = 248289, upload-time = "2026-05-11T18:16:11.167Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/0d/78/efc71b2df0d580c4550ee60644193644ae3ddc06fc89f3fc92998db6393c/composio_client-1.39.0.tar.gz", hash = "sha256:2086493925117b956a3166da18414925cb50829172c8211591137fcdc3d60c7d", size = 248246, upload-time = "2026-05-12T14:28:13.071Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/9e/62/7b5644d995f4d71477918dd6597366889700ba51f7f2fa09e1e557ce6ac2/composio_client-1.38.0-py3-none-any.whl", hash = "sha256:7c183bb9f4721786db532fcd1bd71636403752ba655cd980fa971f89ba59a664", size = 284169, upload-time = "2026-05-11T18:16:09.461Z" },
+ { url = "https://files.pythonhosted.org/packages/88/59/f4ddca56b9f02c8fed3277584111a687c9be986d0d2e8b421c80a20caa03/composio_client-1.39.0-py3-none-any.whl", hash = "sha256:bf6050dc0d523bd1e9d52e39e162f5b23bd029aa441b5c4a18e1751aae58571d", size = 284163, upload-time = "2026-05-12T14:28:11.681Z" },
]
[[package]]