Skip to content

Composio equip's your AI agents & LLMs with 100+ high-quality integrations via function calling

License

Notifications You must be signed in to change notification settings

ComposioHQ/composio

Repository files navigation

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

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