@devries-cameron20 / composio-1 / commits / 945851324
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.

Feat: Add disable version check flag (#1869)

Musthaq Ahamad committed Aug 25, 2025 at 13:23 UTC 9458513240e6a035a51e704dd6186090b5c3e8d6
3 files changed +103 -21
.changeset/legal-pants-see.md new
+5
@@ -0,0 +1,5 @@
1 +---
2 +'@composio/core': patch
3 +---
4 +
5 +Feat: Add flags to disable version check
ts/packages/core/README.md
+89 -20
@@ -2,6 +2,8 @@
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 +[Learn more about the SDK from our docs](https://docs.composio.dev)
6 +
7 ## Core Features
8
9 - **Tools**: Manage and execute tools within the Composio ecosystem. Includes functionality to list, retrieve, and execute tools.
@@ -27,22 +29,86 @@ pnpm add @composio/core
29
30 ```typescript
31 import { Composio } from '@composio/core';
30 -import { OpenAIProvider } from '@composio/openai';
32 +import { OpenAI } from 'openai';
33 +
34 +// Initialize OpenAI client
35 +const openai = new OpenAI({
36 + apiKey: process.env.OPENAI_API_KEY,
37 +});
38
39 +// Initialize Composio with your API key
40 const composio = new Composio({
41 apiKey: process.env.COMPOSIO_API_KEY,
34 - // OpenAIProvider is the default, so this is optional
35 - provider: new OpenAIProvider(),
42 });
43
38 -// Fetch a single tool by slig
39 -const tools = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS');
44 +async function main() {
45 + try {
46 + // Fetch tools - single tool or multiple tools
47 + const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER');
48 + // Or fetch multiple tools: await composio.tools.get('default', { toolkits: ['hackernews'] });
49 +
50 + const query = "Find information about the HackerNews user 'pg'";
51 +
52 + // Create chat completion with tools
53 + const response = await openai.chat.completions.create({
54 + model: 'gpt-4o',
55 + messages: [
56 + {
57 + role: 'system',
58 + content: 'You are a helpful assistant that can use tools to answer questions.',
59 + },
60 + { role: 'user', content: query },
61 + ],
62 + tools: tools,
63 + tool_choice: 'auto',
64 + });
65 +
66 + // Handle tool calls if the assistant decides to use them
67 + if (response.choices[0].message.tool_calls) {
68 + console.log(
69 + '🔧 Assistant is using tool:',
70 + response.choices[0].message.tool_calls[0].function.name
71 + );
72 +
73 + // Execute the tool call
74 + const toolResult = await composio.provider.executeToolCall(
75 + 'default',
76 + response.choices[0].message.tool_calls[0],
77 + {
78 + connectedAccountId: '', // Optional: specify connected account
79 + }
80 + );
81 +
82 + console.log('✅ Tool execution result:', JSON.parse(toolResult));
83 +
84 + // Get final response from assistant with tool result
85 + const finalResponse = await openai.chat.completions.create({
86 + model: 'gpt-4o',
87 + messages: [
88 + {
89 + role: 'system',
90 + content: 'You are a helpful assistant that can use tools to answer questions.',
91 + },
92 + { role: 'user', content: query },
93 + response.choices[0].message,
94 + {
95 + role: 'tool',
96 + tool_call_id: response.choices[0].message.tool_calls[0].id,
97 + content: toolResult,
98 + },
99 + ],
100 + });
101 +
102 + console.log('🤖 Final response:', finalResponse.choices[0].message.content);
103 + } else {
104 + console.log('🤖 Response:', response.choices[0].message.content);
105 + }
106 + } catch (error) {
107 + console.error('❌ Error:', error);
108 + }
109 +}
110
41 -// Fetch multiple tools
42 -const tools = await composio.tools.get('user123', {
43 - category: 'search',
44 - limit: 10,
45 -});
111 +main();
112 ```
113
114 ## Configuration
@@ -51,12 +117,14 @@ The Composio constructor accepts the following configuration options:
117
118 ```typescript
119 interface ComposioConfig {
54 - apiKey?: string; // Your Composio API key
55 - baseURL?: string; // Custom API base URL (optional)
120 + apiKey?: string | null; // Your Composio API key
121 + baseURL?: string | null; // Custom API base URL (optional)
122 allowTracking?: boolean; // Enable/disable telemetry (default: true)
57 - allowTracing?: boolean; // Enable/disable tracing (default: true)
123 + autoUploadDownloadFiles?: boolean; // Whether to automatically upload and download files during tool execution (default: true)
124 provider?: TProvider; // Custom provider (default: OpenAIProvider)
59 - host?: string; // Name of the host service which is using the SDK, this is for telemetry.
125 + host?: string; // Name of the host service which is using the SDK, this is for telemetry
126 + defaultHeaders?: ComposioRequestHeaders; // Request headers to be passed to the Composio API client
127 + disableVersionCheck?: boolean; // Whether to disable version check for the Composio SDK (default: false)
128 }
129 ```
130
@@ -70,7 +138,7 @@ Schema modifiers allow you to transform tool schemas before they are used:
138
139 ```typescript
140 const tools = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
73 - modifySchema: (toolSlug: string, toolkitSlug: string, tool: Tool) => ({
141 + modifySchema: ({ toolSlug, toolkitSlug, schema }) => ({
142 ...tool,
143 description: 'Enhanced HackerNews search with additional features',
144 inputParameters: {
@@ -92,7 +160,7 @@ For agentic providers (like Vercel AI and Langchain), you can also modify tool e
160 ```typescript
161 const tools = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
162 // Transform input before execution
95 - beforeExecute: (toolSlug: string, toolkitSlug: string, params: ToolExecuteParams) => ({
163 + beforeExecute: ({ toolSlug, toolkitSlug, params }) => ({
164 ...params,
165 arguments: {
166 ...params.arguments,
@@ -101,7 +169,7 @@ const tools = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
169 }),
170
171 // Transform output after execution
104 - afterExecute: (toolSlug: string, toolkitSlug: string, response: ToolExecuteResponse) => ({
172 + afterExecute: ({ toolSlug, toolkitSlug, result }) => ({
173 ...response,
174 data: {
175 ...response.data,
@@ -128,11 +196,11 @@ const composio = new Composio({
196 });
197
198 // Create a connected account
131 -const connectionRequest = await composio.createConnectedAccount(
199 +const connectionRequest = await composio.connectedAccounts.initiate(
200 'user123', // userId
133 - 'HACKERNEWS', // authConfigId
201 + 'ac_12343544', // authConfigId: You can create it from the dashboard
202 {
135 - redirectUrl: 'https://your-app.com/callback',
203 + callbackUrl: 'https://your-app.com/callback',
204 data: {
205 // Additional data for the connection
206 scope: ['read', 'write'],
@@ -143,6 +211,7 @@ const connectionRequest = await composio.createConnectedAccount(
211 // Wait for the connection to be established
212 // Default timeout is 60 seconds
213 const connectedAccount = await connectionRequest.waitForConnection();
214 +console.log({ connectedAccount });
215 ```
216
217 ### Waiting for Connection Establishment
ts/packages/core/src/composio.ts
+9 -1
@@ -67,6 +67,12 @@ export type ComposioConfig<
67 * ```
68 */
69 defaultHeaders?: ComposioRequestHeaders;
70 + /**
71 + * Whether to disable version check for the Composio SDK.
72 + * @example true, false
73 + * @default false
74 + */
75 + disableVersionCheck?: boolean;
76 };
77
78 /**
@@ -209,7 +215,9 @@ export class Composio<
215 telemetry.instrument(this.provider);
216
217 // Check for the latest version of the Composio SDK from NPM.
212 - checkForLatestVersionFromNPM(version);
218 + if (!this.config.disableVersionCheck) {
219 + checkForLatestVersionFromNPM(version);
220 + }
221 }
222
223 /**