Skip to content

Commit

Permalink
Merge branch 'master' into refactor/tool-abstractions
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarsh-dixit committed Aug 20, 2024
2 parents f076556 + 41a0ff5 commit def7b3f
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 96 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]
package:
[
autogen,
camel,
claude,
crew_ai,
griptape,
julep,
langchain,
llamaindex,
lyzr,
openai,
praisonai,
langgraph,
phidata,
]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
Expand All @@ -36,10 +52,10 @@ jobs:
sudo apt-get autoclean
python -m pip install --upgrade pip pipenv pytest
ls -1 plugins | awk '$0="plugins/"$0"/"' | xargs -L1 pipenv run pip3 install
pipenv install
pipenv run pip3 install '.[all]'
pipenv run pip install 'numpy<2'
pipenv run composio apps update
python -m pip install plugins/${{matrix.package}}
python -m pip install '.[all]'
python -m pip install 'numpy<2' python-dotenv
CI=false COMPOSIO_BASE_URL=https://backend.composio.dev/api pipenv run pytest -vv tests/test_example.py
composio apps update
CI=false COMPOSIO_BASE_URL=https://backend.composio.dev/api PLUGIN_TO_TEST=${{matrix.package}} pytest -vv tests/test_example.py
8 changes: 0 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,8 @@ on:
default: false

jobs:
# test-examples:
# if: ${{ !inputs.skip_tests }}
# uses: ./.github/workflows/examples.yml
# with:
# working-directory: ./python
# secrets: inherit

publish-core:
name: Create Framework & Plugin Releases
# needs: test-examples
defaults:
run:
working-directory: ./python
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: "🔧 Crafting Custom Tools"
sidebarTitle: "Custom Tools"
title: "🔧 Custom Tools Using OpenAPI Spec"
sidebarTitle: "OpenAPI Tools"
icon: "puzzle-piece"
description: "Explore the process of creating custom integrations with external Apps"
description: "Explore the process of creating custom tools with external Apps using OpenAPI Spec"
---

