Composio provides production-ready toolset for AI agents, offering:
- Support for over 250+ tools across multiple categories:
- 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
- Getting Started with Python
- Getting Started with Javascript
- Examples
- Star History
- Getting help
- Contributions
- Request a feature
- Thanks To All Contributors
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
.
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
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)
To get started with the Composio SDK in JavaScript, follow these steps:
npm install composio-core
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'"
);
})();
- Read the docs at docs.composio.dev
- Post your questions on discord
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.
- 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.