composio-crewai


Namecomposio-crewai JSON
Version 0.5.32 PyPI version JSON
download
home_pagehttps://github.com/ComposioHQ/composio
SummaryUse Composio to get an array of tools with your CrewAI agent.
upload_time2024-10-17 10:42:43
maintainerNone
docs_urlNone
authorHimanshu
requires_python<4,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Composio <> CrewAI

![CrewAI Logo](https://i.imgur.com/jXeNUda.png)

**Composio** enables **CrewAI agents** to connect with numerous tools, making it easy for these agents to interact with external applications seamlessly.

## Installation and Setup

Start by installing Composio CrewAI and connecting your GitHub account to enable GitHub functionalities for your agents.

```bash
pip install composio_crewai
composio-cli add github  # Connect your GitHub account
composio-cli show-apps   # Check available applications
```

## Goal

Automate GitHub interactions, such as starring a repository, using natural language commands through a CrewAI Agent.

### Step-by-Step Guide

#### 1. Import Base Packages

Prepare your environment by importing the necessary packages for CrewAI and setting up your language model.

```python
from crewai import Agent, Task
from langchain_openai import ChatOpenAI

# Initialize the language model with your OpenAI API key
llm = ChatOpenAI(openai_api_key="sk-<OPENAI KEY>")
```

#### 2. Fetch Tools via Composio

Initialize the Composio toolset for interacting with GitHub.

```python
from composio_crewai import ComposioToolSet, Action, App

# Initialize the toolset with GitHub application
tools = ComposioToolSet(apps=[App.GITHUB])
```

#### 3. Execute the Agent

Configure and execute the CrewAI agent to perform GitHub actions.

```python
crewai_agent = Agent(
    role='Github Agent',
    goal="You take action on Github using Github APIs",
    backstory="You are an AI agent responsible for taking actions on Github on users' behalf using Github APIs",
    verbose=True,
    tools=tools,
    llm=llm
)

# Define the task
task = Task(
    description="Star a repo composiohq/composio on GitHub",
    agent=crewai_agent,
    expected_output="if the star happened"
)

# Execute the task
task.execute()
```

#### 4. Check Response

Verify the agent's actions and responses to ensure the task was completed successfully.

```bash
> Entering new CrewAgentExecutor chain...
> I need to star the repository "composiohq/composio" on GitHub.
> {'execution_details': {'executed': True}, 'response_data': ''}
> Finished chain.
```

### Advanced Configuration

- **Filter Specific Actions:** Limit the actions an agent can perform for enhanced security and operational focus.

```python
toolsGithubCreateIssue = ComposioToolSet(actions=[Action.GITHUB_CREATE_ISSUE])
```

- **Filter Specific Apps:** Restrict the agent's access to certain applications for streamlined operations.

```python
toolsAsanaGithub = ComposioToolSet(apps=[App.ASANA, App.GITHUB])
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ComposioHQ/composio",
    "name": "composio-crewai",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Himanshu",
    "author_email": "himanshu@composio.dev",
    "download_url": "https://files.pythonhosted.org/packages/3b/32/42047f5323de574282b7f85b1344aecf099f5ba06550033853dcd01e68c4/composio_crewai-0.5.32.tar.gz",
    "platform": null,
    "description": "# Composio <> CrewAI\n\n![CrewAI Logo](https://i.imgur.com/jXeNUda.png)\n\n**Composio** enables **CrewAI agents** to connect with numerous tools, making it easy for these agents to interact with external applications seamlessly.\n\n## Installation and Setup\n\nStart by installing Composio CrewAI and connecting your GitHub account to enable GitHub functionalities for your agents.\n\n```bash\npip install composio_crewai\ncomposio-cli add github  # Connect your GitHub account\ncomposio-cli show-apps   # Check available applications\n```\n\n## Goal\n\nAutomate GitHub interactions, such as starring a repository, using natural language commands through a CrewAI Agent.\n\n### Step-by-Step Guide\n\n#### 1. Import Base Packages\n\nPrepare your environment by importing the necessary packages for CrewAI and setting up your language model.\n\n```python\nfrom crewai import Agent, Task\nfrom langchain_openai import ChatOpenAI\n\n# Initialize the language model with your OpenAI API key\nllm = ChatOpenAI(openai_api_key=\"sk-<OPENAI KEY>\")\n```\n\n#### 2. Fetch Tools via Composio\n\nInitialize the Composio toolset for interacting with GitHub.\n\n```python\nfrom composio_crewai import ComposioToolSet, Action, App\n\n# Initialize the toolset with GitHub application\ntools = ComposioToolSet(apps=[App.GITHUB])\n```\n\n#### 3. Execute the Agent\n\nConfigure and execute the CrewAI agent to perform GitHub actions.\n\n```python\ncrewai_agent = Agent(\n    role='Github Agent',\n    goal=\"You take action on Github using Github APIs\",\n    backstory=\"You are an AI agent responsible for taking actions on Github on users' behalf using Github APIs\",\n    verbose=True,\n    tools=tools,\n    llm=llm\n)\n\n# Define the task\ntask = Task(\n    description=\"Star a repo composiohq/composio on GitHub\",\n    agent=crewai_agent,\n    expected_output=\"if the star happened\"\n)\n\n# Execute the task\ntask.execute()\n```\n\n#### 4. Check Response\n\nVerify the agent's actions and responses to ensure the task was completed successfully.\n\n```bash\n> Entering new CrewAgentExecutor chain...\n> I need to star the repository \"composiohq/composio\" on GitHub.\n> {'execution_details': {'executed': True}, 'response_data': ''}\n> Finished chain.\n```\n\n### Advanced Configuration\n\n- **Filter Specific Actions:** Limit the actions an agent can perform for enhanced security and operational focus.\n\n```python\ntoolsGithubCreateIssue = ComposioToolSet(actions=[Action.GITHUB_CREATE_ISSUE])\n```\n\n- **Filter Specific Apps:** Restrict the agent's access to certain applications for streamlined operations.\n\n```python\ntoolsAsanaGithub = ComposioToolSet(apps=[App.ASANA, App.GITHUB])\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Use Composio to get an array of tools with your CrewAI agent.",
    "version": "0.5.32",
    "project_urls": {
        "Homepage": "https://github.com/ComposioHQ/composio"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d8326aa71ea4ffda8eb9717972319011cae06bb835ac986ee69b5902d1af0b8a",
                "md5": "6bfcd93fef1998435c7028534eb4902f",
                "sha256": "a7495605aa50b8f61d7f767261b30ed5f637bb3bbc99f42a7ed23c58d18012a1"
            },
            "downloads": -1,
            "filename": "composio_crewai-0.5.32-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6bfcd93fef1998435c7028534eb4902f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 2807,
            "upload_time": "2024-10-17T10:42:42",
            "upload_time_iso_8601": "2024-10-17T10:42:42.526449Z",
            "url": "https://files.pythonhosted.org/packages/d8/32/6aa71ea4ffda8eb9717972319011cae06bb835ac986ee69b5902d1af0b8a/composio_crewai-0.5.32-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3b3242047f5323de574282b7f85b1344aecf099f5ba06550033853dcd01e68c4",
                "md5": "66bce5355f7f6a1fbf64580367a7fc50",
                "sha256": "495afc771e21b6020333db0a0243e859f2c523a64529c7adfd7149b8e258f7e8"
            },
            "downloads": -1,
            "filename": "composio_crewai-0.5.32.tar.gz",
            "has_sig": false,
            "md5_digest": "66bce5355f7f6a1fbf64580367a7fc50",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 2727,
            "upload_time": "2024-10-17T10:42:43",
            "upload_time_iso_8601": "2024-10-17T10:42:43.527825Z",
            "url": "https://files.pythonhosted.org/packages/3b/32/42047f5323de574282b7f85b1344aecf099f5ba06550033853dcd01e68c4/composio_crewai-0.5.32.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-17 10:42:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ComposioHQ",
    "github_project": "composio",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "composio-crewai"
}
        
Elapsed time: 0.37632s