composio-autogen


Namecomposio-autogen JSON
Version 0.2.63 PyPI version JSON
download
home_pagehttps://github.com/SamparkAI/composio_sdk
SummaryUse Composio to get an array of tools with your Autogen agent.
upload_time2024-05-23 11:23:29
maintainerNone
docs_urlNone
authorSawradip
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 <> Autogen
Use Composio to enhance your Autogen workflows with a suite of tools.

## Quick Start

### Goal

Automatically star a GitHub repository using natural language commands through an Autogen Agent.

### Installation and Setup

Install Composio Autogen and connect your GitHub account to enable your agents with GitHub functionalities.

```bash
pip install composio-autogen
composio-cli add github  # Connect your GitHub account
composio-cli show-apps   # Check all supported apps
```

### Usage

#### 1. Import Base Packages & Create Default Autogen Agent

Setup your environment by importing necessary packages and configuring the Autogen agent.

```python
from autogen import AssistantAgent, UserProxyAgent
from composio_autogen import ComposioToolset, App, Action
import os

# Configuration for the language model
llm_config = {"config_list": [{"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}]}

# Initialize the AssistantAgent
chatbot = AssistantAgent(
    "chatbot",
    system_message="Reply TERMINATE when the task is done or when user's content is empty",
    llm_config=llm_config,
)

# Initialize the UserProxyAgent
user_proxy = UserProxyAgent(
    "user_proxy",
    is_termination_msg=lambda x: x.get("content", "") and "TERMINATE" in x.get("content", ""),
    human_input_mode="NEVER",  # Don't take input from User
    code_execution_config={"use_docker": False}
)
```

#### 2. Fetch All GitHub Autogen Tools via Composio

Initialize and register the necessary tools for interacting with GitHub.

```python
from composio_autogen import ComposioToolset, App, Action

# Initialize Composio Toolset
composio_tools = ComposioToolset()

# Register tools with appropriate executors
composio_tools.register_tools(tools=[App.GITHUB], caller=chatbot, executor=user_proxy)
```

#### 3. Execute the Task via Agent

Perform tasks like starring a repository on GitHub using the configured agent.

```python
task = "Star a repo SamparkAI/docs on GitHub"

# Initiate the task
response = user_proxy.initiate_chat(chatbot, message=task)

print(response.chat_history)
```

#### 4. Check Response

Verify the task completion and response from the agent.

```bash
[{'content': 'I have starred the repository "docs" for you on GitHub under the account "SamparkAI".', 'role': 'user'}, 
{'content': '', 'role': 'assistant'}, {'content': 'TERMINATE', 'role': 'user'}]
```

### Advanced Configuration

- **Filter Specific Actions:** Limit the actions an agent can execute to enhance security and focus.

```python
composio_tools.register_tools(actions=[Action.GITHUB_CREATE_ISSUE])
```

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

