Introduction to Entities

  • Each unique user is represented by a unique entity id.
  • If you have two users, Jessica and Melissa, they will have unique entity ids.

Introduction to Connected Accounts

  • When a user connects their account, a connected_account object is created.
  • This object securely stores authentication data such as access tokens and refresh tokens.

Creating and Managing Entities

To create or retrieve an entity for a user, you can use their unique identifier. Here’s an example in Python:

Once you have the entity, you can manage the connected accounts. If an account is not connected, you can prompt the user to connect their account.

Getting Connected Accounts

To get the connected accounts for an entity, you can use the following code:

This code attempts to retrieve the connected account for Slack. If no connected account is found, it catches the exception and prints a message.

Performing Actions on Behalf of Users

Composio allows you to perform actions on behalf of users. For example, you can fetch all available actions that can be performed on GitHub:

With the actions fetched, you can configure an agent to perform tasks on GitHub on behalf of the user. Here’s an example:

In this example, an agent is configured to star a repository on GitHub on behalf of the user. The OpenAI API is used to process the request and perform the action.