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 23, 03:00 UTC
Update readme.md
haxzie committed
May 15, 2025 at 18:35 UTC
83ed783a1c1682ccbf09d35314c9083524fcd7a7
2 files changed
+250
-93
README.md
+127
-9
@@ -1,7 +1,133 @@
1
-# @composio/core
1
+# Composio SDK
2
3
The core Composio SDK which allows users to interact with the Composio Platform. It provides a powerful and flexible way to manage and execute tools, handle authentication, and integrate with various platforms and frameworks.
4
5
+## Project Structure
6
+
7
+```
8
+composio/
9
+├── packages/ # Main packages directory
10
+│ ├── core/ # Core SDK package
11
+│ │ └── core/ # Core SDK package
12
+│ ├── toolsets/ # Toolset implementations
13
+│ │ ├── openai/ # OpenAI toolset
14
+│ │ ├── vercel/ # Vercel AI toolset
15
+│ │ ├── langchain/ # LangChain toolset
16
+│ │ └── cloudflare/ # Cloudflare toolset
17
+│ └── wrappers/ # Runtime-specific wrappers
18
+├── examples/ # Example implementations
19
+│ ├── langchain/ # LangChain example
20
+│ ├── openai/ # OpenAI example
21
+│ ├── pre-processors/ # Pre-processors example
22
+│ └── vercel/ # Vercel AI example
23
+├── scripts/ # Development and build scripts
24
+└── .github/ # GitHub configuration
25
+```
26
+
27
+## Development Setup
28
+
29
+1. **Prerequisites**
30
+
31
+ - Node.js (Latest LTS version recommended)
32
+ - [pnpm](https://pnpm.io/) (v10.8.0 or later)
33
+ - [bun](https://bun.sh) for productivity (optional)
34
+
35
+2. **Clone and Install**
36
+
37
+ ```bash
38
+ git clone https://github.com/ComposioHQ/sdk-v3-ts.git
39
+ cd composio
40
+ pnpm install
41
+ ```
42
+
43
+3. **Build**
44
+
45
+ ```bash
46
+ pnpm build
47
+ ```
48
+
49
+4. **Development Commands**
50
+
51
+ ```bash
52
+ # Lint code
53
+ pnpm lint
54
+
55
+ # Fix linting issues
56
+ pnpm lint:fix
57
+
58
+ # Format code
59
+ pnpm format
60
+
61
+ # Create a new toolset
62
+ pnpm create-toolset <toolset-name> [--agentic]
63
+
64
+ # Check peer dependencies
65
+ pnpm check:peer-deps
66
+
67
+ # Update peer dependencies
68
+ pnpm update:peer-deps
69
+ ```
70
+
71
+## Creating a New Toolset
72
+
73
+1. Use the create-toolset script:
74
+
75
+ ```bash
76
+ pnpm create-toolset my-toolset [--agentic]
77
+ ```
78
+
79
+2. The script will create a new toolset in `packages/toolsets/my-toolset` with:
80
+
81
+ - Basic toolset implementation
82
+ - TypeScript configuration
83
+ - Package configuration
84
+ - README template
85
+
86
+3. Implement the required methods in `src/index.ts`:
87
+ - For non-agentic toolsets: `wrapTool` and `wrapTools`
88
+ - For agentic toolsets: `wrapTool`, `wrapTools`, and execution handlers
89
+
90
+## Release Process
91
+
92
+1. **Prepare for Release**
93
+
94
+ - Ensure all changes are committed
95
+ - Run tests and checks:
96
+ ```bash
97
+ pnpm build
98
+ pnpm check:peer-deps
99
+ ```
100
+
101
+2. **Create Changeset**
102
+
103
+ ```bash
104
+ pnpm changeset
105
+ ```
106
+
107
+ - Follow the prompts to describe your changes
108
+ - Commit the generated changeset file
109
+
110
+3. **Publish**
111
+ ```bash
112
+ # This will:
113
+ # 1. Build all packages
114
+ # 2. Check peer dependencies
115
+ # 3. Publish packages to npm
116
+ pnpm run publish
117
+ ```
118
+
119
+## Contributing
120
+
121
+We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for more details.
122
+
123
+## License
124
+
125
+ISC License
126
+
127
+## Support
128
+
129
+For support, please visit our [Documentation](https://docs.composio.dev) or join our [Discord Community](https://discord.gg/composio).
130
+
131
## Core Features
132
133
- **Tools**: Manage and execute tools within the Composio ecosystem. Includes functionality to list, retrieve, and execute tools.
@@ -298,11 +424,3 @@ pnpm create-toolset my-toolset --agentic
424
- `COMPOSIO_LOGGING_LEVEL`: Logging level (silent, error, warn, info, debug)
425
- `DEVELOPMENT`: Development mode flag
426
- `CI`: CI environment flag
301
-
302
-## License
303
-
304
-ISC License
305
-
306
-## Support
307
-
308
-For support, please visit our [Documentation](https://docs.composio.dev) or join our [Discord Community](https://discord.gg/composio).
scripts/create-toolset.sh
+123
-84
@@ -23,9 +23,9 @@ mkdir -p "$TOOLSET_PATH/src"
23
# Create package.json
24
cat > "$TOOLSET_PATH/package.json" << EOL
25
{
26
- "name": "@composio/${TOOLSET_NAME}-toolset",
27
- "version": "1.0.0",
28
- "description": "${IS_AGENTIC:+Agentic }Toolset for ${TOOLSET_NAME}",
26
+ "name": "@composio/${TOOLSET_NAME}",
27
+ "version": "0.1.0",
28
+ "description": "${IS_AGENTIC:+Agentic }Toolset for ${TOOLSET_NAME} in Composio SDK",
29
"main": "src/index.ts",
30
"type": "module",
31
"publishConfig": {
@@ -40,6 +40,10 @@ cat > "$TOOLSET_PATH/package.json" << EOL
40
"require": "./dist/index.cjs"
41
}
42
},
43
+ "files": [
44
+ "README.md",
45
+ "dist"
46
+ ],
47
"scripts": {
48
"build": "tsup",
49
"test": "echo \\"Error: no test specified\\" && exit 1"
@@ -48,12 +52,13 @@ cat > "$TOOLSET_PATH/package.json" << EOL
52
"author": "",
53
"license": "ISC",
54
"packageManager": "pnpm@10.8.0",
55
+ "peerDependencies": {
56
+ "@composio/core": "^0.1.0"
57
+ },
58
"devDependencies": {
59
+ "@composio/core": "workspace:*",
60
"tsup": "^8.4.0",
61
"typescript": "^5.8.3"
54
- },
55
- "dependencies": {
56
- "@composio/core": "workspace:^"
62
}
63
}
64
EOL
@@ -61,17 +66,18 @@ EOL
66
# Create tsconfig.json
67
cat > "$TOOLSET_PATH/tsconfig.json" << EOL
68
{
69
+ "extends": "../../../tsconfig.base.json",
70
"compilerOptions": {
71
"target": "ESNext",
72
"module": "ESNext",
73
"declaration": true,
74
"declarationDir": "./dist",
75
"outDir": "./dist",
70
- "rootDir": "./src",
76
"strict": true,
77
"esModuleInterop": true,
78
"moduleResolution": "node",
74
- "skipLibCheck": true
79
+ "skipLibCheck": true,
80
+ "resolveJsonModule": true
81
},
82
"include": ["src"]
83
}
@@ -93,119 +99,152 @@ EOL
99
100
# Create src/index.ts
101
cat > "$TOOLSET_PATH/src/index.ts" << EOL
96
-import { ${IS_AGENTIC:+BaseAgenticToolset}${!IS_AGENTIC:+BaseNonAgenticToolset} } from "@composio/core";
97
-import type { Tool, ToolListParams } from "@composio/core";
98
-import type { ${IS_AGENTIC:+ModifiersParams}${!IS_AGENTIC:+SchemaModifiersParams} } from "@composio/core";
99
-
100
-interface ToolType {
101
- // Add your tool type here
102
-}
103
-
104
-interface ToolCollection {
105
- // Add your tool collection here
106
-}
107
-
102
/**
103
* ${CAPITAL_TOOLSET_NAME} Toolset
110
- * ${IS_AGENTIC:+This is an agentic toolset that supports full modifier capabilities.}
111
-${!IS_AGENTIC:+This is a non-agentic toolset that only supports schema modifiers.}
112
- *
113
- * @example
114
- * \`\`\`typescript
115
- * import { Composio } from "@composio/core";
116
- * import { ${CAPITAL_TOOLSET_NAME}Toolset } from "@composio/${TOOLSET_NAME}-toolset";
117
- *
118
- * const composio = new Composio({
119
- * apiKey: "your-api-key",
120
- * toolset: new ${CAPITAL_TOOLSET_NAME}Toolset()
121
- * });
122
- * \`\`\`
104
+ *
105
+ * This toolset provides a set of tools for interacting with ${CAPITAL_TOOLSET_NAME}.
106
+ *
107
+ * @packageDocumentation
108
+ * @module toolsets/${TOOLSET_NAME}
109
*/
124
-export class ${CAPITAL_TOOLSET_NAME}Toolset extends ${IS_AGENTIC:+BaseAgenticToolset}${!IS_AGENTIC:+BaseNonAgenticToolset}<ToolCollection, ToolType> {
125
- static FRAMEWORK_NAME = "${TOOLSET_NAME}";
126
- readonly FILE_NAME: string = "toolsets/${TOOLSET_NAME}/src/index.ts";
110
+import { ${IS_AGENTIC:+BaseAgenticToolset}${!IS_AGENTIC:+BaseNonAgenticToolset}, Tool${IS_AGENTIC:+, ExecuteToolFn} } from '@composio/core';
111
+
112
+${IS_AGENTIC:+interface ${CAPITAL_TOOLSET_NAME}Tool {
113
+ // Add your tool type here
114
+}}${!IS_AGENTIC:+interface ${CAPITAL_TOOLSET_NAME}Tool {
115
+ // Add your tool type here
116
+}}
117
+
118
+${IS_AGENTIC:+interface ${CAPITAL_TOOLSET_NAME}ToolCollection {
119
+ // Add your tool collection type here
120
+}}${!IS_AGENTIC:+type ${CAPITAL_TOOLSET_NAME}ToolCollection = Array<${CAPITAL_TOOLSET_NAME}Tool>}
121
+
122
+export class ${CAPITAL_TOOLSET_NAME}Toolset extends ${IS_AGENTIC:+BaseAgenticToolset}${!IS_AGENTIC:+BaseNonAgenticToolset}<${CAPITAL_TOOLSET_NAME}ToolCollection, ${CAPITAL_TOOLSET_NAME}Tool> {
123
+ readonly name = '${TOOLSET_NAME}';
124
125
/**
129
- * Wraps a tool in the toolset format.
130
- * This method is implemented by the toolset.
126
+ * Wrap a tool in the ${TOOLSET_NAME} format.
127
* @param tool - The tool to wrap.
128
* @returns The wrapped tool.
129
*/
134
- wrapTool = (tool: Tool): ToolType => {
135
- return tool as ToolType;
136
- }
130
+ ${IS_AGENTIC:+wrapTool(tool: Tool, executeTool: ExecuteToolFn): ${CAPITAL_TOOLSET_NAME}Tool {
131
+ return {
132
+ // Implement your tool wrapping logic here
133
+ } as ${CAPITAL_TOOLSET_NAME}Tool;
134
+ }}${!IS_AGENTIC:+wrapTool(tool: Tool): ${CAPITAL_TOOLSET_NAME}Tool {
135
+ return {
136
+ // Implement your tool wrapping logic here
137
+ } as ${CAPITAL_TOOLSET_NAME}Tool;
138
+ }}
139
140
/**
139
- * Get all the tools from the Composio API
140
- * @param params - The query parameters to get the tools
141
- * @param modifiers - ${IS_AGENTIC:+Full modifiers to apply to the tools}${!IS_AGENTIC:+Schema modifiers to apply to the tools}
142
- * @returns The tools
141
+ * Wrap a list of tools in the ${TOOLSET_NAME} format.
142
+ * @param tools - The tools to wrap.
143
+ * @returns The wrapped tools.
144
*/
144
- getTools = async (
145
- params?: ToolListParams,
146
- modifiers?: ${IS_AGENTIC:+ModifiersParams}${!IS_AGENTIC:+SchemaModifiersParams}
147
- ): Promise<ToolCollection> => {
148
- return [];
149
- }
150
-
151
- /**
152
- * Get a tool from the Composio API by its slug
153
- * @param slug - The slug of the tool to get
154
- * @param modifiers - ${IS_AGENTIC:+Full modifiers to apply to the tool}${!IS_AGENTIC:+Schema modifiers to apply to the tool}
155
- * @returns The tool
156
- */
157
- getToolBySlug = async (
158
- slug: string,
159
- modifiers?: ${IS_AGENTIC:+ModifiersParams}${!IS_AGENTIC:+SchemaModifiersParams}
160
- ): Promise<ToolType> => {
161
- const tool = await this.getComposio().tools.getToolBySlug(slug, modifiers?.schema);
162
- return this.wrapTool(tool);
163
- }
145
+ ${IS_AGENTIC:+wrapTools(tools: Tool[], executeTool: ExecuteToolFn): ${CAPITAL_TOOLSET_NAME}ToolCollection {
146
+ return tools.reduce((acc, tool) => {
147
+ // Implement your tool collection wrapping logic here
148
+ return acc;
149
+ }, {} as ${CAPITAL_TOOLSET_NAME}ToolCollection);
150
+ }}${!IS_AGENTIC:+wrapTools(tools: Tool[]): ${CAPITAL_TOOLSET_NAME}ToolCollection {
151
+ return tools.map(tool => this.wrapTool(tool));
152
+ }}
153
}
154
EOL
155
156
# Create README.md
157
cat > "$TOOLSET_PATH/README.md" << EOL
169
-# @composio/${TOOLSET_NAME}-toolset
158
+# @composio/${TOOLSET_NAME}
159
171
-${IS_AGENTIC:+Agentic }Toolset for ${TOOLSET_NAME} in Composio SDK.
160
+${IS_AGENTIC:+Agentic }Toolset for ${CAPITAL_TOOLSET_NAME} in Composio SDK.
161
+
162
+## Features
163
+
164
+${IS_AGENTIC:+- **Full Modifier Support**: Support for both schema and execution modifiers
165
+- **Tool Execution**: Execute tools with proper parameter handling
166
+- **Type Safety**: Full TypeScript support with proper type definitions}${!IS_AGENTIC:+- **Schema Modifiers**: Support for transforming tool schemas
167
+- **Type Safety**: Full TypeScript support with proper type definitions}
168
169
## Installation
170
171
\`\`\`bash
176
-pnpm add @composio/${TOOLSET_NAME}-toolset
172
+npm install @composio/${TOOLSET_NAME}
173
+# or
174
+yarn add @composio/${TOOLSET_NAME}
175
+# or
176
+pnpm add @composio/${TOOLSET_NAME}
177
\`\`\`
178
179
-## Usage
179
+## Quick Start
180
181
\`\`\`typescript
182
-import { Composio } from "@composio/core";
183
-import { ${CAPITAL_TOOLSET_NAME}Toolset } from "@composio/${TOOLSET_NAME}-toolset";
182
+import { Composio } from '@composio/core';
183
+import { ${CAPITAL_TOOLSET_NAME}Toolset } from '@composio/${TOOLSET_NAME}';
184
185
+// Initialize Composio with ${CAPITAL_TOOLSET_NAME} toolset
186
const composio = new Composio({
186
- apiKey: "your-api-key",
187
- toolset: new ${CAPITAL_TOOLSET_NAME}Toolset()
187
+ apiKey: 'your-composio-api-key',
188
+ toolset: new ${CAPITAL_TOOLSET_NAME}Toolset(),
189
});
190
190
-// Get all tools
191
-const tools = await composio.getTools();
191
+// Get available tools
192
+const tools = await composio.tools.get('user123', {
193
+ apps: ['gmail', 'googlecalendar'],
194
+ limit: 10,
195
+});
196
+\`\`\`
197
193
-// Get a specific tool by slug
194
-const tool = await composio.getToolBySlug("tool-slug");
198
+## Usage Examples
199
+
200
+### Basic Example
201
+
202
+\`\`\`typescript
203
+import { Composio } from '@composio/core';
204
+import { ${CAPITAL_TOOLSET_NAME}Toolset } from '@composio/${TOOLSET_NAME}';
205
+
206
+// Initialize Composio
207
+const composio = new Composio({
208
+ apiKey: process.env.COMPOSIO_API_KEY,
209
+ toolset: new ${CAPITAL_TOOLSET_NAME}Toolset(),
210
+});
211
+
212
+// Get tools
213
+const tools = await composio.tools.get('user123', {
214
+ apps: ['gmail'],
215
+});
216
+
217
+// Use tools with ${CAPITAL_TOOLSET_NAME}
218
+// Add your usage example here
219
\`\`\`
220
197
-## Features
221
+## API Reference
222
199
-${IS_AGENTIC:+This is an agentic toolset that supports full modifier capabilities, including:
200
-- Tool execution modifiers
201
-- Schema modifiers
202
-- Custom modifiers
223
+### ${CAPITAL_TOOLSET_NAME}Toolset Class
224
204
-}${!IS_AGENTIC:+This is a non-agentic toolset that supports schema modifiers for transforming tool schemas.}
225
+The \`${CAPITAL_TOOLSET_NAME}Toolset\` class extends \`${IS_AGENTIC:+BaseAgenticToolset}${!IS_AGENTIC:+BaseNonAgenticToolset}\` and provides ${TOOLSET_NAME}-specific functionality.
226
+
227
+#### Methods
228
+
229
+##### \`wrapTool(tool: Tool${IS_AGENTIC:+, executeTool: ExecuteToolFn}): ${CAPITAL_TOOLSET_NAME}Tool\`
230
+
231
+Wraps a tool in the ${TOOLSET_NAME} format.
232
+
233
+\`\`\`typescript
234
+const tool = toolset.wrapTool(composioTool${IS_AGENTIC:+, executeTool});
235
+\`\`\`
236
+
237
+## Contributing
238
+
239
+We welcome contributions! Please see our [Contributing Guide](../../CONTRIBUTING.md) for more details.
240
241
## License
242
208
-ISC
243
+ISC License
244
+
245
+## Support
246
+
247
+For support, please visit our [Documentation](https://docs.composio.dev) or join our [Discord Community](https://discord.gg/composio).
248
EOL
249
250
# Make the script executable