## Using Composio With Lyzr
Integrate Composio with Lyzr agents to allow them to interact seamlessly with external apps, enhancing their functionality and reach.
### Goal
- **Star a repository on GitHub** using natural language commands through a LangChain Agent.
### Installation and Setup
Ensure you have the necessary packages installed and connect your GitHub account to allow your agents to utilize GitHub functionalities.
```bash
# Install Composio LangChain package
pip install composio-lyzr
# Connect your GitHub account
composio-cli add github
# View available applications you can connect with
composio-cli show-apps
```
### Usage
```
from lyzr_automata import Task, Agent
from lyzr_automata.ai_models.openai import OpenAIModel
from lyzr_automata.tasks.task_literals import InputType, OutputType
from lyzr_automata.pipelines.linear_sync_pipeline import LinearSyncPipeline
import os
import dotenv
dotenv.load_dotenv()
from composio_lyzr import ComposioToolSet, App, Action
open_ai_text_completion_model = OpenAIModel(
api_key=os.environ["OPENAI_API_KEY"],
parameters={
"model": "gpt-4-turbo-preview",
"temperature": 0.2,
"max_tokens": 1500,
},
)
lyzr_agent = Agent(
role="Github Agent",
prompt_persona="You are AI agent that is responsible for taking actions on Github on users behalf. You need to take action on Github using Github APIs"
)
composio_toolset = ComposioToolSet()
composio_tool = composio_toolset.get_lyzr_tool(Action.GITHUB_STAR_REPO)
task = Task(
name="Github Starring",
agent=lyzr_agent,
tool=composio_tool,
output_type=OutputType.TEXT,
input_type=InputType.TEXT,
model=open_ai_text_completion_model,
instructions="Star a repo composiohq/composio on GitHub",
log_output=True,
enhance_prompt=False,
)
lyzr_output = LinearSyncPipeline(
name="Composio Lyzr",
# completion message after pipeline completes
completion_message="Task completed",
tasks=[
# tasks are instance of Task class
task,
],
).run()
print(lyzr_output)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ComposioHQ/composio",
"name": "composio-lyzr",
"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/f7/d6/ff4d60abaeb6c292abf3c319e5db343515bfe2986e7c57cbe18e15f81176/composio_lyzr-0.5.34.tar.gz",
"platform": null,
"description": "## Using Composio With Lyzr\n\nIntegrate Composio with Lyzr agents to allow them to interact seamlessly with external apps, enhancing their functionality and reach.\n\n### Goal\n\n- **Star a repository on GitHub** using natural language commands through a LangChain Agent.\n\n### Installation and Setup\n\nEnsure you have the necessary packages installed and connect your GitHub account to allow your agents to utilize GitHub functionalities.\n\n```bash\n# Install Composio LangChain package\npip install composio-lyzr\n\n# Connect your GitHub account\ncomposio-cli add github\n\n# View available applications you can connect with\ncomposio-cli show-apps\n```\n\n### Usage\n\n```\nfrom lyzr_automata import Task, Agent\nfrom lyzr_automata.ai_models.openai import OpenAIModel\nfrom lyzr_automata.tasks.task_literals import InputType, OutputType\nfrom lyzr_automata.pipelines.linear_sync_pipeline import LinearSyncPipeline\n\nimport os\nimport dotenv\ndotenv.load_dotenv()\nfrom composio_lyzr import ComposioToolSet, App, Action\n\nopen_ai_text_completion_model = OpenAIModel(\n api_key=os.environ[\"OPENAI_API_KEY\"],\n parameters={\n \"model\": \"gpt-4-turbo-preview\",\n \"temperature\": 0.2,\n \"max_tokens\": 1500,\n },\n)\n\n\nlyzr_agent = Agent(\n role=\"Github Agent\",\n prompt_persona=\"You are AI agent that is responsible for taking actions on Github on users behalf. You need to take action on Github using Github APIs\"\n )\n\ncomposio_toolset = ComposioToolSet()\ncomposio_tool = composio_toolset.get_lyzr_tool(Action.GITHUB_STAR_REPO)\n\ntask = Task(\n name=\"Github Starring\",\n agent=lyzr_agent,\n tool=composio_tool,\n output_type=OutputType.TEXT,\n input_type=InputType.TEXT,\n model=open_ai_text_completion_model,\n instructions=\"Star a repo composiohq/composio on GitHub\",\n log_output=True,\n enhance_prompt=False,\n)\n\nlyzr_output = LinearSyncPipeline(\n name=\"Composio Lyzr\",\n\t\t# completion message after pipeline completes\n completion_message=\"Task completed\",\n tasks=[\n\t\t\t\t# tasks are instance of Task class\n task,\n ],\n).run()\n\nprint(lyzr_output)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Use Composio to get an array of tools with your Lyzr workflow.",
"version": "0.5.34",
"project_urls": {
"Homepage": "https://github.com/ComposioHQ/composio"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "784895edbd1d7996afaf414e915cf61c01316728f65dde2f999d340b26c5d7a9",
"md5": "223798c997dc46e15048c26fb6286257",
"sha256": "89c8f2a32cc8210e679ee782c538dc002a58c6a0e3ff5eb70d10a148752340c9"
},
"downloads": -1,
"filename": "composio_lyzr-0.5.34-py3-none-any.whl",
"has_sig": false,
"md5_digest": "223798c997dc46e15048c26fb6286257",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.9",
"size": 3708,
"upload_time": "2024-10-17T15:52:19",
"upload_time_iso_8601": "2024-10-17T15:52:19.971802Z",
"url": "https://files.pythonhosted.org/packages/78/48/95edbd1d7996afaf414e915cf61c01316728f65dde2f999d340b26c5d7a9/composio_lyzr-0.5.34-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f7d6ff4d60abaeb6c292abf3c319e5db343515bfe2986e7c57cbe18e15f81176",
"md5": "ee49b02272a88358abda615f07c25d3a",
"sha256": "4529caa1d751ed9d5b4249580779774e4c648eafdd895273b55656223b130331"
},
"downloads": -1,
"filename": "composio_lyzr-0.5.34.tar.gz",
"has_sig": false,
"md5_digest": "ee49b02272a88358abda615f07c25d3a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.9",
"size": 3445,
"upload_time": "2024-10-17T15:52:21",
"upload_time_iso_8601": "2024-10-17T15:52:21.471783Z",
"url": "https://files.pythonhosted.org/packages/f7/d6/ff4d60abaeb6c292abf3c319e5db343515bfe2986e7c57cbe18e15f81176/composio_lyzr-0.5.34.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-17 15:52:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ComposioHQ",
"github_project": "composio",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "composio-lyzr"
}