Metadata-Version: 2.1
Name: composio_core
Version: 0.5.38
Summary: Core package to act as a bridge between composio platform and other services.
Home-page: https://github.com/composiohq/composio
Author: Utkarsh
Author-email: utkarsh@composio.dev
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9,<4
Description-Content-Type: text/markdown
Requires-Dist: aiohttp
Requires-Dist: requests <3,>=2.31.0
Requires-Dist: jsonschema <5,>=4.21.1
Requires-Dist: sentry-sdk >=2.0.0
Requires-Dist: pysher ==1.0.8
Requires-Dist: pydantic <3,>=2.6.4
Requires-Dist: importlib-metadata >=4.8.1
Requires-Dist: jsonref >=1.1.0
Requires-Dist: inflection >=0.5.1
Requires-Dist: semver >=2.13.0
Requires-Dist: click
Requires-Dist: rich <14,>=13.7.1
Requires-Dist: pyperclip <2,>=1.8.2
Requires-Dist: paramiko >=3.4.1
Requires-Dist: fastapi
Requires-Dist: uvicorn
Provides-Extra: all
Requires-Dist: aiohttp ; extra == 'all'
Requires-Dist: requests <3,>=2.31.0 ; extra == 'all'
Requires-Dist: jsonschema <5,>=4.21.1 ; extra == 'all'
Requires-Dist: sentry-sdk >=2.0.0 ; extra == 'all'
Requires-Dist: pysher ==1.0.8 ; extra == 'all'
Requires-Dist: pydantic <3,>=2.6.4 ; extra == 'all'
Requires-Dist: importlib-metadata >=4.8.1 ; extra == 'all'
Requires-Dist: jsonref >=1.1.0 ; extra == 'all'
Requires-Dist: inflection >=0.5.1 ; extra == 'all'
Requires-Dist: semver >=2.13.0 ; extra == 'all'
Requires-Dist: click ; extra == 'all'
Requires-Dist: rich <14,>=13.7.1 ; extra == 'all'
Requires-Dist: pyperclip <2,>=1.8.2 ; extra == 'all'
Requires-Dist: paramiko >=3.4.1 ; extra == 'all'
Requires-Dist: fastapi ; extra == 'all'
Requires-Dist: uvicorn ; extra == 'all'
Requires-Dist: e2b <1,>=0.17.2a37 ; extra == 'all'
Requires-Dist: e2b-code-interpreter ; extra == 'all'
Requires-Dist: docker >=7.1.0 ; extra == 'all'
Requires-Dist: gql ; extra == 'all'
Requires-Dist: requests-toolbelt ; extra == 'all'
Requires-Dist: tree-sitter-languages ; extra == 'all'
Requires-Dist: tree-sitter ==0.21.3 ; extra == 'all'
Requires-Dist: pygments ; extra == 'all'
Requires-Dist: pathspec ; extra == 'all'
Requires-Dist: diskcache ; extra == 'all'
Requires-Dist: networkx ; extra == 'all'
Requires-Dist: ruff ; extra == 'all'
Requires-Dist: flake8 ; extra == 'all'
Requires-Dist: transformers ; extra == 'all'
Provides-Extra: docker
Requires-Dist: docker >=7.1.0 ; extra == 'docker'
Provides-Extra: e2b
Requires-Dist: e2b <1,>=0.17.2a37 ; extra == 'e2b'
Requires-Dist: e2b-code-interpreter ; extra == 'e2b'
Provides-Extra: flyio
Requires-Dist: gql ; extra == 'flyio'
Requires-Dist: requests-toolbelt ; extra == 'flyio'
Provides-Extra: tools
Requires-Dist: tree-sitter-languages ; extra == 'tools'
Requires-Dist: tree-sitter ==0.21.3 ; extra == 'tools'
Requires-Dist: pygments ; extra == 'tools'
Requires-Dist: pathspec ; extra == 'tools'
Requires-Dist: diskcache ; extra == 'tools'
Requires-Dist: networkx ; extra == 'tools'
Requires-Dist: ruff ; extra == 'tools'
Requires-Dist: flake8 ; extra == 'tools'
Requires-Dist: transformers ; extra == 'tools'

