Skip to content

Commit

Permalink
Merge pull request #31 from theyashwanthsai/improvements/29
Browse files Browse the repository at this point in the history
Improvements/29. Core Concepts page and Tools page have been changed.
  • Loading branch information
sohamganatra authored Jun 19, 2024
2 parents 2999681 + 8c26692 commit 55f639c
Show file tree
Hide file tree
Showing 17 changed files with 347 additions and 110 deletions.
88 changes: 0 additions & 88 deletions apps/list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,94 +6,6 @@ hidden: false
createdAt: "Wed Mar 13 2024 10:31:22 GMT+0000 (Coordinated Universal Time)"
updatedAt: "Thu Mar 14 2024 09:24:51 GMT+0000 (Coordinated Universal Time)"
---
Composio offers a variety of tools that can be integrated and utilized by your agents to perform actions.

Example:
The GitHub tool can be integrated into your agent to perform various actions, such as starring a GitHub repository.

## Search Tools based on your need
<Tabs>
<Tab title="Software Tools">
Triggers & Actions for 100+ widely used software applications.
<AccordionGroup title="Category of application">
<Accordion title="Devtools">
Tools specifically designed to aid software development and deployment.
- [GitHub](https://app.composio.dev/app/github)
- [GitLab](/apps/gitlab)
- [Bitbucket](/apps/bitbucket)

Want to see all the tools? [visit](https://app.composio.dev/apps?category=all)
</Accordion>
<Accordion title="Social">
Tools to manage and engage with social media platforms.
- [Discord](https://app.composio.dev/app/discord)
- [Youtube](https://app.composio.dev/app/youtube)
- [Slack](https://app.composio.dev/app/slack)
- [Spotify](https://app.composio.dev/app/spotify)

Want to see all the tools? [visit](https://app.composio.dev/apps?category=all)
</Accordion>
<Accordion title="Productivity">
Tools that enhance efficiency and help agents manage their tasks more effectively.
- [Slack](https://app.composio.dev/app/slack)
- [Notion](https://app.composio.dev/app/notion)
- [Trello](https://app.composio.dev/app/trello)
- [Asana](https://app.composio.dev/app/asana)

Want to see all the tools? [visit](https://app.composio.dev/apps?category=all)
</Accordion>
<Accordion title="Google Apps">
Integration with Google services to leverage their functionality within Composio.
- [Gmail](https://app.composio.dev/app/gmail)
- [Calendar](https://app.composio.dev/app/googlecalendar)
- [Docs](https://app.composio.dev/app/googledocs)
- [Sheets](https://app.composio.dev/app/googlesheets)
- [Drive](https://app.composio.dev/app/googledrive)
- [Meet](https://app.composio.dev/app/googlemeet)
- [Youtube](https://app.composio.dev/app/youtube)

Want to see all the tools? [visit](https://app.composio.dev/apps?category=all)
</Accordion>
</AccordionGroup>
</Tab>
<Tab title="Search Tools">
- [Perplexity](/apps/perplexity)
- [Exa](https://app.composio.dev/app/exa)
- [Serp-api](https://app.composio.dev/app/serpapi)

Want to see all the tools? [visit](https://app.composio.dev/apps?category=all)
</Tab>

<Tab title="Code Interpreter">
- [Shell Management](https://app.composio.dev/app/codeinterpreter)
- [Package Management](https://app.composio.dev/app/codeinterpreter)
- [Execution Sandbox](https://app.composio.dev/app/codeinterpreter)
- [Code](https://app.composio.dev/app/codeinterpreter)
- [Testing](https://app.composio.dev/app/codeinterpreter)

Want to see all the tools? [visit](https://app.composio.dev/apps?category=all)
</Tab>

<Tab title="System Tools">
- [Filemanager](https://app.composio.dev/app/filemanager)
- [Database](https://app.composio.dev/app/snowflake)
- [Redis]()

Want to see all the tools? [visit](https://app.composio.dev/apps?category=all)
</Tab>

<Tab title="RAG Tools">
- [Add a document]()
- [delete a document]()
- [search across all documents]()

Want to see all the tools? [visit](https://app.composio.dev/apps?category=all)
</Tab>
</Tabs>





## 🌐 All Apps
Discover all the applications we support.
Expand Down
2 changes: 1 addition & 1 deletion guides/examples/Example.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ icon: "book"
description: "The Composio coding guides contain in-depth examples and code.
These examples can be used as reference to better understand the core principles and applications of composio."
---
Here are some of the beginner friendly examples with which you can get started:
Here are some of the beginner friendly examples with you which can get started:
<CardGroup cols={2}>
<Card title="Investment Analyst" icon="money-bill-trend-up" href="https://git.new/investment-analyst">

Expand Down
5 changes: 4 additions & 1 deletion guides/examples/calendar-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ This project is an example which uses Composio to seamlessly convert your to-do

<Steps>
<Step title="Run the `setup.sh` file">
> Fork and Clone this [repository](git.new/composio), Navigate to the Project Directory
> Fork and Clone this [repository](git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/calendar_agent`


Make the setup.sh Script Executable (if necessary): On Linux or macOS, you might need to make the setup.sh script executable:
<CodeGroup>
Expand Down
4 changes: 3 additions & 1 deletion guides/examples/commit-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ This project is an example which uses Composio to help you keep your GitHub repo

<Steps>
<Step title="Run the `setup.sh` file">
> Fork and Clone this [repository](git.new/composio), Navigate to the Project Directory
> Fork and Clone this [repository](git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/commit_agent`

Make the setup.sh Script Executable (if necessary): On Linux or macOS, you might need to make the setup.sh script executable:
<CodeGroup>
Expand Down
4 changes: 3 additions & 1 deletion guides/examples/competitor-researcher.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ This project uses Composio to automate the creation and management of competitor

<Steps>
<Step title="Run the `setup.sh` file">
> Fork and Clone this [repository](git.new/composio), Navigate to the Project Directory
> Fork and Clone this [repository](git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/competitor_researcher`

Make the setup.sh Script Executable (if necessary): On Linux or macOS, you might need to make the setup.sh script executable:
<CodeGroup>
Expand Down
4 changes: 3 additions & 1 deletion guides/examples/investment-analyst.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ This project involves setting up and running a system of agents to conduct inves

<Steps>
<Step title="Run the `setup.sh` file">
> Fork and Clone this [repository](git.new/composio), Navigate to the Project Directory
> Fork and Clone this [repository](git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/investment_analyst`

Make the setup.sh Script Executable (if necessary): On Linux or macOS, you might need to make the setup.sh script executable:
<CodeGroup>
Expand Down
4 changes: 3 additions & 1 deletion guides/examples/news-summary.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ retrieves the latest news articles and generates summaries using Langchain and C

<Steps>
<Step title="Run the `setup.sh` file">
> Fork and Clone this [repository](git.new/composio), Navigate to the Project Directory
> Fork and Clone this [repository](git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/news_summary`

Make the setup.sh Script Executable (if necessary): On Linux or macOS, you might need to make the setup.sh script executable:
<CodeGroup>
Expand Down
4 changes: 3 additions & 1 deletion guides/examples/research-assistant.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ description: "This guide provides detailed steps to create a research assistant

<Steps>
<Step title="Run the `setup.sh` file">
> Fork and Clone this [repository](git.new/composio), Navigate to the Project Directory
> Fork and Clone this [repository](git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/research_assistant`

Make the setup.sh Script Executable (if necessary): On Linux or macOS, you might need to make the setup.sh script executable:
<CodeGroup>
Expand Down
169 changes: 169 additions & 0 deletions guides/examples/sql-agent.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
---
title: "SQL Agent"
sidebarTitle: "SQL Agent"
icon: "database"
description: "This guide provides detailed steps to create an agent that leverages
Composio to perform SQL queries and file operations to perform sql queries and
File operations and plot insightful graphs on the data in the db"
---

This project involves setting up and running a system of agents to conduct SQL queries, write the output to a file, and plot graphs based on the data. We use Composio to set up the tools and OpenAI GPT-4o to power the agents. Follow this guide to set up and run the project.

<Steps>
<Step title="Setup Environment and Install Dependencies">
> Ensure you have a `.env` file with your OpenAI and Composio API keys.
```bash
# Install the required packages
pip install dotenv composio_langchain langchain_openai
```

Fill in the `.env` file with your API keys:
```
OPENAI_API_KEY=your_openai_api_key
COMPOSIO_API_KEY=your_composio_api_key
```
</Step>

<Step title="Imports and Environment Setup">
In your Python script, import the necessary libraries and set up your environment variables.
<CodeGroup>
```python
import os
import dotenv
from composio_langchain import App, ComposioToolSet
from langchain import hub
from langchain.agents import AgentExecutor, create_openai_functions_agent
from langchain_openai import ChatOpenAI
# Load environment variables
dotenv.load_dotenv()
```
</CodeGroup>
</Step>

<Step title="Initialize Language Model and Define Tools">
Initialize the language model with OpenAI API key and model name, and set up the necessary tools for the agents.
<CodeGroup>
```python
# Initialize the LLM with the OpenAI GPT-4o model and API key
llm = ChatOpenAI(model="gpt-4o", openai_api_key=os.getenv("OPENAI_API_KEY"))
# Initialize the Composio ToolSet with the API key
composio_toolset = ComposioToolSet(api_key=os.getenv("COMPOSIO_API_KEY"))
# Get tools for SQL and File operations
sql_file_tool = composio_toolset.get_tools(apps=[App.SQLTOOL, App.FILETOOL])
# Get tools for SQL, File, and Code Interpreter operations
tools = composio_toolset.get_tools(apps=[App.SQLTOOL, App.FILETOOL, App.CODEINTERPRETER])
```
</CodeGroup>
</Step>

<Step title="Define the Task and Execute SQL Query">
Define the task to execute a SQL query and write the output to a file.
<CodeGroup>
```python
# Pull the prompt template for the agent
prompt = hub.pull("hwchase17/openai-functions-agent")
# Define the task to execute
query_task = (
"Write sqlite query to get top 10 rows from the only table MOCK_DATA "
"and database company.db using sqltool, write the output in a file called log.txt and return the output"
)
# Create the agent for SQL and File operations and execute the task
query_agent = create_openai_functions_agent(llm, sql_file_tool, prompt)
agent_executor = AgentExecutor(agent=query_agent, tools=sql_file_tool, verbose=True)
res = agent_executor.invoke({"input": query_task})
```
</CodeGroup>
</Step>

<Step title="Define and Execute Code Interpreter Task">
Create and execute the agent for Code Interpreter operations to plot a graph based on the extracted data.
<CodeGroup>
```python
# Create the agent for Code Interpreter operations
code_tool = composio_toolset.get_tools(apps=[App.CODEINTERPRETER])
code_agent = create_openai_functions_agent(llm, code_tool, prompt)
agent_executor = AgentExecutor(agent=code_agent, tools=code_tool, verbose=True)
# Define the task for plotting graphs
plot_task = (
"Using the following extracted information, plot the graph between first name and salary: "
+ res["output"]
)
# Execute the plotting task
final_res = agent_executor.invoke({"input": plot_task})
```
</CodeGroup>
</Step>

</Steps>

## Putting it All Together
<CodeGroup>
```python
import os
import dotenv
from composio_langchain import App, ComposioToolSet
from langchain import hub
from langchain.agents import AgentExecutor, create_openai_functions_agent
from langchain_openai import ChatOpenAI
# Load environment variables
dotenv.load_dotenv()
# Initialize the LLM with the OpenAI GPT-4o model and API key
llm = ChatOpenAI(model="gpt-4o", openai_api_key=os.getenv("OPENAI_API_KEY"))
# Initialize the Composio ToolSet with the API key
composio_toolset = ComposioToolSet(api_key=os.getenv("COMPOSIO_API_KEY"))
# Get tools for SQL and File operations
sql_file_tool = composio_toolset.get_tools(apps=[App.SQLTOOL, App.FILETOOL])
# Get tools for SQL, File, and Code Interpreter operations
tools = composio_toolset.get_tools(apps=[App.SQLTOOL, App.FILETOOL, App.CODEINTERPRETER])
# Pull the prompt template for the agent
prompt = hub.pull("hwchase17/openai-functions-agent")
# Define the task to execute
query_task = (
"Write sqlite query to get top 10 rows from the only table MOCK_DATA "
"and database company.db using sqltool, write the output in a file called log.txt and return the output"
)
# Create the agent for SQL and File operations and execute the task
query_agent = create_openai_functions_agent(llm, sql_file_tool, prompt)
agent_executor = AgentExecutor(agent=query_agent, tools=sql_file_tool, verbose=True)
res = agent_executor.invoke({"input": query_task})
# Create the agent for Code Interpreter operations
code_tool = composio_toolset.get_tools(apps=[App.CODEINTERPRETER])
code_agent = create_openai_functions_agent(llm, code_tool, prompt)
agent_executor = AgentExecutor(agent=code_agent, tools=code_tool, verbose=True)
# Define the task for plotting graphs
plot_task = (
"Using the following extracted information, plot the graph between first name and salary: "
+ res["output"]
)
# Execute the plotting task
final_res = agent_executor.invoke({"input": plot_task})
# Print the final result
print(final_res)
```

</CodeGroup>

## Link to the Source Code
- [GitHub]()

34 changes: 27 additions & 7 deletions introduction/foundations/basic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,41 @@ Let's get you started building with Composio! You should be familiar with core c

Goal of this section is to give you a brief walkthrough of each component and how they go together.

## Quick 2 min Videos explaining each components:
* [Integrations]()
* [Actions]()
* [Triggers]()
* [Entity]()
<CardGroup cols={3}>
<Card title="Integrations" icon="plug" href="./components/integrations/integration-guide">
</Card>

<Card title="Entity" icon="users" href="./components/entity/entity-guide">
</Card>

<Card title="Connected Accounts" icon="plug" href="./components/integrations/connected-account">
</Card>

<Card title="Actions" icon="wand-magic-sparkles" href="./components/actions/action-guide">
</Card>

<Card title="Triggers" icon="webhook" href="./components/triggers/trigger-guide">
</Card>

<Card title="Custom Actions" icon="code" href="./components/actions/local-code">
</Card>

<Card title="Custom Tools" icon="puzzle-piece" href="./components/integrations/custom-integration">
</Card>
</CardGroup>

| Component | Description | Examples |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| Tools | Tools refer to the various applications or tools that can be integrated and used by your agents via Composio. | Shell manager, Hubspot, Github, Slack & many others |
| Integrations | Integrations are tool configurations (eg. Permissions to ask for when connecting an account, ClientID/Secret in the case of OAuth) that will be used to connect your users account to Composio. You can use your own configuration or use Composio's default integrations. | Github Integration that requires repo permission & User data (ex. 1). Linear Integration requiring API Key (2). Linear Integration using Oauth (3) |
| Entity | Entity is a catch all term for your users who can be individuals, entities, teams, organisations. Composio manages authentication at `Entity` level. | Melissa, Sam, ABC Corp, etc |
| ConnectedAccounts | Connected accounts represent connections between your app and third-party platforms. They are user-specific instances of integrations, storing credentials and specific configuration details. | Melissa's Github account after completing auth with integration, Similarly Sam's Hubspot account. |
| Tools | Tools refer to the various applications or tools that can be integrated and used by your agents via Composio. | Shell manager, Hubspot, Github, Slack & many others |
| Actions | Actions are tasks that can be performed by your agents. ex. `send email via gmail` | Send email via Gmail, Send email via Outlook, Send email via Sendgrid, etc |
| Triggers | Triggers are predefined conditions that, when met, initiate webhooks to your agents. | New Github Issue, New Github Pull Request, New Github Release, New Hubspot Ticket, New Hubspot Case, etc |
| Entity | Entity is a catch all term for your users who can be individuals, entities, teams, organisations. Composio manages authentication at `Entity` level. | Melissa, Sam, ABC Corp, etc |


In next few pages, we can go through each component in detail. They will explain how to use each component in the code and what the expected flow should look like.



If you prefer something quicker, checkout [Quickstart Guide](../intro/quickstart)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "🔧 Crafting Custom Integrations"
sidebarTitle: "Custom Integrations"
title: "🔧 Crafting Custom Tools"
sidebarTitle: "Custom Tools"
icon: "puzzle-piece"
description: "Explore the process of creating custom integrations with external Apps"
---
Expand Down
Loading

0 comments on commit 55f639c

Please sign in to comment.