# 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-4o", "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/3b/65/efeeedad46f3de218865cbf809998906ef59a29b1e5e1a9156ddade4a616/composio_autogen-0.3.30.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-4o\", \"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.3.30",
"project_urls": {
"Homepage": "https://github.com/ComposioHQ/composio"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6be0c7dcbb17de16c5825a90b498483c9542f426e715e36d5b2c5e73c1182eff",
"md5": "3321508ade1dc12d99e98ec7f153aa12",
"sha256": "b268317e2b36f206d35a3a8e056469af0b387b44dd9d4a876f2c9b98c003bc05"
},
"downloads": -1,
"filename": "composio_autogen-0.3.30-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3321508ade1dc12d99e98ec7f153aa12",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.9",
"size": 4638,
"upload_time": "2024-07-26T10:39:08",
"upload_time_iso_8601": "2024-07-26T10:39:08.748836Z",
"url": "https://files.pythonhosted.org/packages/6b/e0/c7dcbb17de16c5825a90b498483c9542f426e715e36d5b2c5e73c1182eff/composio_autogen-0.3.30-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3b65efeeedad46f3de218865cbf809998906ef59a29b1e5e1a9156ddade4a616",
"md5": "d3085330c6178b797914ce25f3394b24",
"sha256": "e512e6feed7d1a414abbec1a726153a7efca8c66e9ec0c112031f20f21329142"
},
"downloads": -1,
"filename": "composio_autogen-0.3.30.tar.gz",
"has_sig": false,
"md5_digest": "d3085330c6178b797914ce25f3394b24",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.9",
"size": 4306,
"upload_time": "2024-07-26T10:39:10",
"upload_time_iso_8601": "2024-07-26T10:39:10.089843Z",
"url": "https://files.pythonhosted.org/packages/3b/65/efeeedad46f3de218865cbf809998906ef59a29b1e5e1a9156ddade4a616/composio_autogen-0.3.30.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-26 10:39:10",
"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"
}