composio-crewai


Namecomposio-crewai JSON
Version 0.3.30 PyPI version JSON
download
home_pagehttps://github.com/ComposioHQ/composio
SummaryUse Composio to get an array of tools with your CrewAI agent.
upload_time2024-07-26 10:42:00
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/52/20/249eb7256fc262224a4b398d02421fbfd82eb5923fdff2a40a7e56c152f6/composio_crewai-0.3.30.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.3.30",
    "project_urls": {
        "Homepage": "https://github.com/ComposioHQ/composio"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a39698c8106ea7fa2b649642764c5bad199800e7f5082bf211c02d9d66154264",
                "md5": "360f71b8508df1d8c11155c1cb85b5cf",
                "sha256": "c2f9ee58246a566f027b2c227d01d83bfbaef4ca54bcc348bc87ffa2b1ad1ca6"
            },
            "downloads": -1,
            "filename": "composio_crewai-0.3.30-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "360f71b8508df1d8c11155c1cb85b5cf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 2733,
            "upload_time": "2024-07-26T10:41:58",
            "upload_time_iso_8601": "2024-07-26T10:41:58.403682Z",
            "url": "https://files.pythonhosted.org/packages/a3/96/98c8106ea7fa2b649642764c5bad199800e7f5082bf211c02d9d66154264/composio_crewai-0.3.30-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5220249eb7256fc262224a4b398d02421fbfd82eb5923fdff2a40a7e56c152f6",
                "md5": "788217f70719d7beaa3bdae4499a6de8",
                "sha256": "f74e016f8ac8f666d66a7362344cbe665d68be4b5f6c19c9002f0916158a1fd8"
            },
            "downloads": -1,
            "filename": "composio_crewai-0.3.30.tar.gz",
            "has_sig": false,
            "md5_digest": "788217f70719d7beaa3bdae4499a6de8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 2645,
            "upload_time": "2024-07-26T10:42:00",
            "upload_time_iso_8601": "2024-07-26T10:42:00.535496Z",
            "url": "https://files.pythonhosted.org/packages/52/20/249eb7256fc262224a4b398d02421fbfd82eb5923fdff2a40a7e56c152f6/composio_crewai-0.3.30.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-26 10:42:00",
    "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.30176s