Introduction to Entities

In Composio, an entity encapsulates all associated accounts for either a user or an organization. This consolidation simplifies the administration of multiple accounts, allowing you to manage them seamlessly. An entity can be identified using any unique identifier, such as an email address.

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.

Conclusion

Managing multiple users and their authentication can be streamlined with Composio’s entity-based approach. By encapsulating users and organizations under a single management umbrella, Composio simplifies the administration of connected accounts and actions. With this approach, you can efficiently manage multiple users and perform tasks on their behalf, enhancing productivity and security.