```python
composio_tools.register_tools([App.ASANA, App.GITHUB])
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/SamparkAI/composio_sdk",
    "name": "composio-autogen",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Sawradip",
    "author_email": "sawradip@composio.dev",
    "download_url": "https://files.pythonhosted.org/packages/05/0b/39ac38a5b7f41fc3b86075281a950438c4dc41b7f7c62cf1cc8408d3b3d0/composio_autogen-0.2.63.tar.gz",
    "platform": null,
    "description": "# Composio <> Autogen\nUse Composio to enhance your Autogen workflows with a suite of tools.\n\n## Quick Start\n\n### Goal\n\nAutomatically star a GitHub repository using natural language commands through an Autogen Agent.\n\n### Installation and Setup\n\nInstall Composio Autogen and connect your GitHub account to enable your agents with GitHub functionalities.\n\n```bash\npip install composio-autogen\ncomposio-cli add github  # Connect your GitHub account\ncomposio-cli show-apps   # Check all supported apps\n```\n\n### Usage\n\n#### 1. Import Base Packages & Create Default Autogen Agent\n\nSetup your environment by importing necessary packages and configuring the Autogen agent.\n\n```python\nfrom autogen import AssistantAgent, UserProxyAgent\nfrom composio_autogen import ComposioToolset, App, Action\nimport os\n\n# Configuration for the language model\nllm_config = {\"config_list\": [{\"model\": \"gpt-4\", \"api_key\": os.environ[\"OPENAI_API_KEY\"]}]}\n\n# Initialize the AssistantAgent\nchatbot = AssistantAgent(\n    \"chatbot\",\n    system_message=\"Reply TERMINATE when the task is done or when user's content is empty\",\n    llm_config=llm_config,\n)\n\n# Initialize the UserProxyAgent\nuser_proxy = UserProxyAgent(\n    \"user_proxy\",\n    is_termination_msg=lambda x: x.get(\"content\", \"\") and \"TERMINATE\" in x.get(\"content\", \"\"),\n    human_input_mode=\"NEVER\",  # Don't take input from User\n    code_execution_config={\"use_docker\": False}\n)\n```\n\n#### 2. Fetch All GitHub Autogen Tools via Composio\n\nInitialize and register the necessary tools for interacting with GitHub.\n\n```python\nfrom composio_autogen import ComposioToolset, App, Action\n\n# Initialize Composio Toolset\ncomposio_tools = ComposioToolset()\n\n# Register tools with appropriate executors\ncomposio_tools.register_tools(tools=[App.GITHUB], caller=chatbot, executor=user_proxy)\n```\n\n#### 3. Execute the Task via Agent\n\nPerform tasks like starring a repository on GitHub using the configured agent.\n\n```python\ntask = \"Star a repo SamparkAI/docs on GitHub\"\n\n# Initiate the task\nresponse = user_proxy.initiate_chat(chatbot, message=task)\n\nprint(response.chat_history)\n```\n\n#### 4. Check Response\n\nVerify the task completion and response from the agent.\n\n```bash\n[{'content': 'I have starred the repository \"docs\" for you on GitHub under the account \"SamparkAI\".', 'role': 'user'}, \n{'content': '', 'role': 'assistant'}, {'content': 'TERMINATE', 'role': 'user'}]\n```\n\n### Advanced Configuration\n\n- **Filter Specific Actions:** Limit the actions an agent can execute to enhance security and focus.\n\n```python\ncomposio_tools.register_tools(actions=[Action.GITHUB_CREATE_ISSUE])\n```\n\n- **Filter Specific Apps:** Restrict the agent's access to specific tools for streamlined operations.\n\n```python\ncomposio_tools.register_tools([App.ASANA, App.GITHUB])\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Use Composio to get an array of tools with your Autogen agent.",
    "version": "0.2.63",
    "project_urls": {
        "Homepage": "https://github.com/SamparkAI/composio_sdk"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "466952d4e443377d507e2b0817588454f392e6e87c830f939cb2fc60a785c034",
                "md5": "0da4534dd61fe021cd49d810b0e9bb2c",
                "sha256": "77591ca21a7eb81ac561ebf315f712cfc1e05fb91159f14af9a8e3258520e368"
            },
            "downloads": -1,
            "filename": "composio_autogen-0.2.63-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0da4534dd61fe021cd49d810b0e9bb2c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 4332,
            "upload_time": "2024-05-23T11:23:27",
            "upload_time_iso_8601": "2024-05-23T11:23:27.801159Z",
            "url": "https://files.pythonhosted.org/packages/46/69/52d4e443377d507e2b0817588454f392e6e87c830f939cb2fc60a785c034/composio_autogen-0.2.63-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "050b39ac38a5b7f41fc3b86075281a950438c4dc41b7f7c62cf1cc8408d3b3d0",
                "md5": "194eb988c210b42d7f5a20e5c1a3e45c",
                "sha256": "efcd556afb733ce41f67e2c1dc7e4443c5ab0da061ebd726d4d66a98979bcef0"
            },
            "downloads": -1,
            "filename": "composio_autogen-0.2.63.tar.gz",
            "has_sig": false,
            "md5_digest": "194eb988c210b42d7f5a20e5c1a3e45c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 4042,
            "upload_time": "2024-05-23T11:23:29",
            "upload_time_iso_8601": "2024-05-23T11:23:29.221253Z",
            "url": "https://files.pythonhosted.org/packages/05/0b/39ac38a5b7f41fc3b86075281a950438c4dc41b7f7c62cf1cc8408d3b3d0/composio_autogen-0.2.63.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-23 11:23:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SamparkAI",
    "github_project": "composio_sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "composio-autogen"
}
        
Elapsed time: 0.30620s