@devries-cameron20 / composio Mirror · read-only / commits / b283fbbcc
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 21:00 UTC

feat(connected-accounts-py): surface account_type + per-user ACL on SHARED connections

Python mirror of #3392 (TypeScript SDK). Same Apollo-side feature shipped across four Hermes PRs (#9860, #9882, #9887 internal, #9902), now exposed through @composio/* Python SDK wrappers. Bumped composio-client 1.37.0 → 1.38.0 (the regenerated client published by composio-base-py#66 — contains account_type + acl_config_for_shared on LinkCreateParams, ConnectedAccountPatchParams, SessionLinkParams, the retrieve response, and the list response item). SDK changes: - composio.connected_accounts.link() now accepts `account_type` and `acl_config_for_shared`. Default behaviour (omit both) creates a PRIVATE connection exactly as before. - New composio.connected_accounts.update_acl(nanoid, *, allow_all_users, allowed_user_ids, not_allowed_user_ids) — wraps PATCH /connected_accounts/{id} with the same semantics as the TS sibling. PATCH semantics: omit a param to leave unchanged; pass [] to clear an allow/deny list. Raises ValidationError if all three are None. - composio.tool_router_session.authorize() options gain `account_type` and `acl_config_for_shared` — the /tool_router/session/{id}/link endpoint accepts the same fields. - New typed errors in composio.exceptions: * ComposioAclOnlyForSharedError (400) — wired at link() / update_acl() / authorize() catch sites via the same `acl_config_for_shared is only valid on SHARED` substring match used in the TS SDK. Verified against Apollo's createConnectedAccount.ts. * ComposioSharedAccessDeniedError (403) — exported, not yet wrapped. Wraps when Tools.execute() error mapping lands in a follow-up. * ComposioSharedConnectionNotAccessibleError (400) — exported, not yet wrapped. Wraps when ToolRouterSession.create()/patch() session- validator error mapping lands. Plumbing: - python/composio/client/types.py re-exports `link_create_params` (the generated client's TypedDicts for link create payloads, including `ACLConfigForShared`). Tests: 12 new tests in TestConnectedAccountsAcl class covering link() ACL forwarding (4), AclOnlyForShared mapping on link() (1), pass-through of unrelated BadRequestError (1), update_acl() body construction (3), empty-fields rejection (1), AclOnlyForShared mapping on update_acl() (1), pass-through of unrelated BadRequestError on update_acl() (1). 49 tests pass (37 pre-existing + 12 new); full suite 635 pass / 31 skipped. Verified: nox -s chk clean (ruff + mypy on src + tests). Version: 0.13.0 → 0.14.0 (minor — additive surface). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

