Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 03:37 UTC
| 1 | # Composio SDK v3 Documentation |
| 2 | |
| 3 | Composio SDK is a powerful toolkit that enables you to integrate third-party tools and services into your applications. This SDK helps you connect to various services (toolkits), execute tools, and manage user connections seamlessly. |
| 4 | |
| 5 | ## Table of Contents |
| 6 | |
| 7 | - [Overview](#overview) |
| 8 | - [Installation](#installation) |
| 9 | - [Core Concepts](#core-concepts) |
| 10 | - [Getting Started](#getting-started) |
| 11 | - [API Reference](#api-reference) |
| 12 | - [Providers](#providers) |
| 13 | - [Examples](#examples) |
| 14 | - [Advanced Topics](#advanced-topics) |
| 15 | - [Internal Documentation](#internal-documentation) |
| 16 | |
| 17 | ## Overview |
| 18 | |
| 19 | Composio SDK allows you to: |
| 20 | |
| 21 | - Execute tools from various services (like GitHub, Gmail, Slack, etc.) |
| 22 | - Manage user connections to external services |
| 23 | - Create session-scoped custom tools |
| 24 | - Implement triggers and event handlers |
| 25 | - Integrate with AI providers like OpenAI |
| 26 | |
| 27 | The SDK is designed to be flexible and extensible, allowing you to integrate it into various types of applications. |
| 28 | |
| 29 | ## Installation |
| 30 | |
| 31 | ```bash |
| 32 | npm install @composio/core |
| 33 | ``` |
| 34 | |
| 35 | ## Core Concepts |
| 36 | |
| 37 | The Composio SDK is built around several key concepts: |
| 38 | |
| 39 | - **UserIds**: Unique identifier for a user in your application (eg. UUID for a user in your database) |
| 40 | - **Tools**: Individual actions that can be performed (e.g., "Get GitHub Repository", "Send Email") |
| 41 | - **Toolkits**: Collections of related tools (e.g., GitHub, Gmail) |
| 42 | - **Connected Accounts**: User connections to external services |
| 43 | - **Auth Configs**: Authentication configurations for external services |
| 44 | - **Providers**: Adapters for AI services that can use tools (e.g., OpenAI) |
| 45 | - **Custom Tools**: Session-scoped local tools created with `experimental_createTool` |
| 46 | - **MCP**: Create and manage MCP Servers and clients |
| 47 | |
| 48 | Check out the [Core Concepts](./core-concepts.md) documentation for more detailed information. |
| 49 | |
| 50 | ## Getting Started |
| 51 | |
| 52 | Here's a quick example of how to use the Composio SDK: |
| 53 | |
| 54 | ```typescript |
| 55 | import { Composio } from '@composio/core'; |
| 56 | |
| 57 | // Initialize the SDK |
| 58 | const composio = new Composio({ |
| 59 | apiKey: 'your-api-key', |
| 60 | }); |
| 61 | |
| 62 | // Get tools from a specific toolkit |
| 63 | const tools = await composio.tools.get('default', { |
| 64 | toolkits: ['github'], |
| 65 | }); |
| 66 | |
| 67 | // Execute a tool |
| 68 | const result = await composio.tools.execute('GITHUB_GET_REPO', { |
| 69 | userId: 'default', |
| 70 | arguments: { |
| 71 | owner: 'composio', |
| 72 | repo: 'sdk', |
| 73 | }, |
| 74 | }); |
| 75 | |
| 76 | console.log(result.data); |
| 77 | ``` |
| 78 | |
| 79 | For more detailed examples and tutorials, check out the [Getting Started](./getting-started.md) guide. |
| 80 | |
| 81 | ## API Reference |
| 82 | |
| 83 | The complete API reference documentation is available here: |
| 84 | |
| 85 | - [Composio Class](./api/composio.md) |
| 86 | - [Tools](./api/tools.md) |
| 87 | - [Toolkits](./api/toolkits.md) |
| 88 | - [Connected Accounts](./api/connected-accounts.md) |
| 89 | - [Auth Configs](./api/auth-configs.md) |
| 90 | - [Providers](./api/providers.md) |
| 91 | - [MCP](./api/mcp.md) |
| 92 | - [ToolRouter](./api/tool-router.md) |
| 93 | - [Tool Router Session Files](./api/tool-router-files.md) |
| 94 | |
| 95 | ## Providers |
| 96 | |
| 97 | Composio SDK comes with built-in support for different providers: |
| 98 | |
| 99 | ### Non-Agentic Providers |
| 100 | |
| 101 | - [OpenAI Provider](../packages/providers/openai/README.md) - OpenAI integration with GPT-4, GPT-3.5, etc. |
| 102 | - [Anthropic Provider](../packages/providers/anthropic/README.md) - Anthropic Claude integration |
| 103 | - [Google Provider](../packages/providers/google/README.md) - Google Gemini integration |
| 104 | - [Cloudflare Provider](../packages/providers/cloudflare/README.md) - Cloudflare Workers AI integration |
| 105 | - [TypeSafe Provider](../packages/providers/typesafe/README.md) - TypeSafe Jev integration: decides a tool call, a partial call, or an abstention with a confidence |
| 106 | |
| 107 | ### Agentic Providers |
| 108 | |
| 109 | - [LangChain Provider](../packages/providers/langchain/README.md) - LangChain integration with LCEL support |
| 110 | - [Mastra Provider](../packages/providers/mastra/README.md) - Agentic provider for autonomous behavior |
| 111 | - [Vercel Provider](../packages/providers/vercel/README.md) - Vercel AI SDK integration |
| 112 | |
| 113 | ## Examples |
| 114 | |
| 115 | Check out our [examples directory](../examples) for complete code samples: |
| 116 | |
| 117 | - [Connected Accounts](../examples/connected-accounts) |
| 118 | - [OpenAI Integration](../examples/openai) |
| 119 | - [LangChain Integration](../examples/langchain) |
| 120 | - [Toolkits](../examples/toolkits) |
| 121 | - [Triggers](../examples/triggers) |
| 122 | - [Modifiers](../examples/modifiers) |
| 123 | |
| 124 | ## Advanced Topics |
| 125 | |
| 126 | - [Error Handling](./advanced/error-handling.md) |
| 127 | - [Telemetry](./advanced/telemetry.md) |
| 128 | - [Custom Providers](./advanced/custom-providers.md) |
| 129 | - [Modifiers](./advanced/modifiers.md) |
| 130 | - [Session Management](./advanced/session-management.md) |
| 131 | - [Webhook Verification](./advanced/webhook-verification.md) |
| 132 | |
| 133 | ## Internal Documentation |
| 134 | |
| 135 | For SDK maintainers and contributors: |
| 136 | |
| 137 | - [Configuration and Environment Variables](./internal/configuration.md) - Detailed guide on SDK configuration |
| 138 | - [Triggers Implementation](./internal/triggers.md) - Internal workings of the trigger system |