Creating custom tools on Composio is straightforward and can be done via an [OpenAPI Spec](https://swagger.io/specification/). Here's a quick video on how you can add a custom integration to Composio using OpenAPI Spec.
Expand Down Expand Up @@ -302,8 +302,4 @@ Navigate back to the tools catalogue page on Composio. Search for the tool you j

</Step>

</Steps>

If you face any issues or found any bugs, join our <a href="https://dub.composio.dev/discord">Discord</a> to chat with the team or write to us at [email protected].

You can also add the actions to your custom tools. Click on the next article to read on how to create actions for your custom tool.
</Steps>
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,73 @@ description: "Allow your users to connect with any Apps."

## Overview of Integrations

Integrations allow users to link their accounts with external apps, enabling agents to take actions on their behalf. You can view all active integrations and monitor live connections or users by visiting the [Dashboard](https://app.composio.dev/your_apps).
Integrations allow users to link their accounts with external apps, enabling agents to take actions on their behalf.

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.
You can view all active integrations and monitor live connections or users by visiting the [Dashboard](https://app.composio.dev/your_apps).

Once an integration is established, it can be utilized by an **unlimited number of users** to connect their accounts. So ideally you will only build **one integration per tool or application** and **allow all your users to connect using it**.
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.

To authenticate users with a specific tool, create a new integration by selecting the desired tool on the [Tools Page](https://app.composio.dev/apps). Integrations can be established using either default credentials or by registering a new developer application and setting the necessary authentication and permission scopes.
You can use your own configuration or use Composio's default integrations.

Once an integration is established, it can be utilized by an **unlimited number of users** to connect their accounts.

So ideally you will only build **one integration per tool or application** and **allow all your users to connect using it**.


## Using Integration ID to Connect an Account for a user
<Tabs>
<Tab title="Python">
<CodeGroup>
```python Connect a User's account using Integration ID
from composio import ComposioToolSet, App
from composio.client.exceptions import NoItemsFound

toolset = ComposioToolSet()

entity_id = "Jessica" # change this with your user_id
integration_id = "integration_id"

entity = toolset.get_entity(id=entity_id)

integration = toolset.client.integrations.get_by_id(integration_id=integration_id)


try:
connection = entity.get_connection(app=App.GITHUB)
# Connection Already exist with Github.
# Now we can check if it's using the correct integration

if connection:
connection_integration_id = connection.integrationId
if connection_integration_id == integration_id:
# Connection is already active with the correct integration
print(f"User is already authenticated with GitHub")
else:
# Connection is active with a different integration
# TODO: Choose between the following options:
# 1. Create a new connection with the correct integration
# 2. Ignore as it's fine
print(f"User is already authenticated with GitHub but with a different integration")

print(f"User is already authenticated with GitHub")

except NoItemsFound as e:
# Create a request to initiate connection
request = entity.initiate_connection(App.GITHUB,integration=integration)

print(
f"Please authenticate {App.GITHUB} in the browser and come back here. URL: {request.redirectUrl}"
)

# Poll until the connection is active
connected_account = request.wait_until_active(client=toolset.client, timeout=100)
```
</CodeGroup>
</Tab>
<Tab title="JavaScript">
coming soon!
</Tab>
<Tab title="API">
coming soon!
</Tab>
</Tabs>
58 changes: 10 additions & 48 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,13 @@
"introduction/foundations/components/actions/action-guide",
"introduction/foundations/components/triggers/trigger-guide",
"introduction/foundations/components/local_tools",
"introduction/foundations/components/integrations/custom-integration",
{
"group": "Advanced",
"pages": [
"introduction/foundations/components/actions/processing",
"introduction/foundations/components/integrations/integration-guide",
"introduction/foundations/components/workspace",
"introduction/foundations/components/integrations/custom-integration"

"introduction/foundations/components/actions/processing",
"introduction/foundations/components/workspace"
]
}
]
Expand Down Expand Up @@ -135,18 +134,10 @@
},

{
"group": "SweKit (JS)",
"group": "SweKit",
"pages": [
"swekit-js/introduction",
"swekit-js/workspace-env"
]
},
{
"group": "SweKit (Python)",
"pages": [
"swekit/introduction",
"swekit/workspace-env",
"swekit/custom-tools",
"swekit/benchmarks"
]
},
Expand Down Expand Up @@ -220,34 +211,13 @@
{
"group": "Client Auth",
"pages": [
"api-reference/client-auth/send-magic-link",
"api-reference/client-auth/logout-api",
"api-reference/client-auth/verify-magic-link",
"api-reference/client-auth/get-user-info"
]
},
{
"group": "Team",
"pages": [
"api-reference/team/invite-member",
"api-reference/team/list-members",
"api-reference/team/remove-member"
]
},
{
"group": "API Keys",
"pages": [
"api-reference/api-keys/list-api-keys",
"api-reference/api-keys/generate-api-key",
"api-reference/api-keys/delete-api-key"
]
},
{
"group": "App",
"pages": [
"api-reference/app/get-apps",
"api-reference/app/add-open-api-spec",
"api-reference/app/get-opena-api-specs"
"api-reference/app/get-apps"
]
},
{
Expand All @@ -261,12 +231,12 @@
]
},
{
"group": "Actions Controller V 1",
"group": "Actions Controller",
"pages": [
"api-reference/actions-controller-v-1/list-actions",
"api-reference/actions-controller-v-1/execute-action",
"api-reference/actions-controller-v-1/execute-action-proxy",
"api-reference/actions-controller-v-1/get-action"
"api-reference/actions-controller-v-2/list-actions",
"api-reference/actions-controller-v-2/execute-action",
"api-reference/actions-controller-v-2/execute-action-proxy",
"api-reference/actions-controller-v-1/get-action"
]
},
{
Expand Down Expand Up @@ -301,14 +271,6 @@
"pages": [
"api-reference/logs/get-logs"
]
},
{
"group": "Actions Controller V 2",
"pages": [
"api-reference/actions-controller-v-2/list-actions",
"api-reference/actions-controller-v-2/execute-action",
"api-reference/actions-controller-v-2/execute-action-proxy"
]
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions docs/swekit-js/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "SWE Development Kit"
sidebarTitle: "Introduction"
sidebarTitle: "Introduction (JS)"
icon: "code"
description: "Build and benchmark Software Engineering agents with Composio's tooling ecosystem using JavaScript"
---
Expand Down Expand Up @@ -117,4 +117,4 @@ It provides tools like Github, Repo Indexing, Repo Search, File Manager, Shell M

## Next Steps

- Familiarize yourself with the different [workspace environments](/swekit-js/workspace-env) and their use cases.
- Familiarize yourself with the different [workspace environments](/introduction/foundations/components/workspace) and their use cases.
10 changes: 2 additions & 8 deletions docs/swekit/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "SWE Development Kit"
sidebarTitle: "Introduction"
sidebarTitle: "Introduction (Python)"
icon: "code"
description: "Build Software Engineering agents locally with frameworks and tools of your choice"
---
Expand Down Expand Up @@ -104,10 +104,4 @@ It provides tools like Github, Repo Indexing, Repo Search, File Manager, Shell M

You will be prompted to specify the repository and issue for the agent to address.
</Step>
</Steps>

## Next Steps

- Familiarize yourself with the different [workspace environments](/swekit/workspace-env) and their use cases.
- Discover how to [tailor your agent's functionality](/swekit/custom-tools) to suit specific tasks.
- Understand how to [execute benchmarks](/swekit/benchmark) to evaluate your agent's performance.
</Steps>
2 changes: 1 addition & 1 deletion python/plugins/langchain/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
],
python_requires=">=3.9,<4",
install_requires=[
"langchain>=0.1.0",
"langchain>=0.1.0,<0.2.0",
"langchain-openai>=0.0.2.post1",
"pydantic>=2.6.4",
"langchainhub>=0.1.15",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/openai/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"Operating System :: OS Independent",
],
python_requires=">=3.9,<4",
install_requires=["composio_core==0.4.5"],
install_requires=["composio_core==0.4.5", "openai"],
include_package_data=True,
)
Loading

0 comments on commit def7b3f

Please sign in to comment.