venkat82 committed May 12, 2026 at 00:20 UTC b283fbbccc17f0fd04c8675c6a742c3981713f16
7 files changed +456 -29
python/composio/client/types.py
+2
@@ -20,6 +20,7 @@ from composio_client.types import (
20 connected_account_patch_response,
21 connected_account_retrieve_response,
22 connected_account_update_status_response,
23 + link_create_params,
24 tool_execute_params,
25 tool_execute_response,
26 tool_list_response,
@@ -78,6 +79,7 @@ __all__ = (
79 "connected_account_patch_response",
80 "connected_account_retrieve_response",
81 "connected_account_update_status_response",
82 + "link_create_params",
83 "trigger_instance_upsert_response",
84 "tool_execute_params",
85 "tool_execute_response",
python/composio/core/models/connected_accounts.py
+134 -6
@@ -17,6 +17,7 @@ from composio.client.types import (
17 connected_account_patch_response,
18 connected_account_retrieve_response,
19 connected_account_update_status_response,
20 + link_create_params,
21 )
22
23 from .base import Resource
@@ -558,6 +559,8 @@ class ConnectedAccounts:
559 callback_url: t.Optional[str] = None,
560 alias: t.Optional[str] = None,
561 allow_multiple: bool = False,
562 + account_type: t.Optional[t.Literal["PRIVATE", "SHARED"]] = None,
563 + acl_config_for_shared: t.Optional[link_create_params.ACLConfigForShared] = None,
564 ) -> ConnectionRequest:
565 """
566 Create a Composio Connect Link for a user to connect their account to a given auth config.
@@ -574,6 +577,17 @@ class ConnectedAccounts:
577 ``ComposioMultipleConnectedAccountsError`` if the user already has an
578 ``ACTIVE`` connection on this auth config. Pair with ``alias`` and a
579 session-level ``multi_account`` config to disambiguate at execution time.
580 + :param account_type: Sharing model for the new connection. ``PRIVATE``
581 + (default) is usable only by the owning ``user_id``. ``SHARED`` is
582 + reachable from a tool-router session by other users in the project,
583 + but only when explicitly pinned and only when the requesting
584 + ``user_id`` passes the connection's ACL. Set at create time only.
585 + :param acl_config_for_shared: Per-user ACL for SHARED connections. Only
586 + valid when ``account_type == 'SHARED'`` — the backend rejects ACL
587 + on a PRIVATE connection with ``ComposioAclOnlyForSharedError``
588 + (400). Pass an ``ACLConfigForShared`` dict with any combination of
589 + ``allow_all_users``, ``allowed_user_ids``, ``not_allowed_user_ids``.
590 + Omit to keep deny-by-default (only the creator can use).
591 :return: Connection request object.
592
593 Example:
@@ -597,6 +611,17 @@ class ConnectedAccounts:
611
612 # Wait for the connection to be established
613 connected_account = composio.connected_accounts.wait_for_connection(connection_request.id)
614 +
615 + Example creating a SHARED connection with an ACL:
616 + connection_request = composio.connected_accounts.link(
617 + 'user_creator',
618 + 'auth_config_123',
619 + account_type='SHARED',
620 + acl_config_for_shared={
621 + 'allow_all_users': True,
622 + 'not_allowed_user_ids': ['user_bob'],
623 + },
624 + )
625 """
626 # Mirror ``initiate()``: guard against silently creating extra
627 # connections on the same auth config.
@@ -615,12 +640,25 @@ class ConnectedAccounts:
640 auth_config_id,
641 )
642
618 - response = self._client.link.create(
619 - auth_config_id=auth_config_id,
620 - user_id=user_id,
621 - callback_url=callback_url if callback_url is not None else omit,
622 - alias=alias if alias is not None else omit,
623 - )
643 + try:
644 + response = self._client.link.create(
645 + auth_config_id=auth_config_id,
646 + user_id=user_id,
647 + callback_url=callback_url if callback_url is not None else omit,
648 + alias=alias if alias is not None else omit,
649 + account_type=account_type if account_type is not None else omit,
650 + acl_config_for_shared=(
651 + acl_config_for_shared if acl_config_for_shared is not None else omit
652 + ),
653 + )
654 + except BadRequestError as error:
655 + # Backend rejects ACL on PRIVATE rows with 400 +
656 + # ``ConnectedAccount_AclOnlyForShared``. Surface it as a typed
657 + # error so callers can ``except`` instead of grepping messages.
658 + message = str(error)
659 + if "acl_config_for_shared is only valid on SHARED" in message:
660 + raise exceptions.ComposioAclOnlyForSharedError(message) from error
661 + raise
662
663 return ConnectionRequest(
664 id=response.connected_account_id,
@@ -629,6 +667,96 @@ class ConnectedAccounts:
667 client=self._client,
668 )
669
670 + def update_acl(
671 + self,
672 + nanoid: str,
673 + *,
674 + allow_all_users: t.Optional[bool] = None,
675 + allowed_user_ids: t.Optional[t.List[str]] = None,
676 + not_allowed_user_ids: t.Optional[t.List[str]] = None,
677 + ) -> connected_account_patch_response.ConnectedAccountPatchResponse:
678 + """
679 + Update the per-user ACL on a SHARED connected account.
680 +
681 + Only meaningful for SHARED connections — the backend rejects ACL
682 + writes on PRIVATE rows with ``ComposioAclOnlyForSharedError`` (400).
683 + Auth gate is creator-or-API-key (a non-creator project member
684 + updating an alias on a SHARED row still works via :meth:`update`,
685 + but ACL writes do not).
686 +
687 + PATCH semantics: omit a parameter to leave it unchanged; pass an
688 + empty list to clear an allow/deny list. At least one parameter must
689 + be provided — calling with all three as ``None`` raises
690 + :class:`composio.exceptions.ValidationError`.
691 +
692 + Resolution rule (deny wins):
693 + 1. requesting user_id in ``not_allowed_user_ids`` → DENY
694 + 2. ``allow_all_users == True`` → ALLOW
695 + 3. requesting user_id in ``allowed_user_ids`` → ALLOW
696 + 4. otherwise → DENY
697 +
698 + :param nanoid: The connected account ID (``ca_xxx``).
699 + :param allow_all_users: Wildcard "any user_id in the project" allow.
700 + :param allowed_user_ids: Explicit allow list. Pass ``[]`` to clear.
701 + :param not_allowed_user_ids: Explicit deny list (wins over allow on
702 + conflict). Pass ``[]`` to clear — note that clearing the deny
703 + list silently re-grants access to previously-blocked users.
704 + :return: PATCH response (``id``, ``status``, ``success``). To read
705 + back the updated ``acl_config_for_shared`` block, call
706 + :meth:`get` after this returns.
707 +
708 + Example::
709 +
710 + # Open access to everyone in the project
711 + composio.connected_accounts.update_acl('ca_abc', allow_all_users=True)
712 +
713 + # Everyone except a specific user
714 + composio.connected_accounts.update_acl(
715 + 'ca_abc',
716 + allow_all_users=True,
717 + not_allowed_user_ids=['user_bob'],
718 + )
719 +
720 + # Targeted allow
721 + composio.connected_accounts.update_acl(
722 + 'ca_abc',
723 + allowed_user_ids=['user_alice', 'user_bob'],
724 + )
725 +
726 + # Revoke a previously-granted allow list (back to deny-by-default)
727 + composio.connected_accounts.update_acl('ca_abc', allowed_user_ids=[])
728 + """
729 + if (
730 + allow_all_users is None
731 + and allowed_user_ids is None
732 + and not_allowed_user_ids is None
733 + ):
734 + raise exceptions.ValidationError(
735 + "update_acl requires at least one of allow_all_users, "
736 + "allowed_user_ids, or not_allowed_user_ids"
737 + )
738 +
739 + acl: t.Dict[str, t.Any] = {}
740 + if allow_all_users is not None:
741 + acl["allow_all_users"] = allow_all_users
742 + if allowed_user_ids is not None:
743 + acl["allowed_user_ids"] = allowed_user_ids
744 + if not_allowed_user_ids is not None:
745 + acl["not_allowed_user_ids"] = not_allowed_user_ids
746 +
747 + try:
748 + return self._client.connected_accounts.patch(
749 + nanoid,
750 + acl_config_for_shared=t.cast(
751 + connected_account_patch_params.ACLConfigForShared, acl
752 + ),
753 + )
754 + except BadRequestError as error:
755 + message = str(error)
756 + if "acl_config_for_shared is only valid on SHARED" in message:
757 + raise exceptions.ComposioAclOnlyForSharedError(message) from error
758 + raise
759 +
760 def wait_for_connection(
761 self,
762 id: str,
python/composio/core/models/tool_router_session.py
+32 -8
@@ -12,9 +12,9 @@ import typing as t
12 from concurrent.futures import ThreadPoolExecutor
13 from dataclasses import dataclass
14
15 -from composio_client import Omit, omit
15 +from composio_client import BadRequestError, Omit, omit
16 from composio_client._types import SequenceNotStr
17 -from composio_client.types.tool_router import session_patch_params
17 +from composio_client.types.tool_router import session_link_params, session_patch_params
18 from composio.client.types import Tool
19 from composio_client.types.tool_list_response import (
20 ItemDeprecated,
@@ -31,6 +31,7 @@ from composio_client.types.tool_router.session_search_response import (
31 SessionSearchResponse,
32 )
33
34 +from composio import exceptions
35 from composio.client import HttpClient
36 from composio.core.models.connected_accounts import ConnectionRequest
37 from composio.core.models.custom_tool import find_custom_tool_map_entry_by_final_slug
@@ -538,6 +539,8 @@ class ToolRouterSession(t.Generic[TTool, TToolCollection]):
539 *,
540 callback_url: t.Optional[str] = None,
541 alias: t.Optional[str] = None,
542 + account_type: t.Optional[t.Literal["PRIVATE", "SHARED"]] = None,
543 + acl_config_for_shared: t.Optional[session_link_params.ACLConfigForShared] = None,
544 ) -> ConnectionRequest:
545 """
546 Authorize a toolkit for the user and get a connection request.
@@ -546,13 +549,34 @@ class ToolRouterSession(t.Generic[TTool, TToolCollection]):
549
550 :param alias: Human-readable alias for the connection. Must be unique
551 per userId and toolkit within the project.
552 + :param account_type: Sharing model for the new connection. ``PRIVATE``
553 + (default) is usable only by the owning user. ``SHARED`` lets other
554 + users in the project use the connection when pinned. Set at create
555 + time only.
556 + :param acl_config_for_shared: Per-user ACL for SHARED connections. Only
557 + valid when ``account_type == 'SHARED'`` — the backend rejects ACL
558 + on a PRIVATE connection with ``ComposioAclOnlyForSharedError``
559 + (400).
560 """
550 - response = self._client.tool_router.session.link(
551 - session_id=self.session_id,
552 - toolkit=toolkit,
553 - callback_url=callback_url if callback_url else omit,
554 - alias=alias if alias is not None else omit,
555 - )
561 + try:
562 + response = self._client.tool_router.session.link(
563 + session_id=self.session_id,
564 + toolkit=toolkit,
565 + callback_url=callback_url if callback_url else omit,
566 + alias=alias if alias is not None else omit,
567 + account_type=account_type if account_type is not None else omit,
568 + acl_config_for_shared=(
569 + acl_config_for_shared if acl_config_for_shared is not None else omit
570 + ),
571 + )
572 + except BadRequestError as error:
573 + # Mirrors the mapper on ``composio.connected_accounts.link()`` —
574 + # the same backend handler returns ``AclOnlyForShared`` here.
575 + message = str(error)
576 + if "acl_config_for_shared is only valid on SHARED" in message:
577 + raise exceptions.ComposioAclOnlyForSharedError(message) from error
578 + raise
579 +
580 return ConnectionRequest(
581 id=response.connected_account_id,
582 redirect_url=response.redirect_url,
python/composio/exceptions.py
+55
@@ -331,6 +331,61 @@ class ComposioLegacyConnectedAccountsEndpointRetiredError(ConnectedAccountError)
331 pass
332
333
334 +class ComposioAclOnlyForSharedError(ConnectedAccountError):
335 + """Raised when ACL fields (``allow_all_users``, ``allowed_user_ids``,
336 + ``not_allowed_user_ids``) are sent on a ``PRIVATE`` connection — at
337 + create time or via PATCH.
338 +
339 + ACL is only meaningful for ``SHARED`` connections; the matching layer
340 + never reads it for PRIVATE. Backend rejects with 400 +
341 + ``ConnectedAccount_AclOnlyForShared`` rather than silently ignoring the
342 + ACL block, so developer misconfiguration surfaces loudly.
343 +
344 + Fix: set ``account_type='SHARED'`` at create time, or omit the ACL
345 + fields when creating/updating a PRIVATE connection.
346 + """
347 +
348 + pass
349 +
350 +
351 +class ComposioSharedAccessDeniedError(ConnectedAccountError):
352 + """Raised when a tool execution attempts to use a SHARED connected
353 + account but the requesting ``user_id`` is not allowed by the
354 + connection's ACL.
355 +
356 + Surfaces from the matching layer when a SHARED connection is reached
357 + directly (e.g. via ``composio.tools.execute(slug, connected_account_id=...)``)
358 + without going through a tool-router session that already pre-flighted
359 + the ACL at session-create time.
360 +
361 + Fix: ask the connection's creator to grant access via
362 + ``composio.connected_accounts.update_acl()`` — set ``allow_all_users``,
363 + add the ``user_id`` to ``allowed_user_ids``, or remove it from
364 + ``not_allowed_user_ids``.
365 +
366 + Backend response: 403 with code ``ConnectedAccount_SharedAccessDenied``.
367 + """
368 +
369 + pass
370 +
371 +
372 +class ComposioSharedConnectionNotAccessibleError(ConnectedAccountError):
373 + """Raised by tool-router session create / PATCH when the session's
374 + ``user_id`` cannot use a pinned SHARED connection — caught at
375 + session-create time so the session never enters a state that 4xxs
376 + mid-execution.
377 +
378 + Fix: grant the session user access via
379 + ``composio.connected_accounts.update_acl()`` on the pinned connection,
380 + or pin a different connection the user can use.
381 +
382 + Backend response: 400 with code
383 + ``ToolRouterV2_SharedConnectionNotAccessible``.
384 + """
385 +
386 + pass
387 +
388 +
389 class ErrorProcessingToolExecutionRequest(PluginError):
390 pass
391
python/pyproject.toml
+2 -2
@@ -1,13 +1,13 @@
1 [project]
2 name = "composio"
3 -version = "0.13.0"
3 +version = "0.14.0"
4 description = "SDK for integrating Composio with your applications."
5 readme = "README.md"
6 requires-python = ">=3.10,<4"
7 dependencies = [
8 "pysher>=1.0.8",
9 "pydantic>=2.6.4",
10 - "composio-client==1.37.0",
10 + "composio-client==1.38.0",
11 "typing-extensions>=4.0.0",
12 "openai",
13 "json-schema-to-pydantic>=0.4.8",
python/tests/test_connected_accounts.py
+218
@@ -284,6 +284,7 @@ class TestConnectedAccounts:
284 client.connected_accounts.update_status = Mock()
285 client.connected_accounts.refresh = Mock()
286 client.connected_accounts.create = Mock()
287 + client.connected_accounts.patch = Mock()
288 client.link.create = Mock()
289 return client
290
@@ -525,6 +526,223 @@ class TestConnectedAccounts:
526 assert result == "connected"
527
528
529 +def _make_bad_request_error(message: str):
530 + """Build a BadRequestError instance for testing the error mapper.
531 +
532 + The composio_client BadRequestError constructor signature is internal —
533 + rather than depend on it, we stub a minimal object that ``str(error)``
534 + surfaces the message and which is recognized as the BadRequestError type
535 + by ``isinstance``. This mirrors how production responses arrive: the
536 + error class with a message body.
537 + """
538 + from composio_client import BadRequestError
539 +
540 + error = BadRequestError.__new__(BadRequestError)
541 + Exception.__init__(error, message)
542 + return error
543 +
544 +
545 +class TestConnectedAccountsAcl:
546 + """Tests for accountType + per-user ACL surfacing (Hermes #9860, #9902).
547 +
548 + Mirrors the 12 behaviour tests in
549 + ``ts/packages/core/test/connectedAccounts/connectedAccounts.test.ts``.
550 + """
551 +
552 + @pytest.fixture
553 + def mock_client(self):
554 + client = Mock()
555 + client.connected_accounts.retrieve = Mock()
556 + client.connected_accounts.list = Mock()
557 + client.connected_accounts.delete = Mock()
558 + client.connected_accounts.update_status = Mock()
559 + client.connected_accounts.refresh = Mock()
560 + client.connected_accounts.create = Mock()
561 + client.connected_accounts.patch = Mock()
562 + client.link.create = Mock()
563 + # Default: no existing connections, so link() doesn't trip the guard.
564 + no_accounts = Mock()
565 + no_accounts.items = []
566 + client.connected_accounts.list.return_value = no_accounts
567 + # Default link.create response — overridden per test where the
568 + # response shape matters.
569 + default_link = Mock()
570 + default_link.connected_account_id = "ca_test_shared"
571 + default_link.redirect_url = "https://redirect"
572 + client.link.create.return_value = default_link
573 + return client
574 +
575 + @pytest.fixture
576 + def connected_accounts(self, mock_client):
577 + return ConnectedAccounts(client=mock_client)
578 +
579 + # -- link() with accountType + ACL forwarding ---------------------------
580 +
581 + def test_link_forwards_account_type_and_nested_acl(
582 + self, connected_accounts, mock_client
583 + ):
584 + connected_accounts.link(
585 + user_id="user_creator",
586 + auth_config_id="auth_config_123",
587 + account_type="SHARED",
588 + acl_config_for_shared={
589 + "allow_all_users": True,
590 + "not_allowed_user_ids": ["user_bob"],
591 + },
592 + )
593 +
594 + call_kwargs = mock_client.link.create.call_args.kwargs
595 + assert call_kwargs["account_type"] == "SHARED"
596 + assert call_kwargs["acl_config_for_shared"] == {
597 + "allow_all_users": True,
598 + "not_allowed_user_ids": ["user_bob"],
599 + }
600 +
601 + def test_link_omits_acl_when_not_provided(
602 + self, connected_accounts, mock_client
603 + ):
604 + connected_accounts.link(
605 + user_id="user_creator",
606 + auth_config_id="auth_config_123",
607 + account_type="SHARED",
608 + )
609 +
610 + call_kwargs = mock_client.link.create.call_args.kwargs
611 + assert call_kwargs["account_type"] == "SHARED"
612 + assert call_kwargs["acl_config_for_shared"] is omit
613 +
614 + def test_link_forwards_only_provided_acl_fields(
615 + self, connected_accounts, mock_client
616 + ):
617 + connected_accounts.link(
618 + user_id="user_creator",
619 + auth_config_id="auth_config_123",
620 + account_type="SHARED",
621 + acl_config_for_shared={"allowed_user_ids": ["user_alice"]},
622 + )
623 +
624 + call_kwargs = mock_client.link.create.call_args.kwargs
625 + assert call_kwargs["acl_config_for_shared"] == {
626 + "allowed_user_ids": ["user_alice"]
627 + }
628 +
629 + def test_link_preserves_explicit_empty_lists(
630 + self, connected_accounts, mock_client
631 + ):
632 + """An empty list is meaningful (clear the allow/deny list)."""
633 + connected_accounts.link(
634 + user_id="user_creator",
635 + auth_config_id="auth_config_123",
636 + account_type="SHARED",
637 + acl_config_for_shared={
638 + "allowed_user_ids": [],
639 + "not_allowed_user_ids": [],
640 + },
641 + )
642 +
643 + call_kwargs = mock_client.link.create.call_args.kwargs
644 + assert call_kwargs["acl_config_for_shared"] == {
645 + "allowed_user_ids": [],
646 + "not_allowed_user_ids": [],
647 + }
648 +
649 + def test_link_maps_acl_only_for_shared_to_typed_error(
650 + self, connected_accounts, mock_client
651 + ):
652 + mock_client.link.create.side_effect = _make_bad_request_error(
653 + "acl_config_for_shared is only valid on SHARED connections."
654 + )
655 +
656 + with pytest.raises(exceptions.ComposioAclOnlyForSharedError):
657 + connected_accounts.link(
658 + user_id="user_creator",
659 + auth_config_id="auth_config_123",
660 + account_type="PRIVATE",
661 + acl_config_for_shared={"allow_all_users": True},
662 + )
663 +
664 + def test_link_rethrows_non_acl_bad_request_errors(
665 + self, connected_accounts, mock_client
666 + ):
667 + unrelated = _make_bad_request_error("auth_config_id is required")
668 + mock_client.link.create.side_effect = unrelated
669 +
670 + from composio_client import BadRequestError
671 +
672 + with pytest.raises(BadRequestError):
673 + connected_accounts.link(
674 + user_id="user_creator", auth_config_id="auth_config_123"
675 + )
676 +
677 + # -- update_acl() body construction + mapper ----------------------------
678 +
679 + def test_update_acl_serializes_nested_body(
680 + self, connected_accounts, mock_client
681 + ):
682 + response = Mock()
683 + response.id = "ca_abc"
684 + response.status = "ACTIVE"
685 + response.success = True
686 + mock_client.connected_accounts.patch.return_value = response
687 +
688 + result = connected_accounts.update_acl(
689 + "ca_abc",
690 + allow_all_users=True,
691 + not_allowed_user_ids=["user_bob"],
692 + )
693 +
694 + mock_client.connected_accounts.patch.assert_called_once_with(
695 + "ca_abc",
696 + acl_config_for_shared={
697 + "allow_all_users": True,
698 + "not_allowed_user_ids": ["user_bob"],
699 + },
700 + )
701 + assert result is response
702 +
703 + def test_update_acl_omits_absent_fields(self, connected_accounts, mock_client):
704 + connected_accounts.update_acl("ca_abc", allowed_user_ids=["user_alice"])
705 +
706 + mock_client.connected_accounts.patch.assert_called_once_with(
707 + "ca_abc",
708 + acl_config_for_shared={"allowed_user_ids": ["user_alice"]},
709 + )
710 +
711 + def test_update_acl_preserves_empty_array(self, connected_accounts, mock_client):
712 + connected_accounts.update_acl("ca_abc", allowed_user_ids=[])
713 +
714 + mock_client.connected_accounts.patch.assert_called_once_with(
715 + "ca_abc",
716 + acl_config_for_shared={"allowed_user_ids": []},
717 + )
718 +
719 + def test_update_acl_rejects_all_none(self, connected_accounts, mock_client):
720 + with pytest.raises(exceptions.ValidationError):
721 + connected_accounts.update_acl("ca_abc")
722 + mock_client.connected_accounts.patch.assert_not_called()
723 +
724 + def test_update_acl_maps_acl_only_for_shared_to_typed_error(
725 + self, connected_accounts, mock_client
726 + ):
727 + mock_client.connected_accounts.patch.side_effect = _make_bad_request_error(
728 + "acl_config_for_shared is only valid on SHARED connections."
729 + )
730 +
731 + with pytest.raises(exceptions.ComposioAclOnlyForSharedError):
732 + connected_accounts.update_acl("ca_abc", allow_all_users=True)
733 +
734 + def test_update_acl_rethrows_non_acl_bad_request_errors(
735 + self, connected_accounts, mock_client
736 + ):
737 + unrelated = _make_bad_request_error("some other 400")
738 + mock_client.connected_accounts.patch.side_effect = unrelated
739 +
740 + from composio_client import BadRequestError
741 +
742 + with pytest.raises(BadRequestError):
743 + connected_accounts.update_acl("ca_abc", allow_all_users=True)
744 +
745 +
746 # SEC-339: initiate() must gate its DeprecationWarning on the response
747 # `Deprecation` HTTP header (RFC 9745) that apollo emits only on the
748 # retiring branch (Composio-managed + redirectable OAuth). These tests pin
uv.lock
+13 -13
@@ -591,7 +591,7 @@ wheels = [
591
592 [[package]]
593 name = "composio"
594 -version = "0.12.0"
594 +version = "0.13.0"
595 source = { virtual = "python" }
596 dependencies = [
597 { name = "composio-client" },
@@ -621,7 +621,7 @@ dev = [
621
622 [package.metadata]
623 requires-dist = [
624 - { name = "composio-client", specifier = "==1.37.0" },
624 + { name = "composio-client", specifier = "==1.38.0" },
625 { name = "json-schema-to-pydantic", specifier = ">=0.4.8" },
626 { name = "openai" },
627 { name = "pydantic", specifier = ">=2.6.4" },
@@ -648,7 +648,7 @@ dev = [
648
649 [[package]]
650 name = "composio-anthropic"
651 -version = "0.12.0"
651 +version = "0.13.0"
652 source = { virtual = "python/providers/anthropic" }
653 dependencies = [
654 { name = "anthropic" },
@@ -663,7 +663,7 @@ requires-dist = [
663
664 [[package]]
665 name = "composio-client"
666 -version = "1.37.0"
666 +version = "1.38.0"
667 source = { registry = "https://pypi.org/simple" }
668 dependencies = [
669 { name = "anyio" },
@@ -673,14 +673,14 @@ dependencies = [
673 { name = "sniffio" },
674 { name = "typing-extensions" },
675 ]
676 -sdist = { url = "https://files.pythonhosted.org/packages/75/14/d0a1cb2fb202357e4e49bdbd017d96131f0e821d136943074e9f9933436c/composio_client-1.37.0.tar.gz", hash = "sha256:b9f5c4b97863f98714634b88f61139aceef11274ee74a6fda59afc4095c5d094", size = 242029, upload-time = "2026-05-07T03:09:36.419Z" }
676 +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" }
677 wheels = [
678 - { url = "https://files.pythonhosted.org/packages/49/98/cfc8d6c6208e00e015db59278855831d77b73730cb4e574c330fcfd53d4a/composio_client-1.37.0-py3-none-any.whl", hash = "sha256:bb228899c294c348cd982bcea9a33773bd65185108e863d41465e51890872bc5", size = 278188, upload-time = "2026-05-07T03:09:34.69Z" },
678 + { 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" },
679 ]
680
681 [[package]]
682 name = "composio-crewai"
683 -version = "0.12.0"
683 +version = "0.13.0"
684 source = { virtual = "python/providers/crewai" }
685 dependencies = [
686 { name = "composio" },
@@ -695,7 +695,7 @@ requires-dist = [
695
696 [[package]]
697 name = "composio-gemini"
698 -version = "0.12.0"
698 +version = "0.13.0"
699 source = { virtual = "python/providers/gemini" }
700 dependencies = [
701 { name = "composio" },
@@ -710,7 +710,7 @@ requires-dist = [
710
711 [[package]]
712 name = "composio-google"
713 -version = "0.12.0"
713 +version = "0.13.0"
714 source = { virtual = "python/providers/google" }
715 dependencies = [
716 { name = "composio" },
@@ -725,7 +725,7 @@ requires-dist = [
725
726 [[package]]
727 name = "composio-google-adk"
728 -version = "0.12.0"
728 +version = "0.13.0"
729 source = { virtual = "python/providers/google_adk" }
730 dependencies = [
731 { name = "composio" },
@@ -740,7 +740,7 @@ requires-dist = [
740
741 [[package]]
742 name = "composio-langchain"
743 -version = "0.12.0"
743 +version = "0.13.0"
744 source = { virtual = "python/providers/langchain" }
745 dependencies = [
746 { name = "composio" },
@@ -755,7 +755,7 @@ requires-dist = [
755
756 [[package]]
757 name = "composio-openai"
758 -version = "0.12.0"
758 +version = "0.13.0"
759 source = { virtual = "python/providers/openai" }
760 dependencies = [
761 { name = "composio" },
@@ -770,7 +770,7 @@ requires-dist = [
770
771 [[package]]
772 name = "composio-openai-agents"
773 -version = "0.12.0"
773 +version = "0.13.0"
774 source = { virtual = "python/providers/openai_agents" }
775 dependencies = [
776 { name = "composio" },