@devries-cameron20 / composio-1 / commits / 495bf0942
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Fix core package

haxzie committed Apr 22, 2025 at 13:46 UTC 495bf0942f1d4c5917a2c048e52a3fb93dea0361
5 files changed +64 -9
examples/langchain/src/index.ts
+39 -1
@@ -1,5 +1,6 @@
1 -import { Composio } from "@composio/core"
1 +import { BaseComposioToolset, Composio, Tool, jsonSchemaToModel } from "@composio/core"
2 import { LangchainToolset } from "@composio/langchain"
3 +import { DynamicStructuredTool } from "@langchain/core/tools"
4 import process from "process"
5
6 const composio = new Composio({
@@ -10,4 +11,41 @@ const composio = new Composio({
11 // direct tool access
12 const tools = await composio.getTools()
13
14 +class MyToolSet extends BaseComposioToolset<typeof tools, typeof tools[number]> {
15 + readonly FILE_NAME = "examples/langchain/src/index.ts";
16 +
17 + _wrapTool = (tool: Tool): DynamicStructuredTool => {
18 + const toolName = tool.slug;
19 + const description = tool.description;
20 + const appName = tool.toolkit.name?.toLowerCase();
21 +
22 + const func = async (...kwargs: unknown[]): Promise<unknown> => {
23 + const connectedAccountId = this.client?.getConnectedAccountId(appName);
24 + return JSON.stringify(
25 + await this.client?.tools.execute(toolName, {
26 + arguments: kwargs[0] as Record<string, unknown>,
27 + entity_id: this.client.userId ?? this.DEFAULT_ENTITY_ID,
28 + connected_account_id: connectedAccountId,
29 + })
30 + );
31 + };
32 +
33 + const parameters = jsonSchemaToModel(tool.input_parameters);
34 +
35 + return new DynamicStructuredTool({
36 + name: toolName,
37 + description,
38 + schema: parameters,
39 + func: func,
40 + });
41 + };
42 +
43 + async getTools() {
44 + this.client?.FILE_NAME
45 + return tools
46 + }
47 +}
48 +
49 +const myToolSet = new MyToolSet()
50 +
51 console.log(tools)
\ No newline at end of file
packages/core/package.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "name": "@composio/core",
3 - "version": "0.1.0-rc.1",
3 + "version": "0.1.0-rc.2",
4 "description": "",
5 "main": "src/index.ts",
6 "type": "module",
packages/toolsets/langchain/package.json
+6 -3
@@ -9,14 +9,17 @@
9 "main": "dist/index.js",
10 "types": "dist/index.d.ts"
11 },
12 - "exports": {
12 + "exports": {
13 ".": {
14 "import": "./dist/index.js",
15 "types": "./dist/index.d.ts",
16 "require": "./dist/index.cjs"
17 }
18 },
19 - "files": ["README.md", "dist"],
19 + "files": [
20 + "README.md",
21 + "dist"
22 + ],
23 "scripts": {
24 "build": "tsup",
25 "test": "echo \"Error: no test specified\" && exit 1"
@@ -30,7 +33,7 @@
33 "typescript": "^5.8.3"
34 },
35 "dependencies": {
33 - "@composio/core": "workspace:^",
36 + "@composio/core": "0.1.0-rc.1",
37 "@langchain/core": "^0.3.44"
38 }
39 }
packages/toolsets/langchain/src/index.ts
+3 -2
@@ -9,7 +9,8 @@
9 * @packageDocumentation
10 * @module toolsets/langchain
11 */
12 -import { BaseComposioToolset, jsonSchemaToModel, Tool, ToolListParams } from "@composio/core";
12 +import { BaseComposioToolset, jsonSchemaToModel } from "@composio/core";
13 +import type { Tool, ToolListParams } from "@composio/core";
14 import { DynamicStructuredTool } from "@langchain/core/tools";
15
16
@@ -24,7 +25,7 @@ export class LangchainToolset extends BaseComposioToolset<LangChainToolCollectio
25 * @param tool - The tool to wrap.
26 * @returns The wrapped tool.
27 */
27 - _wrapTool = (tool: Tool): DynamicStructuredTool => {
28 + _wrapTool(tool: Tool): DynamicStructuredTool {
29 const toolName = tool.slug
30 const description = tool.description;
31 const appName = tool.toolkit.name?.toLowerCase();
pnpm-lock.yaml
+15 -2
@@ -113,8 +113,8 @@ importers:
113 packages/toolsets/langchain:
114 dependencies:
115 '@composio/core':
116 - specifier: workspace:^
117 - version: link:../../core
116 + specifier: 0.1.0-rc.1
117 + version: 0.1.0-rc.1
118 '@langchain/core':
119 specifier: ^0.3.44
120 version: 0.3.44(openai@4.94.0(zod@3.24.2))
@@ -201,6 +201,9 @@ packages:
201 '@composio/client@0.1.0-alpha.7':
202 resolution: {integrity: sha512-2KYo7mloXf6vplX+6cMjnuaS/Hia74HwPZd7/3RCehVptqTzaqgQFBEAGfnQ3zMBtTkLt+S7JQsZc9RE0SIMoA==}
203
204 + '@composio/core@0.1.0-rc.1':
205 + resolution: {integrity: sha512-8HoIMzKdi5CgpkGJzX+ttiHhY+KAvyQuQm8wKSdFXN/gBKeJUfzCnAyyUGsqWMnjsaG6T97/sMizOKrRs72BLQ==}
206 +
207 '@esbuild/aix-ppc64@0.25.2':
208 resolution: {integrity: sha512-wCIboOL2yXZym2cgm6mlA742s9QeJ8DjGVaL39dLN4rRwrOgOyYSnOaFPhKZGLb2ngj4EyfAFjsNJwPXZvseag==}
209 engines: {node: '>=18'}
@@ -1207,6 +1210,16 @@ snapshots:
1210
1211 '@composio/client@0.1.0-alpha.7': {}
1212
1213 + '@composio/core@0.1.0-rc.1':
1214 + dependencies:
1215 + '@composio/client': 0.1.0-alpha.7
1216 + openai: 4.94.0(zod@3.24.2)
1217 + pusher-js: 8.4.0
1218 + zod: 3.24.2
1219 + transitivePeerDependencies:
1220 + - encoding
1221 + - ws
1222 +
1223 '@esbuild/aix-ppc64@0.25.2':
1224 optional: true
1225