Integrate Composio with Langflow
Langflow integrates with Composio as a toolset for your Agent component.
Instead of juggling multiple integrations and components in your flow, connect the Composio component to an Agent component to use all of Composio's supported APIs and actions as Tools for your agent.
Prerequisites
Connect Langflow to a Composio tool
- In the Langflow Workspace, add an Agent component.
- In the Workspace, add the Composio Tools component.
- Connect the Agent component's Tools port to the Composio Tools component's Tools port.
- In the Composio API Key field, paste your Composio API key. Alternatively, add the key as a global variable.
- In the Tool Name field, select the tool you want your agent to have access to. For this example, select the Gmail tool, which allows your agent to control an email account with the Composio tool.
- In the Actions field, select the action you want the Agent to take with the Gmail tool. The Gmail tool supports multiple actions, and also supports multiple actions within the same tool. For this example, select GMAIL_CREATE_EMAIL_DRAFT. For more information, see the Composio documentation.
Create a Composio flow
- In the Workspace, add Chat Input and Chat Output components to your flow.
- Connect the components so they look like this.
- In the OpenAI API Key field of the Agent component, paste your OpenAI API key. Alternatively, add the key as a global variable.
- To open the Playground pane, click Playground.
- Ask your AI:
_10What tools are available to you?
The response should be similar to:
_10I have access to the following tools:_10_101. **GMAIL_CREATE_EMAIL_DRAFT**: This tool allows me to create a draft email using Gmail's API. I can specify the recipient's email address, subject, body content, and whether the body content is HTML._10_102. **CurrentDate-get_current_date**: This tool retrieves the current date and time in a specified timezone.
This confirms your Agent and Composio are communicating.
- Tell your AI to write a draft email.
_10Create a draft email with the subject line "Greetings from Composio"_10recipient: "your.email@address.com"_10Body content: "Hello from composio!"
Inspect the response to see how the agent used the attached tool to write an email. This example response is abbreviated.
_10The draft email with the subject "Greetings from Composio" and body "Hello from composio!" has been successfully created.
_24{_24 "recipient_email": "your.email@address.com",_24 "subject": "Greetings from Composio",_24 "body": "Hello from composio!",_24 "is_html": false_24}_24_24{_24 "data": {_24 "response_data": {_24 "id": "r-237981011463568567",_24 "message": {_24 "id": "195dd80528171132",_24 "threadId": "195dd80528171132",_24 "labelIds": [_24 "DRAFT"_24 ]_24 }_24 }_24 },_24 "error": null,_24 "successfull": true,_24 "successful": true_24}
- To confirm further, navigate to the Gmail account you authenticated with Composio. Your email is visible in Drafts.
You have successfully integrated your Langflow component with Composio. To add more tools, add another Composio component.