发布

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

    frostbyte_neo 发布于 2026-05-13 13:52:07 +00:00

    Summary

    Moves the SHARED connected-accounts surface in the Python SDK under the
    composio.experimental namespace, mirroring the wire-level restructure
    of the same fields. Same precedent as composio.experimental.tool /
    composio.experimental.Toolkit — the namespace tells callers the shape
    may still change.

    • link() and session.authorize(): flat account_type /
      acl_config_for_shared kwargs → single experimental={} dict
    • composio.connected_accounts.update_acl(...)
      composio.experimental.update_acl(...)
    • composio.connected_accounts.list(...) now exposes
      account_type='PRIVATE' | 'SHARED' | 'ALL' (flat — the wire keeps this
      as a query param)
    • composio-client bumped 1.38.01.39.0 so the generated typed
      client carries the Experimental TypedDicts

    Pinning a SHARED connection in a session (connected_accounts={...})
    and direct execute by connected_account_id are unchanged — only the
    connection-create / patch / authorize surfaces moved.

    Caller migration

    # before
    composio.connected_accounts.link(
        user_id, auth_config_id,
        account_type="SHARED",
        acl_config_for_shared={"allow_all_users": True},
    )
    composio.connected_accounts.update_acl("ca_abc", allow_all_users=True)
    session.authorize(
        "github",
        account_type="SHARED",
        acl_config_for_shared={"allow_all_users": True},
    )
    
    # after
    composio.connected_accounts.link(
        user_id, auth_config_id,
        experimental={
            "account_type": "SHARED",
            "acl_config_for_shared": {"allow_all_users": True},
        },
    )
    composio.experimental.update_acl("ca_abc", allow_all_users=True)
    session.authorize(
        "github",
        experimental={
            "account_type": "SHARED",
            "acl_config_for_shared": {"allow_all_users": True},
        },
    )
    
    # new — list SHARED connections
    shared = composio.connected_accounts.list(
        account_type="SHARED",
        user_ids=["user_creator"],
    )
    

    Tests

    • link() forwards the experimental block / omits it when not provided
      / preserves explicit empty lists
    • link() maps the acl_config_for_shared is only valid on SHARED 400
      to ComposioAclOnlyForSharedError; non-ACL 400s re-raise
    • experimental.update_acl() body construction, deny-list handling,
      ValidationError when no fields provided, ValidationError when no
      client is bound, same 400-mapper as link()
    • authorize() forwards the experimental block
    • list(account_type="SHARED") delegates the flat filter through to the
      client

    Test plan

    • nox -s fmt and nox -s chk clean for composio/ (pre-existing
      4 mypy errors in providers/langgraph and providers/langchain are
      unrelated — same on origin/next)
    • pytest tests/test_connected_accounts.py tests/test_tool_router.py → 136 passed
    • Docs page update (separate PR — code samples already on the
      experimental shape there; account_type= list filter example to be
      added once this lands)

    🤖 Generated with Claude Code

    下载附件