From c2bbb5ff3e79eb9bb0aec07068e535b7567c73ea Mon Sep 17 00:00:00 2001 From: abhishekpatil4 Date: Tue, 7 Jan 2025 15:55:28 +0530 Subject: [PATCH 01/10] feat: add ComposioToolSet details to docs --- docs/introduction/intro/quickstart-tools.mdx | 29 +++++------ .../intro/quickstart-triggers.mdx | 26 +++++----- docs/patterns/tools/what-are-tools.mdx | 50 +++++++++++++++++-- 3 files changed, 72 insertions(+), 33 deletions(-) diff --git a/docs/introduction/intro/quickstart-tools.mdx b/docs/introduction/intro/quickstart-tools.mdx index f4de5375de9..a1dde9f9d3d 100644 --- a/docs/introduction/intro/quickstart-tools.mdx +++ b/docs/introduction/intro/quickstart-tools.mdx @@ -4,8 +4,18 @@ sidebarTitle: "Quick Start - Tools" description: "Learn how to use Tools in less than 5 minutes" --- -## Composio Quick Start -In this guide we'll use GitHub tools to star a repo on GitHub. +## Star A Repository on GitHub +In this guide, we'll: + +1. 🔐 Connect your GitHub account with Composio +2. 🛠 Fetch GitHub actions +3. 🧠 Pass these actions to an LLM +4. ⭐ Instruct to star the `composiohq/composio` repository +5. ✅ Execute the action + + +**Tools** represent a group of actions specific to an app. **Actions** are operations you can perform - like starring a repo on GitHub or creating an issue in Linear. + @@ -21,7 +31,7 @@ pip install composio_core composio_openai -We'll use **`default`** as the user id [(entity id)](../../patterns/Auth/connected_account#entities). +We'll use **`default`** as the user id, also known as [entity id](../../patterns/Auth/connected_account#entities). You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf) ```shell CLI @@ -171,19 +181,6 @@ print(result) - -## What Just Happened? 🎉 - -Congratulations! You've just: - -1. 🔐 Connected your GitHub account with Composio -2. 🛠 Fetched GitHub actions -3. 🧠 Passed these actions to an AI language model -4. ⭐ Instructed the AI to star the `composiohq/composio` repository -5. ✅ Successfully executed the action on GitHub - -
- ## Next Steps Now that you've seen how to use tools, you can explore the following resources: diff --git a/docs/introduction/intro/quickstart-triggers.mdx b/docs/introduction/intro/quickstart-triggers.mdx index 3a58a650de5..ea4dbc6cb10 100644 --- a/docs/introduction/intro/quickstart-triggers.mdx +++ b/docs/introduction/intro/quickstart-triggers.mdx @@ -4,8 +4,17 @@ sidebarTitle: "Quick Start - Triggers" description: "Learn how to use Triggers in less than 5 minutes" --- -## Composio Quick Start -In this guide we'll configure and enable a trigger to listen to new emails in Gmail & configure an agent to add important label to emails that contains details about bank transactions. +## Listen to New Emails in Gmail +In this guide, we'll: + +1. 🔐 Connect your Gmail account with Composio +2. 🛠 Enable Triggers to listen to new emails in Gmail +3. 🧠 Pass these triggers event payloads to an AI language model to identify bank transactions +4. ⭐ Execute an action from Gmail tool to add **important** label to relevant emails + + +**Tools** represent a group of actions specific to an app. **Actions** are operations you can perform - like starring a repo on GitHub or creating an issue in Linear. + @@ -18,7 +27,7 @@ pip install composio-core composio_openai -We'll use **`Jessica`** as the user id [(entity id)](../../patterns/Auth/connected_account#entities). +We'll use **`default`** as the user id, also known as [entity id](../../patterns/Auth/connected_account#entities). You need to have an active Gmail Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf) ```shell CLI @@ -115,7 +124,7 @@ npm install composio-core openai -We'll use **`Jessica`** as the user id [(entity id)](../../patterns/Auth/connected_account#entities). +We'll use **`default`** as the user id [(entity id)](../../patterns/Auth/connected_account#entities). You need to have an active Gmail Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf) @@ -216,16 +225,7 @@ toolset.triggers.subscribe( -## What Just Happened? 🎉 - -Congratulations! You've just: - -1. 🔐 Connected your Gmail account with Composio -2. 🛠 Enabled Triggers -3. 🧠 Passed these triggers event payloads to an AI language model -4. ⭐ Executed an action from Gmail tool -
## Next Steps Now that you've seen how to use triggers, you can explore the following resources: diff --git a/docs/patterns/tools/what-are-tools.mdx b/docs/patterns/tools/what-are-tools.mdx index a9fa6d2bb2a..f83a64c8da1 100644 --- a/docs/patterns/tools/what-are-tools.mdx +++ b/docs/patterns/tools/what-are-tools.mdx @@ -30,9 +30,38 @@ LLM's thinking process: ### Tool calling with Composio -At Composio, we offer tools for multiple platforms, accessible via Python and JavaScript SDKs. These platforms, referred to as **Apps** or **Tools**, include popular services like GitHub, Twitter, Salesforce, Jira, and Notion. Within each of these Apps, we provide **Actions**, which are essentially functions that can be executed. For example, you can send an email on Gmail, star a repository on GitHub, or create an issue on Jira. These tools can also be used directly, similar to function calls, without needing agents. - - +At Composio, tools are offered for multiple platforms, accessible via Python and JavaScript SDKs. These platforms, referred to as **Apps** or **Tools**, include popular services like GitHub, Twitter, Salesforce, Jira, and Notion. Within each of these Apps, we provide **Actions**, which are essentially functions that can be executed. For example, you can send an email on Gmail, star a repository on GitHub, or create an issue on Jira. These tools can also be used directly, similar to function calls, without needing agents. + + +Use the `ComposioToolSet` class to use and configure tools: +- Use `composio-core` package for direct action execution +- Use framework-specific packages (like `composio-langchain` or `composio-crewai`) when working with Agentic frameworkswhat + +See all supported frameworks [here](../../framework/autogen). + +### Arguments Accepted by ComposioToolSet + +#### Basic Uscase: +- `api_key`: Composio API key. Get your API key [here](https://app.composio.dev/developers) +- `entity_id`: The ID of the entity to execute the action on. Defaults to **default** +- `connected_account_ids`: Use this to define connected accounts to use when executing an action for a specific app + +#### Extensive Usecase: +- `output_dir`: Directory path to store downloaded files +- `metadata`: Additional metadata for executing an action. Learn more [here](use-tools/configure-tools) +- `processors`: Request and response processors, use these to pre-process requests before executing an action and post-process the response after an action has been executed. Learn more [here](use-tools/processing-actions) +- `logging_level`: Accepted values: CRITICAL, FATAL, ERROR, WARNING, WARN, INFO, DEBUG +- `verbosity_level`: This defines the size of the log object that will be printed on the console. + +#### Advanced Usecase: +- `base_url`: Base URL for the Composio API server +- `output_in_file`: Whether to output the result to a file. +- `workspace_id`: Workspace ID for loading an existing workspace +- `workspace_config`: +- `max_retries`: +- `**kwargs`: Additional arguments for advanced use cases. + +#### Getting Tools ```python Python from composio_langchain import ComposioToolSet, Action, App @@ -44,6 +73,18 @@ tools = tool_set.get_tools(apps=[App.GITHUB]) # Get specific actions tools = tool_set.get_tools(actions=[Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER]) ``` + + +Tools and Actions are available through different toolset classes: +- Use `ComposioToolSet` for direct action execution +- Use framework-specific classes like `OpenAIToolSet` or `LangchainToolSet` when working with OpenAI, LangChain or other [frameworks](../../framework/autogen). + +#### Basic Uscase: +- `apiKey`: Composio API key. Get your API key [here](https://app.composio.dev/developers) +- `entityId`: The ID of the entity to execute the action on. Defaults to **default** + +#### Advanced Usecase: +- `baseUrl`: Base URL for the Composio API server ```javascript JavaScript import { LangchainToolSet } from "composio-core"; @@ -56,7 +97,8 @@ const tools = await composioToolset.getTools({ apps: ["github"] }); // Get specific actions const tools = await composioToolset.getTools({ actions: ["github_star_a_repository_for_the_authenticated_user"] }); ``` - + + ### Action Types From b2632bfa1d73e32981792925b2d950594f5a149a Mon Sep 17 00:00:00 2001 From: abhishekpatil4 Date: Tue, 7 Jan 2025 16:08:09 +0530 Subject: [PATCH 02/10] fix: phiData docs --- docs/framework/phidata.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/phidata.mdx b/docs/framework/phidata.mdx index 50794aa2d12..3d240d4b9da 100644 --- a/docs/framework/phidata.mdx +++ b/docs/framework/phidata.mdx @@ -16,7 +16,7 @@ pip install composio-phidata ```python Python from phi.assistant import Assistant -from composio_phidata import Action, ComposioToolSet +from composio_phidata import Action, App, ComposioToolSet toolset = ComposioToolSet() ``` From 8d77b4b0be160f08835a60cb2897f5cad9690060 Mon Sep 17 00:00:00 2001 From: abhishekpatil4 Date: Tue, 7 Jan 2025 17:06:54 +0530 Subject: [PATCH 03/10] feat: add packages installation snippets to docs --- .../custom-action-without-auth.mdx | 13 ++++++++-- .../use-tools/action-guide-with-agents.mdx | 24 ++++++++++++++++++- .../use-tools/action-guide-without-agents.mdx | 11 +++++++++ .../tools/use-tools/configure-tools.mdx | 5 ++++ .../tools/use-tools/get-action-inputs.mdx | 13 +++++++++- .../tools/use-tools/processing-actions.mdx | 10 ++++++++ .../use-tools/use-tools-with-your-auth.mdx | 9 +++++++ docs/patterns/triggers/triggers.mdx | 14 +++++++++-- 8 files changed, 93 insertions(+), 6 deletions(-) diff --git a/docs/patterns/tools/build-tools/custom-action-without-auth.mdx b/docs/patterns/tools/build-tools/custom-action-without-auth.mdx index 6cf05ed7b53..fcfaa373721 100644 --- a/docs/patterns/tools/build-tools/custom-action-without-auth.mdx +++ b/docs/patterns/tools/build-tools/custom-action-without-auth.mdx @@ -11,8 +11,17 @@ Custom Actions are powerful building blocks that enable you to create custom fun ## Creating a Custom Tool without Authentication - - + + +```bash Python +pip install composio-openai openai +``` +```bash JavaScript +npm install composio-core openai +``` + + + ```python Python from composio_openai import ComposioToolSet, action diff --git a/docs/patterns/tools/use-tools/action-guide-with-agents.mdx b/docs/patterns/tools/use-tools/action-guide-with-agents.mdx index 5becbfaecb1..608a72c4604 100644 --- a/docs/patterns/tools/use-tools/action-guide-with-agents.mdx +++ b/docs/patterns/tools/use-tools/action-guide-with-agents.mdx @@ -8,7 +8,17 @@ description: "Guide to using Tools with LLMs" Composio enables you to integrate various tools (such as Gmail, GitHub, and Salesforce) and perform actions (such as sending emails or creating GitHub issues). Browse our complete list of supported [Tools](https://app.composio.dev/apps). -Here's how to use Tools with LLMs: +Install packages: + +```bash Python +pip install composio-openai openai +``` +```bash JavaScript +npm install composio-core openai +``` + + +Using tools with LLMs: ```python Python # Import required libraries @@ -73,6 +83,18 @@ This code demonstrates how to use LLMs with Composio Tools to execute actions. T ### How can I use Tools for a specific user? You can use the `entity_id` parameter to specify the user on behalf of whom you want to execute the action. Learn more about Entities [here](/patterns/Auth/connected_account#entities). + +Install packages: + +```bash Python +pip install composio-openai openai +``` +```bash JavaScript +npm install composio-core openai +``` + + +Using tools for a specific user: ```python Python {7} # Import required libraries diff --git a/docs/patterns/tools/use-tools/action-guide-without-agents.mdx b/docs/patterns/tools/use-tools/action-guide-without-agents.mdx index c1887a54426..ea07da3296a 100644 --- a/docs/patterns/tools/use-tools/action-guide-without-agents.mdx +++ b/docs/patterns/tools/use-tools/action-guide-without-agents.mdx @@ -8,6 +8,17 @@ description: "Guide to use Tools directly as function calls" Composio allows you to execute tools directly as function calls. When calling a tool directly, you'll need to provide the input parameters. Checkout [Get Action Schema](/patterns/tools/use-tools/get-action-inputs) to learn how to get the input parameters for an action. +Install packages: + +```bash Python +pip install composio-core +``` +```bash JavaScript +npm install composio-core +``` + + +Using tools directly: ```python Python from composio import ComposioToolSet, Action diff --git a/docs/patterns/tools/use-tools/configure-tools.mdx b/docs/patterns/tools/use-tools/configure-tools.mdx index 9ac4d69cd65..975f985e924 100644 --- a/docs/patterns/tools/use-tools/configure-tools.mdx +++ b/docs/patterns/tools/use-tools/configure-tools.mdx @@ -14,6 +14,11 @@ When setting up Composio tools, you might need to provide various configuration For example, if you're using the Image Analyzer tool, you'll need to provide an OpenAI API key. Similarly, other tools might require their own specific configuration parameters to function properly. + +```bash Python +pip install langchain langchain-openai composio-langchain +``` + ```python Python diff --git a/docs/patterns/tools/use-tools/get-action-inputs.mdx b/docs/patterns/tools/use-tools/get-action-inputs.mdx index dd4db050400..ac78ec39879 100644 --- a/docs/patterns/tools/use-tools/get-action-inputs.mdx +++ b/docs/patterns/tools/use-tools/get-action-inputs.mdx @@ -13,6 +13,17 @@ When executing actions without agents, you'll need to provide the input paramete +Install packages: + +```bash Python +pip install composio-openai +``` +```bash JavaScript +npm install composio-core +``` + + +Import libraries & get action schema: ```python Python from composio import ComposioToolSet, Action @@ -27,7 +38,7 @@ action_schema = composio_toolset.get_action_schemas(actions=[Action.GITHUB_STAR_ print(json.dumps(action_schema[0].parameters.properties, indent=2)) ``` -```javascript Javascript +```javascript JavaScript import { OpenAIToolSet } from "composio-core"; const composio_toolset = new OpenAIToolSet(); diff --git a/docs/patterns/tools/use-tools/processing-actions.mdx b/docs/patterns/tools/use-tools/processing-actions.mdx index 29a85a9049e..67112a54761 100644 --- a/docs/patterns/tools/use-tools/processing-actions.mdx +++ b/docs/patterns/tools/use-tools/processing-actions.mdx @@ -23,6 +23,11 @@ These can be applied at two levels: + +```bash Python +pip install langchain langchain-openai composio-langchain +``` + ```python Python from langchain.agents import create_openai_functions_agent, AgentExecutor @@ -101,6 +106,11 @@ agent_executor.invoke({"input": task}) + +```bash TypeScript +npm install composio-core @langchain/openai langchain @langchain/core +``` + ```typescript TypeScript import { ActionExecutionResDto, LangchainToolSet, RawActionData, TPostProcessor, TPreProcessor, TSchemaProcessor } from "composio-core"; diff --git a/docs/patterns/tools/use-tools/use-tools-with-your-auth.mdx b/docs/patterns/tools/use-tools/use-tools-with-your-auth.mdx index d6293c6d0c6..f7b1c079acb 100644 --- a/docs/patterns/tools/use-tools/use-tools-with-your-auth.mdx +++ b/docs/patterns/tools/use-tools/use-tools-with-your-auth.mdx @@ -10,6 +10,11 @@ Composio allows you to [execute actions directly](action-guide-without-agents) u +Install packages: +```bash +pip install composio-core +``` + Use the `add_auth` method to add the existing authentication to the toolset for the app you want to use. `in_` is where you want to add the auth, `name` is the name of the header you want to add and `value` is the value of the header. ```python {7-13} from composio import ComposioToolSet, App @@ -34,6 +39,10 @@ toolset.execute_action( ``` +Install packages: +```bash +npm install composio-core +``` Here you need to pass the authentication parameters inside the `authConfig`. `in_` is where you want to add the auth, `name` is the name of the header you want to add and `value` is the value of the header. ```javascript {10-14} import { OpenAIToolSet } from "composio-core"; diff --git a/docs/patterns/triggers/triggers.mdx b/docs/patterns/triggers/triggers.mdx index 9859342d5fa..861dc723727 100644 --- a/docs/patterns/triggers/triggers.mdx +++ b/docs/patterns/triggers/triggers.mdx @@ -31,7 +31,12 @@ composio triggers disable 818bd52e-c5... - + +```bash Python +pip install composio-core +``` + + ```python from composio import ComposioToolSet, App ``` @@ -87,7 +92,12 @@ entity.disable_trigger("818bd52e-c5...") - + +```bash JavaScript +npm install composio-core +``` + + ```javascript import { ComposioToolSet } from "composio-core"; const toolset = new ComposioToolSet(); From e16703031d89141526e993a6d61f41ffc0ed38d0 Mon Sep 17 00:00:00 2001 From: abhishekpatil4 Date: Tue, 7 Jan 2025 18:03:49 +0530 Subject: [PATCH 04/10] feat: add get tools & actions snippets to docs --- .../list_of_tools.mdx | 34 +++------- docs/patterns/tools/what-are-tools.mdx | 67 +++++++++++++++++-- 2 files changed, 70 insertions(+), 31 deletions(-) diff --git a/docs/faq/integrations_and_connections/list_of_tools.mdx b/docs/faq/integrations_and_connections/list_of_tools.mdx index 9ea674574d6..d3cf5c039a5 100644 --- a/docs/faq/integrations_and_connections/list_of_tools.mdx +++ b/docs/faq/integrations_and_connections/list_of_tools.mdx @@ -4,55 +4,41 @@ sidebarTitle: "Listing Tools & Actions" description: "This section will walk you through discovering and managing the tools, integrations, actions, and more." --- -### Listing All Tools - -You can list all available applications in Composio along with their logos, descriptions, and more. - - +### Listing All Apps (Tools) -```python Python Get all apps +```python Python from composio import ComposioToolSet toolset = ComposioToolSet() - -print(toolset.get_apps()) # Get all apps +print(toolset.get_apps()) ``` - -```javascript Javascript Get all apps +```javascript JavaScript import { Composio } from "composio-core"; const composio = new Composio(); -const apps = await composio.apps.list(); +console.log(await composio.apps.list()); ``` - -```bash CLI Get all apps +```bash CLI composio apps ``` - - -### Listing all Actions - -All actions supported by the Composio along with function signatures and parameter descriptions. - +### Listing All Actions -```python Python Get all actions +```python Python from composio import Composio client = Composio() print(client.actions.get(limit=10)) # print all actions supported ``` - -```javascript Javascript Get all actions +```javascript JavaScript import { Composio } from "composio-core"; const composio = new Composio(); const actions = await composio.actions.list({ data: { limit: 10 } }); console.log(actions); // print all actions supported ``` - -```bash CLI Get all actions +```bash CLI composio actions --limit 10 ``` \ No newline at end of file diff --git a/docs/patterns/tools/what-are-tools.mdx b/docs/patterns/tools/what-are-tools.mdx index f83a64c8da1..0ced88e4e3d 100644 --- a/docs/patterns/tools/what-are-tools.mdx +++ b/docs/patterns/tools/what-are-tools.mdx @@ -61,7 +61,14 @@ See all supported frameworks [here](../../framework/autogen). - `max_retries`: - `**kwargs`: Additional arguments for advanced use cases. -#### Getting Tools +#### Getting Tools & Actions + + +```bash Python +pip install composio-langchain +``` + + ```python Python from composio_langchain import ComposioToolSet, Action, App @@ -69,10 +76,9 @@ tool_set = ComposioToolSet() # Get all actions from a tool tools = tool_set.get_tools(apps=[App.GITHUB]) - -# Get specific actions -tools = tool_set.get_tools(actions=[Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER]) ``` + + Tools and Actions are available through different toolset classes: @@ -86,6 +92,13 @@ Tools and Actions are available through different toolset classes: #### Advanced Usecase: - `baseUrl`: Base URL for the Composio API server + + +```bash JavaScript +npm install composio-core +``` + + ```javascript JavaScript import { LangchainToolSet } from "composio-core"; @@ -93,10 +106,9 @@ const composioToolset = new LangchainToolSet(); // Get all actions from a tool const tools = await composioToolset.getTools({ apps: ["github"] }); - -// Get specific actions -const tools = await composioToolset.getTools({ actions: ["github_star_a_repository_for_the_authenticated_user"] }); ``` + + @@ -118,3 +130,44 @@ To optimize agent performance, it's essential to limit the number of actions ava 4. Implement custom filtering logic By carefully curating the action set, you can significantly improve agent efficiency and response quality. + +### Listing All Apps (Tools) +You can list all available tools in Composio along with their details in the following ways: + +```python Python +from composio import ComposioToolSet + +toolset = ComposioToolSet() +print(toolset.get_apps()) +``` +```javascript JavaScript +import { Composio } from "composio-core"; + +const composio = new Composio(); +console.log(await composio.apps.list()); +``` +```bash CLI +composio apps +``` + + +### Listing All Actions +You can list all available actions in Composio along with their details in the following ways: + +```python Python +from composio import Composio + +client = Composio() +print(client.actions.get(limit=10)) # print all actions supported +``` +```javascript JavaScript +import { Composio } from "composio-core"; +const composio = new Composio(); +const actions = await composio.actions.list({ data: { limit: 10 } }); + +console.log(actions); // print all actions supported +``` +```bash CLI +composio actions --limit 10 +``` + From 3b5e45bbbe4517deba565a91d12cccbcf40f130a Mon Sep 17 00:00:00 2001 From: abhishekpatil4 Date: Tue, 7 Jan 2025 18:43:50 +0530 Subject: [PATCH 05/10] feat: update Letta Code & standardize GitHub name --- docs/framework/autogen.mdx | 4 +- docs/framework/camelai.mdx | 4 +- docs/framework/crewai.mdx | 12 ++-- docs/framework/griptape.mdx | 4 +- docs/framework/groq.mdx | 8 +-- docs/framework/langchain.mdx | 6 +- docs/framework/langflow.mdx | 12 ++-- docs/framework/langgraph.mdx | 8 +-- docs/framework/letta.mdx | 113 +++++++++-------------------------- 9 files changed, 56 insertions(+), 115 deletions(-) diff --git a/docs/framework/autogen.mdx b/docs/framework/autogen.mdx index 893e45d82f4..ef4c51e7c93 100644 --- a/docs/framework/autogen.mdx +++ b/docs/framework/autogen.mdx @@ -4,8 +4,8 @@ sidebarTitle: "Autogen" description: "Integrate Composio with Autogen agents to let them seamlessly interact with external Apps" --- -## Star A Repository on Github -In this example, we will use Autogen Agent to star a repository on Github using Composio Tools +## Star A Repository on GitHub +In this example, we will use Autogen Agent to star a repository on GitHub using Composio Tools diff --git a/docs/framework/camelai.mdx b/docs/framework/camelai.mdx index 02d981284ea..f0fd10bfe8a 100644 --- a/docs/framework/camelai.mdx +++ b/docs/framework/camelai.mdx @@ -15,7 +15,7 @@ Ensure you have the necessary packages installed and connect your GitHub account ``` bash Run command pip install camel-ai pip install composio-camel -U - # Connect your Github so agents can use it. + # Connect your GitHub so agents can use it. composio add github # Check all different apps which you can connect with composio apps @@ -107,7 +107,7 @@ Execute the following code to execute the agent, ensuring that the intended task ```python CAMEL Agent Execution prompt = ( - "I have created a new Github Repo," + "I have created a new GitHub Repo," "Please star my github repository: camel-ai/camel" ) user_msg = BaseMessage.make_user_message(role_name="User", content=prompt) diff --git a/docs/framework/crewai.mdx b/docs/framework/crewai.mdx index 2d77f5d28e1..a7c5b4c80b4 100644 --- a/docs/framework/crewai.mdx +++ b/docs/framework/crewai.mdx @@ -4,8 +4,8 @@ sidebarTitle: "CrewAI" description: "Integrate Composio with CrewAI agents to let them seamlessly interact with external apps" --- -## Star A Repository on Github -In this example, we will use CrewAI Agent to star a repository on Github using Composio Tools +## Star A Repository on GitHub +In this example, we will use CrewAI Agent to star a repository on GitHub using Composio Tools @@ -24,7 +24,7 @@ llm = ChatOpenAI(api_key="") ``` - + You can get all the tools for a given app as shown below, but you can get **specific actions** and filter actions using **usecase** & **tags**. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) ```python Python @@ -36,9 +36,9 @@ tools = toolset.get_tools(apps=[App.GITHUB]) ```python Python crewai_agent = Agent( - role="Github Agent", - goal="You take action on Github using Github APIs", - backstory="You are AI agent that is responsible for taking actions on Github on behalf of users using Github APIs", + role="GitHub Agent", + goal="You take action on GitHub using GitHub APIs", + backstory="You are AI agent that is responsible for taking actions on GitHub on behalf of users using GitHub APIs", verbose=True, tools=tools, llm=llm, diff --git a/docs/framework/griptape.mdx b/docs/framework/griptape.mdx index 6a079408c8a..d50a9993828 100644 --- a/docs/framework/griptape.mdx +++ b/docs/framework/griptape.mdx @@ -12,12 +12,12 @@ description: "Integrate Composio with Griptape agents to let them seamlessly int ### Install Packages & Connect a Tool -These commands prepare your environment for seamless interaction between Griptape and Github. +These commands prepare your environment for seamless interaction between Griptape and GitHub. ``` bash Run command pip install composio_griptape - # Connect your Github so agents can use it. + # Connect your GitHub so agents can use it. composio add github # Check all different apps which you can connect with composio show-apps diff --git a/docs/framework/groq.mdx b/docs/framework/groq.mdx index 1797f90fd82..8c08cf43f76 100644 --- a/docs/framework/groq.mdx +++ b/docs/framework/groq.mdx @@ -12,14 +12,14 @@ description: "Integrate Composio with Groq to seamlessly interact with external ### Install Packages & Connect a Tool -These commands prepare your environment for seamless interaction between Groq and Github. +These commands prepare your environment for seamless interaction between Groq and GitHub. ```bash python pip install composio-langchain pip install langchain-groq - #Connect your Github so agents can use it + #Connect your GitHub so agents can use it composio add github #Check all different apps which you can connect with @@ -29,7 +29,7 @@ These commands prepare your environment for seamless interaction between Groq an npm install composio-core npm install langchain - // Connect your Github so agents can use it + // Connect your GitHub so agents can use it composio add github // Check all different apps which you can connect with @@ -75,7 +75,7 @@ These commands prepare your environment for seamless interaction between Groq an ``` - + ```python python # Import from composio_langchain diff --git a/docs/framework/langchain.mdx b/docs/framework/langchain.mdx index e2df547632b..ef6f3a8da61 100644 --- a/docs/framework/langchain.mdx +++ b/docs/framework/langchain.mdx @@ -4,8 +4,8 @@ sidebarTitle: "LangChain" description: "Integrate Composio with LangChain agents to let them seamlessly interact with external apps" --- -## Star A Repository on Github -In this example, we will use LangChain Agent to star a repository on Github using Composio Tools +## Star A Repository on GitHub +In this example, we will use LangChain Agent to star a repository on GitHub using Composio Tools @@ -41,7 +41,7 @@ const toolset = new LangchainToolSet(); - + You can get all the tools for a given app as shown below, but you can get **specific actions** and filter actions using **usecase** & **tags**. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) ```python Python diff --git a/docs/framework/langflow.mdx b/docs/framework/langflow.mdx index ebdd1497ec0..18718d085c1 100644 --- a/docs/framework/langflow.mdx +++ b/docs/framework/langflow.mdx @@ -4,8 +4,8 @@ sidebarTitle: "LangFlow" description: "Use Composio with LangFlow to create LLM agents that can interact with external apps" --- -## Star A Repository on Github -In this example, we will use LangFlow to star a repository on Github using Composio Tools +## Star A Repository on GitHub +In this example, we will use LangFlow to star a repository on GitHub using Composio Tools @@ -14,14 +14,14 @@ Head over to the [LangFlow](https://astra.datastax.com/langflow) website, create -Go to your [Composio Dashboard](https://app.composio.dev/) and copy your API key, paste it in the API Key field in the Composio component and then search for Github in apps list and select it +Go to your [Composio Dashboard](https://app.composio.dev/) and copy your API key, paste it in the API Key field in the Composio component and then search for GitHub in apps list and select it - -Click on refresh button, a link to authenticate with Github will be generated (if you don't have connected Github account), click on it and authenticate + +Click on refresh button, a link to authenticate with GitHub will be generated (if you don't have connected GitHub account), click on it and authenticate -Most recent connected Github account with entity Id `default` will be considered for executing the action +Most recent connected GitHub account with entity Id `default` will be considered for executing the action diff --git a/docs/framework/langgraph.mdx b/docs/framework/langgraph.mdx index 7a33dd0a43b..953122c731f 100644 --- a/docs/framework/langgraph.mdx +++ b/docs/framework/langgraph.mdx @@ -4,8 +4,8 @@ sidebarTitle: "LangGraph" description: "Integrate Composio with LangGraph agents to let them seamlessly interact with external apps" --- -## Star A Repository on Github -In this example, we will use LangGraph Agent to star a repository on Github using Composio Tools +## Star A Repository on GitHub +In this example, we will use LangGraph Agent to star a repository on GitHub using Composio Tools @@ -150,7 +150,7 @@ for chunk in app.stream( "messages": [ ( "human", - "Star the Github Repository composiohq/composio", + "Star the GitHub Repository composiohq/composio", ) ] }, @@ -161,7 +161,7 @@ for chunk in app.stream( ```typescript TypeScript const stream = await app.invoke({ messages: [ - new HumanMessage("Star the Github Repository composiohq/composio"), + new HumanMessage("Star the GitHub Repository composiohq/composio"), ], }); diff --git a/docs/framework/letta.mdx b/docs/framework/letta.mdx index 27b31846a14..d8ed45e573b 100644 --- a/docs/framework/letta.mdx +++ b/docs/framework/letta.mdx @@ -1,108 +1,49 @@ --- title: "Using Composio With Letta" sidebarTitle: "Letta" -description: "Integrate Composio with Letta agents to let them seamlessly interact with external apps" +description: "Integrate Composio with Letta to let them seamlessly interact with external apps" --- -**Composio enables** your **Letta agents** to **connect** with many **tools**! - - - Goal: Star a repository on GitHub with natural language & Letta Agent - - -### Install Packages & Connect a Tool - -These commands prepare your environment for seamless interaction between Letta and GitHub. - - -```bash Run Command -pip install letta composio-langchain python-dotenv -``` - - -### Goal: Use Letta Agent to Interact with GitHub using Composio +## Star A Repository on GitHub +In this example, we will use Letta Agent to star a repository on GitHub using Composio Tools - -- Connect a user, Jessica's GitHub account, to allow our agents to utilize GitHub functionalities. - -```bash Authenticate GitHub Account -composio add github -e "Jessica" + +```bash Python +pip install composio_langchain letta ``` - - - - - - -```python Default Imports -import dotenv -from composio_langchain import Action, ComposioToolSet -from letta import create_client, LLMConfig -from letta.schemas.tool import Tool - -# Load environment variables from .env -# Set your OpenAI API Key in a .env file -dotenv.load_dotenv() -``` - - + +```bash Python +from letta import EmbeddingConfig, LLMConfig, create_client +from composio_langchain import Action - +client = create_client() - -```python Tools For GitHub -composio_tool = Tool.get_composio_tool(action=Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER) +# set automatic defaults for LLM/embedding config +client.set_default_llm_config(LLMConfig.default_config(model_name="gpt-4")) +client.set_default_embedding_config(EmbeddingConfig.default_config(model_name="text-embedding-ada-002")) ``` - - - + +You can get all the tools for a given app or specific actions as shown below. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) -```python Creating the Letta Agent -client = create_client() - -agent_state = client.create_agent( - name="GitHub Agent", +```python Python +composio_tool = client.load_composio_tool(Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER) +agent_state = client.create_agent() +client.add_tool_to_agent( + agent_id=agent_state.id, + tool_id=composio_tool.id ) - -client.add_tool(composio_tool) - -response = client.send_message(agent_id=agent_state.id, role="user", message="Star the repo composiohq/composio") -print("Usage:", response.usage) -print("Agent messages:", response.messages) ``` - - - - -```bash After Executing the Agent -Usage completion_tokens=62 prompt_tokens=2363 total_tokens=2425 step_count=1 -Agent messages [ - InternalMonologue(id='message-eff2fc99-437b-41b1-be3f-862aaabf5908', date=datetime.datetime(2024, 10, 4, 2, 25, 6, 417853, tzinfo=datetime.timezone.utc), - message_type='internal_monologue', internal_monologue='Interesting. Chad wants to discuss a repository. I should respond by asking about his interest in it. '), - FunctionCallMessage(id='message-eff2fc99-437b-41b1-be3f-862aaabf5908', - date=datetime.datetime(2024, 10, 4, 2, 25, 6, 417853, tzinfo=datetime.timezone.utc), - message_type='function_call', - function_call=FunctionCall(name='send_message', arguments='{\n "message": "It seems you\'re interested in the composiohq/composio repository. What particular aspects have piqued your curiosity, Chad?"\n}')), - FunctionReturn(id='message-e5c7d6ee-1dbe-4011-b952-47631282aadc', date=datetime.datetime(2024, 10, 4, 2, 25, 6, 418469, tzinfo=datetime.timezone.utc), message_type='function_return', - function_return='{\n "status": "OK",\n "message": "None",\n "time": "2024-10-04 02:25:06 AM UTC+0000"\n}', - status='success')] + +```python Python +response = client.send_message(agent_id=agent_state.id, role="user", message="Star the repo composiohq/composio") +print(response) ``` - - - -### Use Specific Actions - - ```bash Filter Specific Action - # To restrict agents from using all the actions, filter specific actions - composio_tool = Tool.get_composio_tool(action=Action.GITHUB_CREATE_ISSUE) - ``` - - + \ No newline at end of file From 8fa5d7bfc66f45e9a0f65bbfb134ee6b815008fd Mon Sep 17 00:00:00 2001 From: abhishekpatil4 Date: Tue, 7 Jan 2025 21:19:12 +0530 Subject: [PATCH 06/10] feat: add connect github snippets in frameworks --- docs/framework/autogen.mdx | 16 ++++++++++++ docs/framework/crewai.mdx | 17 +++++++++++++ docs/framework/langchain.mdx | 21 +++++++++++++++ docs/framework/langgraph.mdx | 48 +++++++++++++++++++++++++++-------- docs/framework/letta.mdx | 20 ++++++++++++++- docs/framework/litellm.mdx | 17 +++++++++++++ docs/framework/llamaindex.mdx | 21 +++++++++++++++ docs/framework/openai.mdx | 21 +++++++++++++++ docs/framework/phidata.mdx | 17 +++++++++++++ 9 files changed, 187 insertions(+), 11 deletions(-) diff --git a/docs/framework/autogen.mdx b/docs/framework/autogen.mdx index ef4c51e7c93..385b3e83cb2 100644 --- a/docs/framework/autogen.mdx +++ b/docs/framework/autogen.mdx @@ -29,6 +29,22 @@ llm_config = { } ``` + +You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf) + +```shell CLI +composio login +composio add github +``` +```python Python +request = toolset.initiate_connection(app=App.GITHUB) +print(f"Open this URL to authenticate: {request.redirectUrl}") +``` + + +Don't forget to set your `COMPOSIO_API_KEY` and `OPENAI_API_KEY` in your environment variables. + + You can get all the tools for a given app as shown below, but you can get **specific actions** and filter actions using **usecase** & **tags**. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) diff --git a/docs/framework/crewai.mdx b/docs/framework/crewai.mdx index a7c5b4c80b4..80c2f33f1e3 100644 --- a/docs/framework/crewai.mdx +++ b/docs/framework/crewai.mdx @@ -24,6 +24,23 @@ llm = ChatOpenAI(api_key="") ``` + +You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf) + +```shell CLI +composio login +composio add github +``` +```python Python +request = toolset.initiate_connection(app=App.GITHUB) +print(f"Open this URL to authenticate: {request.redirectUrl}") +``` + + +Don't forget to set your `COMPOSIO_API_KEY` and `OPENAI_API_KEY` in your environment variables. + + + You can get all the tools for a given app as shown below, but you can get **specific actions** and filter actions using **usecase** & **tags**. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) diff --git a/docs/framework/langchain.mdx b/docs/framework/langchain.mdx index ef6f3a8da61..2895ef04f91 100644 --- a/docs/framework/langchain.mdx +++ b/docs/framework/langchain.mdx @@ -41,6 +41,27 @@ const toolset = new LangchainToolSet(); + + You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf) + + ```shell CLI + composio login + composio add github + ``` + ```python Python + request = composio_toolset.initiate_connection(app=App.GITHUB) + print(f"Open this URL to authenticate: {request.redirectUrl}") + ``` + ```javascript JavaScript + const connection = await toolset.connectedAccounts.initiate({appName: "github"}) + console.log(`Open this URL to authenticate: ${connection.redirectUrl}`); + ``` + + + Don't forget to set your `COMPOSIO_API_KEY` and `OPENAI_API_KEY` in your environment variables. + + + You can get all the tools for a given app as shown below, but you can get **specific actions** and filter actions using **usecase** & **tags**. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) diff --git a/docs/framework/langgraph.mdx b/docs/framework/langgraph.mdx index 953122c731f..b400f59d943 100644 --- a/docs/framework/langgraph.mdx +++ b/docs/framework/langgraph.mdx @@ -21,8 +21,8 @@ npm i @langchain/core ``` - -You can get all the tools for a given app as shown below, but you can get **specific actions** and filter actions using **usecase** & **tags**. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) + + ```python Python from typing import Literal @@ -32,14 +32,6 @@ from langgraph.prebuilt import ToolNode from composio_langgraph import Action, ComposioToolSet, App composio_toolset = ComposioToolSet() -tools = composio_toolset.get_tools( - apps=[App.GITHUB] -) - -tool_node = ToolNode(tools) - -model = ChatOpenAI(temperature=0, streaming=True) -model_with_tools = model.bind_tools(tools) ``` ```typescript TypeScript import { LangGraphToolSet } from "composio-core"; @@ -49,7 +41,43 @@ import { StateGraph, END, MessagesAnnotation, START } from "@langchain/langgraph import { HumanMessage } from "@langchain/core/messages"; const composioToolset = new LangGraphToolSet(); +``` + + + + You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf) + + ```shell CLI + composio login + composio add github + ``` + ```python Python + request = composio_toolset.initiate_connection(app=App.GITHUB) + print(f"Open this URL to authenticate: {request.redirectUrl}") + ``` + ```javascript TypeScript + const connection = await composioToolset.connectedAccounts.initiate({appName: "github"}) + console.log(`Open this URL to authenticate: ${connection.redirectUrl}`); + ``` + + + Don't forget to set your `COMPOSIO_API_KEY` and `OPENAI_API_KEY` in your environment variables. + + + + +You can get all the tools for a given app as shown below, but you can get **specific actions** and filter actions using **usecase** & **tags**. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) + +```python Python +tools = composio_toolset.get_tools( + apps=[App.GITHUB] +) +tool_node = ToolNode(tools) +model = ChatOpenAI(temperature=0, streaming=True) +model_with_tools = model.bind_tools(tools) +``` +```typescript TypeScript const tools = await composioToolset.getTools({ apps: ["github"], }); diff --git a/docs/framework/letta.mdx b/docs/framework/letta.mdx index d8ed45e573b..e43d15c0782 100644 --- a/docs/framework/letta.mdx +++ b/docs/framework/letta.mdx @@ -16,7 +16,7 @@ pip install composio_langchain letta ```bash Python from letta import EmbeddingConfig, LLMConfig, create_client -from composio_langchain import Action +from composio_langchain import Action, ComposioToolSet client = create_client() @@ -26,6 +26,24 @@ client.set_default_embedding_config(EmbeddingConfig.default_config(model_name="t ``` + +You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf) + +```shell CLI +composio login +composio add github +``` +```python Python +toolset = ComposioToolSet() +request = toolset.initiate_connection(app=App.GITHUB) +print(f"Open this URL to authenticate: {request.redirectUrl}") +``` + + +Don't forget to set your `COMPOSIO_API_KEY` and `OPENAI_API_KEY` in your environment variables. + + + You can get all the tools for a given app or specific actions as shown below. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) diff --git a/docs/framework/litellm.mdx b/docs/framework/litellm.mdx index ee54d2a28fb..c6796826985 100644 --- a/docs/framework/litellm.mdx +++ b/docs/framework/litellm.mdx @@ -34,6 +34,23 @@ router = Router( ``` + +You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf) + +```shell CLI +composio login +composio add github +``` +```python Python +request = toolset.initiate_connection(app=App.GITHUB) +print(f"Open this URL to authenticate: {request.redirectUrl}") +``` + + +Don't forget to set your `COMPOSIO_API_KEY` and `OPENAI_API_KEY` in your environment variables. + + + You can get all the tools for a given app as shown below, but you can get **specific actions** and filter actions using **usecase** & **tags**. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) diff --git a/docs/framework/llamaindex.mdx b/docs/framework/llamaindex.mdx index 1dd5290c670..ad7260d0344 100644 --- a/docs/framework/llamaindex.mdx +++ b/docs/framework/llamaindex.mdx @@ -35,6 +35,27 @@ coming soon + + You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf) + + ```shell CLI + composio login + composio add github + ``` + ```python Python + request = toolset.initiate_connection(app=App.GITHUB) + print(f"Open this URL to authenticate: {request.redirectUrl}") + ``` + ```javascript TypeScript + const connection = await toolset.connectedAccounts.initiate({appName: "github"}) + console.log(`Open this URL to authenticate: ${connection.redirectUrl}`); + ``` + + + Don't forget to set your `COMPOSIO_API_KEY` and `OPENAI_API_KEY` in your environment variables. + + + You can get all the tools for a given app as shown below, but you can get **specific actions** and filter actions using **usecase** & **tags**. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) diff --git a/docs/framework/openai.mdx b/docs/framework/openai.mdx index 8b76219ab5e..76d346899ff 100644 --- a/docs/framework/openai.mdx +++ b/docs/framework/openai.mdx @@ -37,6 +37,27 @@ const openai = new OpenAI(); + + You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf) + + ```shell CLI + composio login + composio add github + ``` + ```python Python + request = composio_toolset.initiate_connection(app=App.GITHUB) + print(f"Open this URL to authenticate: {request.redirectUrl}") + ``` + ```javascript JavaScript + const connection = await toolset.connectedAccounts.initiate({appName: "github"}) + console.log(`Open this URL to authenticate: ${connection.redirectUrl}`); + ``` + + + Don't forget to set your `COMPOSIO_API_KEY` and `OPENAI_API_KEY` in your environment variables. + + + You can get all the tools for a given app as shown below, but you can get **specific actions** and filter actions using **usecase** & **tags**. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) diff --git a/docs/framework/phidata.mdx b/docs/framework/phidata.mdx index 3d240d4b9da..dadf77ee7fa 100644 --- a/docs/framework/phidata.mdx +++ b/docs/framework/phidata.mdx @@ -22,6 +22,23 @@ toolset = ComposioToolSet() ``` + +You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf) + +```shell CLI +composio login +composio add github +``` +```python Python +request = toolset.initiate_connection(app=App.GITHUB) +print(f"Open this URL to authenticate: {request.redirectUrl}") +``` + + +Don't forget to set your `COMPOSIO_API_KEY` and `OPENAI_API_KEY` in your environment variables. + + + You can get all the tools for a given app as shown below, but you can get **specific actions** and filter actions using **usecase** & **tags**. Learn more [here](../../patterns/tools/use-tools/use-specific-actions) ```python Python From 7eb76ae0d73db2686132f134d57ad8bc0a4a47ed Mon Sep 17 00:00:00 2001 From: abhishekpatil4 Date: Wed, 8 Jan 2025 14:08:19 +0530 Subject: [PATCH 07/10] feat: add ComposioToolSet args description --- docs/patterns/tools/what-are-tools.mdx | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/patterns/tools/what-are-tools.mdx b/docs/patterns/tools/what-are-tools.mdx index 0ced88e4e3d..dab10d10cb6 100644 --- a/docs/patterns/tools/what-are-tools.mdx +++ b/docs/patterns/tools/what-are-tools.mdx @@ -34,8 +34,8 @@ At Composio, tools are offered for multiple platforms, accessible via Python and Use the `ComposioToolSet` class to use and configure tools: -- Use `composio-core` package for direct action execution -- Use framework-specific packages (like `composio-langchain` or `composio-crewai`) when working with Agentic frameworkswhat +- Use [composio-core](https://pypi.org/project/composio-core) package for non-agentic use cases +- Use framework-specific packages [composio-langchain](https://pypi.org/project/composio-langchain) or [composio-crewai](https://pypi.org/project/composio-crewai) when working with Agentic frameworks See all supported frameworks [here](../../framework/autogen). @@ -46,20 +46,20 @@ See all supported frameworks [here](../../framework/autogen). - `entity_id`: The ID of the entity to execute the action on. Defaults to **default** - `connected_account_ids`: Use this to define connected accounts to use when executing an action for a specific app -#### Extensive Usecase: +#### Extensive Use Case: - `output_dir`: Directory path to store downloaded files - `metadata`: Additional metadata for executing an action. Learn more [here](use-tools/configure-tools) - `processors`: Request and response processors, use these to pre-process requests before executing an action and post-process the response after an action has been executed. Learn more [here](use-tools/processing-actions) - `logging_level`: Accepted values: CRITICAL, FATAL, ERROR, WARNING, WARN, INFO, DEBUG -- `verbosity_level`: This defines the size of the log object that will be printed on the console. +- `verbosity_level`: This defines the size of the log object that will be printed on the console -#### Advanced Usecase: +#### Advanced Use Case: - `base_url`: Base URL for the Composio API server -- `output_in_file`: Whether to output the result to a file. +- `output_in_file`: Whether to output the result to a file - `workspace_id`: Workspace ID for loading an existing workspace -- `workspace_config`: -- `max_retries`: -- `**kwargs`: Additional arguments for advanced use cases. +- `workspace_config`: Used to specify the configuration for the workspace environment. Supported workspace types: Host, Docker, FlyIO, and E2B +- `max_retries`: Maximum number of times a tool should be retried in case of a failure during execution +- `**kwargs`: Additional arguments for advanced use cases #### Getting Tools & Actions @@ -82,14 +82,16 @@ tools = tool_set.get_tools(apps=[App.GITHUB]) Tools and Actions are available through different toolset classes: -- Use `ComposioToolSet` for direct action execution +- Use `ComposioToolSet` class for non-agentic use cases - Use framework-specific classes like `OpenAIToolSet` or `LangchainToolSet` when working with OpenAI, LangChain or other [frameworks](../../framework/autogen). +JavaScript SDK has just one package [composio-core](https://www.npmjs.com/package/composio-core) that contains all the necessary classes for both direct usage and framework integrations + #### Basic Uscase: - `apiKey`: Composio API key. Get your API key [here](https://app.composio.dev/developers) - `entityId`: The ID of the entity to execute the action on. Defaults to **default** -#### Advanced Usecase: +#### Advanced Use Case: - `baseUrl`: Base URL for the Composio API server @@ -105,7 +107,7 @@ import { LangchainToolSet } from "composio-core"; const composioToolset = new LangchainToolSet(); // Get all actions from a tool -const tools = await composioToolset.getTools({ apps: ["github"] }); +const tools = await composioToolset.getTools({ apps: ["GITHUB"] }); ``` From e743507b6d45bc4febb10332b21ce49d96de2180 Mon Sep 17 00:00:00 2001 From: abhishekpatil4 Date: Wed, 8 Jan 2025 15:10:24 +0530 Subject: [PATCH 08/10] feat: add docs for getting connection params in custom actions --- .../build-tools/custom-action-with-auth.mdx | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/docs/patterns/tools/build-tools/custom-action-with-auth.mdx b/docs/patterns/tools/build-tools/custom-action-with-auth.mdx index 94c5f3c0894..b2f181e64b5 100644 --- a/docs/patterns/tools/build-tools/custom-action-with-auth.mdx +++ b/docs/patterns/tools/build-tools/custom-action-with-auth.mdx @@ -165,6 +165,50 @@ console.log(result); + +### How to Use Connection Parameters of an Account? +Connection Parameters of an account are available in the `connected_account` parameter of the custom action + +```python Python {5,13} +@action(toolname="github") +def list_repositories( + owner: str, + execute_request: t.Callable, + connected_account: ConnectedAccountModel +) -> list[str]: + """ + List repositories for a user. + + :param owner: Name of the owner. + :return repositories: List of repositories for given user. + """ + print(connected_account.connectionParams) + return [ + # Custom Action Logic + ] +``` +```javascript JavaScript +coming soon! +``` + +Below is an example of the connection parameters for a GitHub account: +```bash Output +scope='********' +base_url='https://api.github.com' +client_id='********' +token_type='********' +access_token='gho_Y3rMb*************' +client_secret='********' +consumer_id=None +consumer_secret=None +headers={ + 'Authorization': 'Bearer gho_Y***************', + 'x-request-id': '80ce421*********************' +} +queryParams={} +``` + + ### Why Use Custom Actions? Custom Actions provide several advantages: From ab18046ea0759330e8e7161a33a6e81770f92e0e Mon Sep 17 00:00:00 2001 From: abhishekpatil4 Date: Wed, 8 Jan 2025 16:10:48 +0530 Subject: [PATCH 09/10] feat: update links --- docs/mint.json | 2 +- docs/mint.json.ejs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/mint.json b/docs/mint.json index 9503e7af111..1d58c635be4 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -49,7 +49,7 @@ ], "topbarCtaButton": { "name": "Get your API Key", - "url": "https://app.composio.dev/settings" + "url": "https://app.composio.dev/developers" }, "topAnchor": { "name": "Documentation", diff --git a/docs/mint.json.ejs b/docs/mint.json.ejs index f6693dd3616..599bc8d9fe4 100644 --- a/docs/mint.json.ejs +++ b/docs/mint.json.ejs @@ -49,7 +49,7 @@ ], "topbarCtaButton": { "name": "Get your API Key", - "url": "https://app.composio.dev/settings" + "url": "https://app.composio.dev/developers" }, "topAnchor": { "name": "Documentation", From 631ac2e5dca4f1fc10219bc2623bef342a5ab974 Mon Sep 17 00:00:00 2001 From: abhishekpatil4 Date: Wed, 8 Jan 2025 17:02:26 +0530 Subject: [PATCH 10/10] chore: minor changes --- docs/mint.json | 7 ++++++- docs/patterns/Auth/connected_account.mdx | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/mint.json b/docs/mint.json index 1d58c635be4..9807b7bb187 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -191,7 +191,8 @@ "faq/api_key/api_key", "faq/api_key/cli", "faq/integrations_and_connections/list_of_tools", - "faq/supported_llms/supported_llm" + "faq/supported_llms/supported_llm", + "changelog" ] }, { @@ -396,6 +397,10 @@ { "source": "/introduction/foundations/components/local_tools", "destination": "/introduction/foundations/components/custom_actions" + }, + { + "source": "/changelog", + "destination": "https://github.com/ComposioHQ/composio/releases" } ] } diff --git a/docs/patterns/Auth/connected_account.mdx b/docs/patterns/Auth/connected_account.mdx index d705eedf9c7..5bf4b500911 100644 --- a/docs/patterns/Auth/connected_account.mdx +++ b/docs/patterns/Auth/connected_account.mdx @@ -77,7 +77,7 @@ Below are the accepted parameters for initiating a new connection: - `entity_id`: ID of the user for whom the connection is being created - `redirect_url`: URL to redirect the user to after the connection is created (for OAuth auth scheme). If not provided, the user will be redirected to Composio's connection success/failer page - `connected_account_params`/`data`: If auth mode is non-OAuth, this is where parameters need to be passed for creating a connection (API key, shopify store name, etc) -- `auth_scheme`: Type of authentication to be used for the connection (OAUTH2 or API_KEY, etc), OAUTH2 will be defaulted if not provided +- `auth_scheme`: Type of authentication to be used for the connection (OAUTH2 or API_KEY, BASIC_WITH_JWT, etc), OAUTH2 will be defaulted if not provided - `auth_config`: If auth mode is OAuth, this is where the configuration needs to be provided for creating a connection (client_id, client_secret, etc) Let's create a connection for the user **default** for the Gmail app.