<p align="center">
  <a href="https://x.com/GanatraSoham/?utm_campaign=github-readme" target="_blank">
    <img src="./python/docs/imgs/follow_x.png" width="100%" alt="Follow me" />
  </a>
  <br /> <br />
</p>
<p align="center">
  <a href="https://app.composio.dev/?utm_campaign=github-readme" target="_blank">
    <img src="./python/docs/imgs/try_hosted.png" width="100%" alt="Sign up" />
  </a>

  <br /> <br />
</p>
<p>
  <a href="https://github.com/composiohq/composio/blob/master/README.md">EN</a> | <a href="https://github.com/composiohq/composio/blob/master/README-CN.md">CN</a> | <a href="https://github.com/composiohq/composio/blob/master/README-JP.md">JP</a>
</p>

<p align="center">
  <a href="https://composio.dev//#gh-dark-mode-only">
    <img src="./python/docs/imgs/composio_white_font.svg" width="318px" alt="Composio logo" />
  </a>
  <a href="https://composio.dev//#gh-light-mode-only">
    <img src="./python/docs/imgs/composio_black_font.svg" width="318px" alt="Composio Logo" />
  </a>
</p>
<p align="center">
  <a href="https://github.com/composiodev/composio/actions/workflows/common.yml">
  <img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/composiodev/composio/common.yml?label=Tests&style=plastic&logo=github&color=blue&cacheSeconds=60">
  </a>
  <a href="https://pypi.org/project/composio-core/">
  <img alt="PyPI" src="https://img.shields.io/pypi/v/composio_core?label=Latest&style=plastic&logo=pypi&color=blue&cacheSeconds=60&logoColor=white">
  </a>
  <a href="https://www.npmjs.com/package/composio-core">
  <img alt="NPM" src="https://img.shields.io/npm/v/composio-core?style=plastic&logo=npm&logoColor=white&label=latest&color=blue&cacheSeconds=60">
  </a>
  <a href="https://pypi.org/project/composio-core/">
  <img alt="Downloads" src="https://img.shields.io/pypi/dm/composio-core?label=Downloads&style=plastic&logo=github&color=blue&cacheSeconds=60">
  </a>
  
</p>

<h2 align="center"><i>
  Production Ready Toolset for AI Agents
</i></h2>

<h4 align="center">Equip your agent with high-quality tools & integrations without worrying about authentication, accuracy, and reliability in a single line of code!
</h4>
<div align="center">
<p>
<a href="https://docs.composio.dev" rel="dofollow"><strong>Explore the Docs »</strong></a>
</p>

<p>
<a href="https://app.composio.dev">Try on Dashboard</a> <b>|</b>
<a href="https://www.composio.dev">Homepage</a> <b>|</b>
<!-- <a href="https://docs.composio.dev/guides/examples">Examples</a> |
<a href="https://docs.composio.dev/chat-with-docs">Chat with Docs</a> | -->
<a href="https://docs.composio.dev/sdk">SDK</a> <b>|</b>
<a href="https://docs.composio.dev/api-reference/">APIs</a> 
</p>
</div>

<hr>
<div align="center">
<p >
    <b>✨ Socials >></b>
    <a href="https://dub.composio.dev/JoinHQ">Discord</a> <b>|</b>
    <a href="https://www.youtube.com/@Composio">Youtube</a> <b>|</b>
    <a href="https://twitter.com/composiohq">Twitter</a> <b>|</b>
    <a href="https://www.linkedin.com/company/composio-dev"> Linkedin </a>
</p>
<p align="center">
    <b>⛏️ Contribute >></b>
    <a href="https://github.com/composiodev/composio/issues/new?assignees=&labels=type%3A+bug&template=bug_report.yml&title=%F0%9F%90%9B+Bug+Report%3A+">Report Bugs</a> <b>|</b>
    <a href="https://github.com/composiodev/composio/issues/new?assignees=&labels=feature&template=feature_request.yml&title=%F0%9F%9A%80+Feature%3A+">Request Feature</a> <b>|</b>
    <a href="https://github.com/composiodev/composio/blob/master/CONTRIBUTING.md">Contribute</a>
</p>
</div>

## 📋 Table of contents

- [📋 Table of contents](#-table-of-contents)
- [🤔 Why Composio?](#-why-composio)
- [🔥 Key Features](#-key-features)
- [🚀 Getting Started with Python](#-getting-started-with-python)
  - [1. Installation](#1-installation)
  - [2. Testing Composio in Action](#2-testing-composio-in-action)
- [🚀 Getting Started with Javascript](#-getting-started-with-javascript)
  - [1. **Install the Composio SDK**:](#1-install-the-composio-sdk)
  - [2. **Setup the OpenAI and Composio Tool Set**:](#2-setup-the-openai-and-composio-tool-set)
  - [3. **Run your script**:](#3-run-your-script)
- [💡 Examples](#-examples)
  - [Python Examples](#python-examples)
  - [Javascript Examples](#javascript-examples)
- [Star History](#star-history)
- [📋 Read Our Code Of Conduct](#-read-our-code-of-conduct)
- [🤗 Contributions](#-contributions)
- [🔗 Links](#-links)
- [🛡️ License](#️-license)
- [💪 Thanks To All Contributors](#-thanks-to-all-contributors)

## 🤔 Why Composio?

We believe AI Based Agents/Workflows are the future.
Composio is the best toolset to integrate AI Agents to best Agentic Tools and use them to accomplish tasks.

<img alt="Illustration" src="./python/docs/imgs/banner.gif" style="border-radius: 5px"/>

## 🔥 Key Features

- **100+ Tools**: Support for a range of different categories

  - **Software**: Do anything on GitHub, Notion, Linear, Gmail, Slack, Hubspot, Salesforce, & 90 more.
  - **OS**: Click anywhere, Type anything, Copy to Clipboard, & more.
  - **Browser**: Smart Search, Take a screenshot, MultiOn, Download, Upload, & more.
  - **Search**: Google Search, Perplexity Search, Tavily, Exa & more.
  - **SWE**: Ngrok, Database, Redis, Vercel, Git, etc.
  - **RAG**: Agentic RAG for any type of data on the fly!

- **Frameworks**: Use tools with agent frameworks like **OpenAI, Groq (OpenAI compatible), Claude, LlamaIndex, Langchain, CrewAI, Autogen, Gemini, Julep, Lyzr**, and more in a single line of code.
- **Managed Authorisation**: Supports six different auth protocols. _Access Token, Refresh token, OAuth, API Keys, JWT, and more_ abstracted out so you can focus on the building agents.
- **Accuracy**: Get _up to 40% better agentic accuracy_ in your tool calls due to better tool designs.
- **Embeddable**: Whitelabel in the backend of your applications managing Auth & Integrations for all your users & agents and maintain a consistent experience.
- **Pluggable**: Designed to be extended with additional Tools, Frameworks and Authorisation Protocols very easily.

## 🚀 Getting Started with Python

### 1. Installation

To get started, type the following command in your Terminal.

```bash
pip install composio-core
```

If you want to install the 'composio' package along with its openai plugin: `pip install composio-openai`.

### 2. Testing Composio in Action

Let's use Composio to create an AI Agent that can star a Github Repo.

```bash
composio add github # Connect your Github - Run this in terminal
```

```python

from openai import OpenAI
from composio_openai import ComposioToolSet, App, Action

openai_client = OpenAI(
    api_key="{{OPENAIKEY}}"
)

# Initialise the Composio Tool Set

composio_tool_set = ComposioToolSet()

# Get GitHub tools that are pre-configured
actions = composio_tool_set.get_actions(
    actions=[Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER]
)

my_task = "Star a repo composiodev/composio on GitHub"

# Setup openai assistant
assistant_instruction = "You are a super intelligent personal assistant"

assistant = openai_client.beta.assistants.create(
    name="Personal Assistant",
    instructions=assistant_instruction,
    model="gpt-4-turbo",
    tools=actions,
)

# create a thread
thread = openai_client.beta.threads.create()

message = openai_client.beta.threads.messages.create(
    thread_id=thread.id,
    role="user",
    content=my_task
)

# Execute Agent with integrations
run = openai_client.beta.threads.runs.create(
    thread_id=thread.id,
    assistant_id=assistant.id
)


# Execute Function calls
response_after_tool_calls = composio_tool_set.wait_and_handle_assistant_tool_calls(
    client=openai_client,
    run=run,
    thread=thread,
)

print(response_after_tool_calls)
```

## 🚀 Getting Started with Javascript

To get started with the Composio SDK in Javascript, follow these steps:

### 1. **Install the Composio SDK**:
   ```bash
   npm install composio-core
   ```

### 2. **Setup the OpenAI and Composio Tool Set**:
   ```javascript
   import { OpenAI } from "openai";
   import { OpenAIToolSet } from "composio-core";

   const toolset = new OpenAIToolSet({
       apiKey: process.env.COMPOSIO_API_KEY,
   });

   async function setupUserConnectionIfNotExists(entityId) {
       const entity = await toolset.client.getEntity(entityId);
       const connection = await entity.getConnection('github');

       if (!connection) {
           // If this entity/user hasn't already connected the account
           const connection = await entity.initiateConnection(appName);
           console.log("Log in via: ", connection.redirectUrl);
           return connection.waitUntilActive(60);
       }

       return connection;
   }

   async function executeAgent(entityName) {
       const entity = await toolset.client.getEntity(entityName)
       await setupUserConnectionIfNotExists(entity.id);

       const tools = await toolset.get_actions({ actions: ["github_issues_create"] }, entity.id);
       const instruction = "Make an issue with sample title in the repo - himanshu-dixit/custom-repo-breaking"

       const client = new OpenAI({ apiKey: process.env.OPEN_AI_API_KEY })
       const response = await client.chat.completions.create({
           model: "gpt-4-turbo",
           messages: [{
               role: "user",
               content: instruction,
           }],
           tools: tools,
           tool_choice: "auto",
       })

       console.log(response.choices[0].message.tool_calls);
       await toolset.handle_tool_call(response, entity.id);
   }

   executeAgent("your-entity-name");
   ```

### 3. **Run your script**:
   ```bash
   node your_script.js
   ```

This will set up the Composio SDK and execute an agent that creates a GitHub issue using the provided instructions.

For more details, refer to the [Composio SDK Documentation](https://docs.composio.dev/).


## 💡 Examples

### [Python Examples](https://docs.composio.dev/guides/python/)

### [Javascript Examples](https://docs.composio.dev/guides/javascript/)



## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=composiohq/composio&type=Date)](https://star-history.com/#composiohq/composio&Date)


## 📋 Read Our Code Of Conduct

As part of our open-source community, we hold ourselves and other contributors to a high standard of communication. As a participant and contributor to this project, you agree to abide by our [Code of Conduct](https://github.com/composiodev/composio/blob/master/CODE_OF_CONDUCT.md).

## 🤗 Contributions

Composio is open-source and we welcome contributions. Please fork the repository, create a new branch for your feature, add your feature or improvement, and send a pull request.

Also go through our [Contribution Guidelines](https://github.com/composiodev/composio/blob/master/CONTRIBUTING.md) and [Code of Conduct](https://github.com/composiodev/composio/blob/master/CODE_OF_CONDUCT.md) before you start.

## 🔗 Links

- [Home page](https://composio.dev?utm_campaign=github-readme)
- [Contribution Guidelines](https://github.com/composiodev/composio/blob/master/CONTRIBUTING.md)
- [Docs](https://docs.composio.dev/?utm_campaign=github-readme)

## 🛡️ License

Composio is licensed under the Elastic License - see the [LICENSE](https://github.com/composiodev/composio/blob/master/LICENSE) file for details.

## 💪 Thanks To All Contributors

<a href="https://github.com/composiohq/composio/graphs/contributors">
  <img src="https://contributors-img.web.app/image?repo=composiodev/composio" alt="List of Contributors"/>
</a>
