Skip to main content

Core package to act as a bridge between composio platform and other services.

Project description

EN | CN | JP

Composio logo Composio Logo

Read the Docs

PyPI NPM Downloads

Production Ready Toolset for AI Agents

Composio MCP Servers

Composio Cursor

🚀 Now launching Composio MCP🚀

We're excited to announce the launch of Composio MCP Servers! Connect Claude, Cursor and Windsurf to 100+ fully-managed MCP Servers with built-in auth! Check it out here

Learn More About MCP Servers

What is Composio?

Composio provides production-ready toolset for AI agents, offering:

  • Support for over 250+ tools across multiple categories:
    • Software tools like GitHub, Notion, Linear, Gmail, Slack, Hubspot, Salesforce & more
    • OS operations including file tool, shell tool, code analysis tool & more
    • Search capabilities through Google, Perplexity, Tavily, and Exa & more
  • Comprehensive framework support including OpenAI, Groq, Claude, LlamaIndex, Langchain, CrewAI, Autogen, Gemini, and more
  • Managed authentication supporting multiple protocols (OAuth, API Keys, Basic JWT)
  • Up to 40% improved tool call accuracy through optimized design
  • Whitelabel solution for backend integration
  • Pluggable architecture supporting custom tools and extensions

Table of contents

Getting Started with Python

1. Installation

Start by installing the package

pip install composio-core

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

2. Creating an agent & executing a tool

Let's create an AI Agent using OpenAI and use Composio's GitHub tool to star a GitHub repository

[!NOTE] Set your COMPOSIO_API_KEY & OPENAI_API_KEY in your environment variables.

Connect your GitHub account to Composio

composio add github # Run this in terminal
from openai import OpenAI
from composio_openai import ComposioToolSet, App, Action

# Initialize OpenAI client
openai_client = OpenAI(
    api_key="{{OPENAIKEY}}"
)

# Initialize 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()

# Add user message to thread
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. Installation:

npm install composio-core

2. Creating an agent & executing a tool

Let's create an AI Agent using OpenAI and use Composio's GitHub tool to star a GitHub repository

[!NOTE] Set your COMPOSIO_API_KEY & OPENAI_API_KEY in your environment variables.

Connect your GitHub account to Composio

composio add github # Run this in terminal
import { OpenAIToolSet } from "composio-core";
import OpenAI from "openai";

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

const tools = await toolset.getTools({ 
  actions: ["GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER"] 
});

async function createGithubAssistant(openai, tools) {
  return await openai.beta.assistants.create({
    name: "Github Assistant",
    instructions: "You're a GitHub Assistant, you can do operations on GitHub",
    tools: tools,
    model: "gpt-4o"
  });
}

async function executeAssistantTask(openai, toolset, assistant, task) {
  const thread = await openai.beta.threads.create();
  
  const run = await openai.beta.threads.runs.create(thread.id, {
    assistant_id: assistant.id,
    instructions: task,
    tools: tools,
    model: "gpt-4o",
    stream: false
  });
  
  const call = await toolset.waitAndHandleAssistantToolCalls(openai, run, thread);
  console.log(call);
}

(async () => {
  const githubAssistant = await createGithubAssistant(openai, tools);
  
  await executeAssistantTask(
    openai,
    toolset,
    githubAssistant,
    "Star the repository 'composiohq/composio'"
  );
})();

Examples

Python Examples

Javascript Examples

Star History

Star History Chart

Getting help

Contributions

We're an open-source project and welcome contributions. Please read the contributing guide for more information and check our code of conduct before you start.

Request a feature

  • If you have a feature request, please open an issue, make a pull request, or submit it in our feature requests channel.
  • If you have ideas for improvements, you can also start a discussion in our GitHub repository.

Thanks To All Contributors

List of Contributors



discord     youtube     x     linkedin

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

composio_core-0.7.19.tar.gz (334.6 kB view details)

Uploaded Source

Built Distribution

composio_core-0.7.19-py3-none-any.whl (501.1 kB view details)

Uploaded Python 3

File details

Details for the file composio_core-0.7.19.tar.gz.

File metadata

  • Download URL: composio_core-0.7.19.tar.gz
  • Upload date:
  • Size: 334.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for composio_core-0.7.19.tar.gz
Algorithm Hash digest
SHA256 e20480ceb8afea6d94d02e76c4c4bb489e3aca48dc8bc0d9d50c834e20a96d84
MD5 09f47234e83d6d1b0c21e99910e6ed58
BLAKE2b-256 9be051b3b9a31ac42ec3f5f400073efc35279f3b49445dcbedba3b76ba16b3c7

See more details on using hashes here.

File details

Details for the file composio_core-0.7.19-py3-none-any.whl.

File metadata

  • Download URL: composio_core-0.7.19-py3-none-any.whl
  • Upload date:
  • Size: 501.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for composio_core-0.7.19-py3-none-any.whl
Algorithm Hash digest
SHA256 7170bc801eda09b153fde2276ba2a44fb164c74ba5d40a727b826c033c490fb3
MD5 a52a24cbfed21708a910184d342ca00e
BLAKE2b-256 1182dba09e2ab6293d8898eb0ace32282709fd2803969fa8caa4fbd70dcaa9e8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page