composio-autogen


Namecomposio-autogen JSON
Version 0.6.19 PyPI version JSON
download
home_pagehttps://github.com/ComposioHQ/composio
SummaryUse Composio to get an array of tools with your Autogen agent.
upload_time2025-01-28 19:25:40
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-turbo", "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 composiohq/composio 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 "composio" for you on GitHub under the account "composiohq".', '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/ComposioHQ/composio",
    "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/ac/cf/d55953ef10ca09d1d73116d942d5f789b94fe6e992c03b7a85d6fc20b672/composio_autogen-0.6.19.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-turbo\", \"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 composiohq/composio 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 \"composio\" for you on GitHub under the account \"composiohq\".', '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.6.19",
    "project_urls": {
        "Homepage": "https://github.com/ComposioHQ/composio"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "df14020e22abca145015b39e63c5773b6b290c76ec45ce34a68887b69d47f388",
                "md5": "2044353f622cd67a2d447de920086156",
                "sha256": "acc855e0d5915d68dbc28cca45bf67601dbbb1d703091582a9dbc9fe299dfff2"
            },
            "downloads": -1,
            "filename": "composio_autogen-0.6.19-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2044353f622cd67a2d447de920086156",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 5078,
            "upload_time": "2025-01-28T19:25:18",
            "upload_time_iso_8601": "2025-01-28T19:25:18.991234Z",
            "url": "https://files.pythonhosted.org/packages/df/14/020e22abca145015b39e63c5773b6b290c76ec45ce34a68887b69d47f388/composio_autogen-0.6.19-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "accfd55953ef10ca09d1d73116d942d5f789b94fe6e992c03b7a85d6fc20b672",
                "md5": "78d15c86f1efa3250b5de0c267239f6b",
                "sha256": "354adbbed7f6beb536e6d38e22c76ff72a96f0733ac11db961521e2da324271d"
            },
            "downloads": -1,
            "filename": "composio_autogen-0.6.19.tar.gz",
            "has_sig": false,
            "md5_digest": "78d15c86f1efa3250b5de0c267239f6b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 4782,
            "upload_time": "2025-01-28T19:25:40",
            "upload_time_iso_8601": "2025-01-28T19:25:40.560810Z",
            "url": "https://files.pythonhosted.org/packages/ac/cf/d55953ef10ca09d1d73116d942d5f789b94fe6e992c03b7a85d6fc20b672/composio_autogen-0.6.19.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-28 19:25:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ComposioHQ",
    "github_project": "composio",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "composio-autogen"
}
        
Elapsed time: 0.54780s