https://linen.dev logo
Unable to initialize composioToolSet with connecte...
# 🖥│support-forum
b
Hey @udaysidagana , we were using v1/v2 api for tool connection establishing and getting the connected account details. The connected account id used to be UUID format and we used the same for
tool->composio_connected_acc_id
map for passing the connection_ids during composioToolSet initialization. But now, we are upgrading to v3 and the composio_connected_acc_id is in nanoid format. We tried to use the same nano_id (ca_.....) and mapped with the tool slug name. But we are getting the following error
Copy code
Invalid connected accounts found: [('miro', 'ca_b8eH5za127J5')]
we are usign python langgraph sdk
Copy code
composio-langgraph = "^0.7.15"
Are we missing anything here ? https://cdn.discordapp.com/attachments/1402340983412101180/1402341618324996096/image.png?ex=68938fe8&is=68923e68&hm=3e686d6deaac754362520288816fb805bd1cc65db1578b81a47136f92e01e4b1&
c
Hi Naik, Could you share your requestId? It will help us in debugging the Issue!
b
Hey @udaysidagana , this error occuring at the toolset initialization phase.
Copy code
from composio_langgraph import ComposioToolSet, Action

.....

composio_toolset = ComposioToolSet(
            entity_id=entity_id,
            api_key=composio_api_key,
                connected_account_ids=connected_account_ids
        )
Here is the sample code snippet
c
Looks like your code snippet is still v1/v2. Could you share the v3 code snippet to which you've migrated? Thanks!
b
This is how we are initializing the tool connection. const payload = { auth_config: { id: composio_integration_id ,//nanoId }, connection: { state: { authScheme: "OAUTH2", val: { status: "INITIALIZING" } }, callback_url: returnTo, user_id: accountId } }; const response = await axios.post(
${BASE_URL}/v3/connected_accounts
, payload, { headers: { "x-api-key": composio_api_key, "Content-Type": "application/json" } } ); and we are extracting the redirectURL and the composio_connected_account id as redirect_url and id property of the response respectively.
There is no issue with the authentication, using this snippet. But, when a single entity has multiple connections then, we are utilizing the connection_ids parameter of the composioToolSet to provide proper mapping with the tool slug name and the composio_connected_acc_id.
If I am missing anything please share the relevant docs.
c
Just to clarify, your composioToolSet Instance is v1/v2 so I'm expecting a different composio() instance in your code snippet. Can you confirm the same?
b
Can you share relevant doc for migration of composioToolSet to v3 (composio()) which would allow me to have the current customization ?
c
Sure, let me share the migration guide:
b
Hey @udaysidagana , in v1/v2 we were able to pass the dictionary
Copy code
connected_account_ids: Dict[AppType, str] | None = None,
to the ComposioToolSet explicity, to let only the specicied connected_id for the particulat toolKit to be used. This is the case when the connection with same entity_id (user_id) has multiple connections, then to use a particulare connection we made use of the connected_account_ids property. Do we have the same for the framework agnostic composio instace. If so, can you please share the detailed doc about how we can configure it and what should be the format ?
c
We currently do not have support for Agno in V3. You can create your own [provider](https://docs.composio.dev/providers/custom/python).
b
Got it. Can you walk me through how we can address the case when we have multiple connections to same entity_id (user_id) in case of v3 Composio instance. Similar to what we have with ComposioToolSet with connected_account_ids parameter. Example code snippet would also help. @User
c
You can pass it as a param while trying to execute a Tool call, I'll share a example snippet:
Copy code
const res = await composio.tools.execute("GMAIL_SEND_EMAIL", {
  userId: "default",
  arguments: {
    recipient_email: "uday.sidgana@gmail.com",
    subject: "Test",
    body: "Test",
  },
  connectedAccountId: "ca_xxxx"
});
relevant docs: