MyGit

ComposioHQ/composio

Fork: 4258 Star: 13564 (更新于 2024-12-15 16:40:10)

license: NOASSERTION

Language: Python .

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

最后发布版本: v0.5.11 ( 2024-08-31 19:36:23)

官方网址 GitHub网址

Follow me

Sign up



EN | CN | JP

Composio logo Composio Logo

Tests PyPI NPM Downloads

Production Ready Toolset for AI Agents

Equip your agent with high-quality tools & integrations without worrying about authentication, accuracy, and reliability in a single line of code!

Explore the Docs »

Try on Dashboard | Homepage | SDK | APIs


✨ Socials >> Discord | Youtube | Twitter | Linkedin

⛏️ Contribute >> Report Bugs | Request Feature | Contribute

📋 Table of contents

🤔 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.

Illustration

🔥 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.

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.

composio add github # Connect your 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)

🚀 Getting Started with Javascript

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

1. Install the Composio SDK:

npm install composio-core

2. Setup the OpenAI and Composio Tool Set:

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:

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.

💡 Examples

Python Examples

Javascript Examples

Star History

Star History Chart

📋 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.

🤗 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 and Code of Conduct before you start.

🔗 Links

🛡️ License

Composio is licensed under the Elastic License - see the LICENSE file for details.

💪 Thanks To All Contributors

List of Contributors

最近版本更新:(数据更新于 2024-09-03 03:59:57)

2024-08-31 19:36:23 v0.5.11

2024-08-29 19:24:12 v0.5.10

2024-08-28 21:42:56 v0.5.9

2024-08-28 04:15:13 v0.5.8

2024-08-28 00:21:19 v0.5.7

2024-08-25 16:12:44 v0.5.6

2024-08-24 23:06:40 v0.5.5

2024-08-24 12:26:56 v0.5.4

2024-08-23 01:39:23 v0.5.3

2024-08-22 18:08:49 v0.5.2

主题(topics):

agents, ai, ai-agents, aiagents, developer-tools, function-calling, gpt-4, gpt-4o, hacktoberfest, hacktoberfest2024, javascript, js, llm, llmops, python, typescript

ComposioHQ/composio同语言 Python最近更新仓库

2024-12-22 09:03:32 ultralytics/ultralytics

2024-12-21 13:26:40 notepad-plus-plus/nppPluginList

2024-12-21 11:42:53 XiaoMi/ha_xiaomi_home

2024-12-21 04:33:22 comfyanonymous/ComfyUI

2024-12-20 18:47:56 home-assistant/core

2024-12-20 15:41:40 jxxghp/MoviePilot