Multi-account mode
For a runnable agent with work and personal Gmail accounts, follow the multiple accounts walkthrough. By default, each session uses one account per toolkit. Enable multi-account mode to let users connect and use multiple accounts for the same toolkit within a single session.- Python
- TypeScript
- API
Configuration options
When multi-account mode is disabled (the default), each session uses the most recently connected account for each toolkit.
Connecting multiple accounts
Callsession.authorize() multiple times for the same toolkit. Each call creates a separate connected account.
- Python
- TypeScript
- API
Aliases
Aliases are human-readable labels for connected accounts (e.g.,"work-gmail", "personal-github"). They make it easier for agents and users to identify which account is which.
- Must be unique per user and toolkit within a project
- Can be set during connection or updated after
displayName that Composio auto-populates on the connected account at state.val.displayName once the connection is active.
See Identify the connected account to display that identity or retrieve the provider’s profile. To accept only certain email domains, follow Restrict Gmail connections to an email domain.
Setting an alias during connection
Passalias to session.authorize():
- Python
- TypeScript
- API
connectedAccounts.initiate() and connectedAccounts.link() accept the same alias parameter. To create another active connection for the same user and auth config, also pass allow_multiple=True in Python or allowMultiple: true in TypeScript.
Updating or clearing an alias
- Python
- TypeScript
- API
Selecting a specific account for a session
Pin a session to specific accounts by passing their IDs in the session config. To retrieve connected account IDs, see List accounts.- Python
- TypeScript
- API
Viewing session’s active accounts
Usesession.toolkits() to see which accounts are currently active:
- Python
- TypeScript
- API