-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/v1-v2-shift
- Loading branch information
Showing
157 changed files
with
3,585 additions
and
710 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
title: "Using Composio With Smol Agents" | ||
sidebarTitle: "Smol Agents" | ||
description: "Integrate Composio with Smol agents to let them seamlessly interact with external apps" | ||
--- | ||
|
||
## Star A Repository on GitHub | ||
In this example, we will use SmolAgent's Code Agent to star a repository on GitHub using Composio Tools | ||
|
||
<Steps> | ||
<Step title="Install Packages"> | ||
<CodeGroup> | ||
```bash Python | ||
pip install composio-smol smolagents | ||
``` | ||
</CodeGroup> | ||
</Step> | ||
<Step title="Import Libraries & Initialize ComposioToolSet"> | ||
<CodeGroup> | ||
```python Python | ||
from composio_smol import ComposioToolSet, Action, App | ||
from smolagents import CodeAgent, HfApiModel | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
composio_toolset = ComposioToolSet() | ||
``` | ||
</CodeGroup> | ||
</Step> | ||
|
||
<Step title="Connect Your GitHub Account"> | ||
<Info>You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf)</Info> | ||
<CodeGroup> | ||
```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}") | ||
``` | ||
</CodeGroup> | ||
<Tip> | ||
Don't forget to set your `COMPOSIO_API_KEY` in your environment variables. | ||
</Tip> | ||
</Step> | ||
|
||
<Step title="Get All GitHub Tools"> | ||
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) | ||
<CodeGroup> | ||
```python Python | ||
tools = composio_toolset.get_tools(actions=[Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER]) | ||
``` | ||
</CodeGroup> | ||
|
||
</Step> | ||
<Step title="Define the Agent"> | ||
<CodeGroup> | ||
```python Python | ||
agent = CodeAgent(tools=tools, model=HfApiModel()) | ||
``` | ||
</CodeGroup> | ||
</Step> | ||
|
||
<Step title="Execute the Agent"> | ||
<CodeGroup> | ||
```python Python | ||
task = "Star a repo composiohq/composio on GitHub" | ||
agent.run(task) | ||
``` | ||
</CodeGroup> | ||
</Step> | ||
</Steps> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: "Action Versioning" | ||
sidebarTitle: "Action Versioning" | ||
description: "Learn how to use versioned actions in Composio" | ||
--- | ||
|
||
Composio supports semantic versioning for actions to ensure stable and consistent interfaces. This guide explains how version specifiers work and how to use them in your applications. | ||
|
||
## Versioning Policies | ||
|
||
Composio follows semantic versioning principles: | ||
|
||
- **Minor Version Changes** (0_1 → 0_2) | ||
- Non-breaking interface changes | ||
- Examples: Adding optional parameters, extending functionality | ||
- Backward compatible with previous minor versions | ||
|
||
- **Major Version Changes** (0_3 → 1_0) | ||
- Breaking interface changes | ||
- Examples: Action deprecation or replacement, Changes in required parameters, Changes in parameter types or formats | ||
- May require updates to existing code | ||
|
||
## Version Specifiers | ||
|
||
Composio provides several ways to specify which version of an action you want to use: | ||
|
||
- `latest` - Uses the most recent version available. For example, if an action has versions 0_1, 0_2, 0_3, 1_0, and 1_1, `latest` will resolve to `1_1`. | ||
- `latest:base` - Uses the latest version before a major version change. Using the same example versions, `latest:base` would resolve to `0_3`. | ||
- `x_y` - Explicitly specify major (x) and minor (y) versions, like `0_1` or `1_0`. | ||
|
||
## Using Versions in Code | ||
|
||
Here's how to specify versions when using Composio: | ||
|
||
<CodeGroup> | ||
```python Python {7,10,13} | ||
from composio_langchain import ComposioToolSet, Action | ||
|
||
# Initialize toolset | ||
toolset = ComposioToolSet() | ||
|
||
# Use latest base version (default) | ||
tools = toolset.get_tools(actions=[Action.GITHUB_META_ROOT @ "latest:base"]) | ||
|
||
# Use latest version | ||
tools = toolset.get_tools(actions=[Action.GITHUB_META_ROOT @ "latest"]) | ||
|
||
# Use specific version | ||
tools = toolset.get_tools(actions=[Action.GITHUB_META_ROOT @ "0_1"]) | ||
``` | ||
``` javascript JavaScript | ||
coming soon! | ||
``` | ||
</CodeGroup> | ||
|
||
<Info>If no version is specified it defaults to `latest:base`</Info> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
export const env = process.env.TEST_ENV || "staging" | ||
export const env = "staging"; | ||
const CURRENT_FILE_DIR = __dirname; | ||
|
||
export type BACKEND_CONFIG = { | ||
COMPOSIO_API_KEY: string; | ||
BACKEND_HERMES_URL: string; | ||
} | ||
COMPOSIO_API_KEY: string; | ||
BACKEND_HERMES_URL: string; | ||
drive: { | ||
downloadable_file_id: string; | ||
}; | ||
}; | ||
|
||
export const getTestConfig = (): BACKEND_CONFIG => { | ||
const path = `${CURRENT_FILE_DIR}/test.config.${env}.json`; | ||
try { | ||
return JSON.parse(JSON.stringify(require(path))) as unknown as BACKEND_CONFIG; | ||
} catch (error) { | ||
console.error("Error loading test config file:", error); | ||
throw new Error(`Error loading test config file. You can create test.config.${env}.json file in the config folder.`); | ||
} | ||
} | ||
const path = `${CURRENT_FILE_DIR}/test.config.${env}.json`; | ||
try { | ||
return JSON.parse( | ||
JSON.stringify(require(path)) | ||
) as unknown as BACKEND_CONFIG; | ||
} catch (error) { | ||
console.error("Error loading test config file:", error); | ||
throw new Error( | ||
`Error loading test config file. You can create test.config.${env}.json file in the config folder.` | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
"COMPOSIO_API_KEY": "", | ||
"BACKEND_HERMES_URL": "http://localhost:9900" | ||
"BACKEND_HERMES_URL": "http://localhost:9900", | ||
"drive":{ | ||
"downloadable_file_id":"18rcI9N7cJRG15E2qyWXtNSFeDg4Rj-T3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
"COMPOSIO_API_KEY": "pv7s0lpq7z5vu27cikyls", | ||
"BACKEND_HERMES_URL": "https://backend.composio.dev" | ||
"BACKEND_HERMES_URL": "https://backend.composio.dev", | ||
"drive":{ | ||
"downloadable_file_id":"18rcI9N7cJRG15E2qyWXtNSFeDg4Rj-T3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
"COMPOSIO_API_KEY": "gxpf3a5v864651jp741heq", | ||
"BACKEND_HERMES_URL": "https://staging-backend.composio.dev" | ||
"BACKEND_HERMES_URL": "https://staging-backend.composio.dev", | ||
"drive":{ | ||
"downloadable_file_id":"1K23Tyfb35lpu_syfdsx1w6UfIJ9DRgwq" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.