work-email; an assignment chooses which connected Gmail account satisfies that requirement.
An account belongs to an Owner
Every account belongs to an Owner: a person or organization. It belongs to that Owner independently of any slate, so several slates can use the same account without creating separate provider logins for each one. Choose the Owner when connecting the account. A personal account belongs to you. An account connected for an organization belongs to that organization, and its members can connect and list the organization’s accounts. The person completing provider authorization and the Owner holding the resulting account can therefore be different: an organization member can authorize an organization-owned account.Composio holds the credentials
Composio stores and refreshes the provider credentials. A ContextLayer assignment records an account ID, not an access token or password. Tool calls run in a Composio session for the Owner selected by the connection’s mode, so an assignment can select only an account belonging to that Owner. Your app or agent calls a tool through a declared connection; it does not need to load or refresh the provider credential itself.Connect an account, then assign it
Connecting and assigning are two separate actions:- Connect the account. Choose its Owner and toolkit—the provider integration, such as Gmail. ContextLayer creates an authorization link; complete the provider’s authorization in your browser.
- Assign the account. Select the connected account for a connection declared by the slate. This tells that connection which account to use.
- the CLI’s
accountscommand, which prints the link; - the chrome, ContextLayer’s header and configuration tray in a hosted slate, next to a declared connection;
- the API operation Create an authorization link to connect an Owner’s account.
Example: a local Gmail connection
For example, an app declares a Gmail connection with the slugwork-email:
public/slate.json
.contextlayer/connections.json file. For example:
.contextlayer/connections.json
ca_example represents the connected account’s ID. The CLI writes the actual ID when you make the assignment; this file contains no Gmail credentials and stays out of Git. A hosted assignment is configured separately and is not read from this local file.
This loader excerpt calls the provider tool through work-email. The slug stays in code; changing the assignment changes the selected account without changing the loader:
app/routes/home.tsx
{ data, logId }: the provider’s result and the execution log ID. Validate provider data before using it in your interface; see Tools in the SDK reference.
List accounts
Use the account list to choose an active account for an assignment. The CLI’saccounts command lists an Owner’s accounts with their toolkit, identity, and status. Only active accounts are listed. Run npx @usecontextlayer/cli accounts --help for its operations and for choosing between your personal accounts and an organization’s.
API
The platform’s account operations are in the Accounts group of the API reference:- List active accounts belonging to an Owner
- Create an authorization link to connect an Owner’s account
- List the caller’s active accounts for a toolkit and Call a tool with the caller’s selected account, the personal-account operations that local development uses