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, 01:45 UTC
Add sdk docs
haxzie committed
May 21, 2025 at 16:41 UTC
49064c38f65f45a02b46fffdbf6610fbcef3de04
8 files changed
+266
-257
docs/advanced/custom-providers.md
+73
-89
@@ -33,7 +33,7 @@ BaseProvider (Abstract)
33
Non-agentic providers implement the `BaseNonAgenticProvider` abstract class:
34
35
```typescript
36
-import { BaseNonAgenticProvider, Tool } from '@composio/sdk';
36
+import { BaseNonAgenticProvider, Tool } from '@composio/core';
37
38
// Define your tool format
39
interface MyAITool {
@@ -53,7 +53,7 @@ type MyAIToolCollection = MyAITool[];
53
export class MyAIProvider extends BaseNonAgenticProvider<MyAIToolCollection, MyAITool> {
54
// Required: Unique provider name for telemetry
55
readonly name = 'my-ai-platform';
56
-
56
+
57
// Required: Method to transform a single tool
58
override wrapTool(tool: Tool): MyAITool {
59
return {
@@ -66,12 +66,12 @@ export class MyAIProvider extends BaseNonAgenticProvider<MyAIToolCollection, MyA
66
},
67
};
68
}
69
-
69
+
70
// Required: Method to transform a collection of tools
71
override wrapTools(tools: Tool[]): MyAIToolCollection {
72
return tools.map(tool => this.wrapTool(tool));
73
}
74
-
74
+
75
// Optional: Custom helper methods for your AI platform
76
async executeMyAIToolCall(
77
userId: string,
@@ -81,14 +81,11 @@ export class MyAIProvider extends BaseNonAgenticProvider<MyAIToolCollection, MyA
81
}
82
): Promise<string> {
83
// Use the built-in executeTool method
84
- const result = await this.executeTool(
85
- toolCall.name,
86
- {
87
- userId,
88
- arguments: toolCall.arguments,
89
- }
90
- );
91
-
84
+ const result = await this.executeTool(toolCall.name, {
85
+ userId,
86
+ arguments: toolCall.arguments,
87
+ });
88
+
89
return JSON.stringify(result.data);
90
}
91
}
@@ -99,7 +96,7 @@ export class MyAIProvider extends BaseNonAgenticProvider<MyAIToolCollection, MyA
96
Agentic providers implement the `BaseAgenticProvider` abstract class:
97
98
```typescript
102
-import { BaseAgenticProvider, Tool, ExecuteToolFn } from '@composio/sdk';
99
+import { BaseAgenticProvider, Tool, ExecuteToolFn } from '@composio/core';
100
101
// Define your tool format
102
interface AgentTool {
@@ -119,7 +116,7 @@ interface AgentToolkit {
116
export class MyAgentProvider extends BaseAgenticProvider<AgentToolkit, AgentTool> {
117
// Required: Unique provider name for telemetry
118
readonly name = 'my-agent-platform';
122
-
119
+
120
// Required: Method to transform a single tool with execute function
121
override wrapTool(tool: Tool, executeToolFn: ExecuteToolFn): AgentTool {
122
return {
@@ -132,29 +129,29 @@ export class MyAgentProvider extends BaseAgenticProvider<AgentToolkit, AgentTool
129
throw new Error(result.error || 'Tool execution failed');
130
}
131
return result.data;
135
- }
132
+ },
133
};
134
}
138
-
135
+
136
// Required: Method to transform a collection of tools with execute function
137
override wrapTools(tools: Tool[], executeToolFn: ExecuteToolFn): AgentToolkit {
138
const agentTools = tools.map(tool => this.wrapTool(tool, executeToolFn));
142
-
139
+
140
return {
141
tools: agentTools,
145
- createAgent: (config) => {
142
+ createAgent: config => {
143
// Create an agent using the tools
144
return {
145
run: async (prompt: string) => {
146
// Implementation depends on your agent framework
147
console.log(`Running agent with prompt: ${prompt}`);
148
// The agent would use the tools.execute method to run tools
152
- }
149
+ },
150
};
154
- }
151
+ },
152
};
153
}
157
-
154
+
155
// Optional: Custom helper methods for your agent platform
156
async runAgent(agentToolkit: AgentToolkit, prompt: string): Promise<unknown> {
157
const agent = agentToolkit.createAgent({});
@@ -168,7 +165,7 @@ export class MyAgentProvider extends BaseAgenticProvider<AgentToolkit, AgentTool
165
After creating your provider, use it with the Composio SDK:
166
167
```typescript
171
-import { Composio } from '@composio/sdk';
168
+import { Composio } from '@composio/core';
169
import { MyAIProvider } from './my-ai-provider';
170
171
// Create your provider instance
@@ -196,20 +193,20 @@ Your provider can maintain state and context:
193
```typescript
194
export class StatefulProvider extends BaseNonAgenticProvider<ToolCollection, Tool> {
195
readonly name = 'stateful-provider';
199
-
196
+
197
// Provider state
198
private requestCount = 0;
199
private toolCache = new Map<string, any>();
200
private config: ProviderConfig;
204
-
201
+
202
constructor(config: ProviderConfig) {
203
super();
204
this.config = config;
205
}
209
-
206
+
207
override wrapTool(tool: Tool): ProviderTool {
208
this.requestCount++;
212
-
209
+
210
// Use the provider state/config
211
const enhancedTool = {
212
// Transform the tool
@@ -217,22 +214,22 @@ export class StatefulProvider extends BaseNonAgenticProvider<ToolCollection, Too
214
description: tool.description,
215
schema: tool.inputParameters,
216
};
220
-
217
+
218
// Cache the transformed tool
219
this.toolCache.set(tool.slug, enhancedTool);
223
-
220
+
221
return enhancedTool;
222
}
226
-
223
+
224
override wrapTools(tools: Tool[]): ProviderToolCollection {
225
return tools.map(tool => this.wrapTool(tool));
226
}
230
-
227
+
228
// Custom methods that use provider state
229
getRequestCount(): number {
230
return this.requestCount;
231
}
235
-
232
+
233
getCachedTool(slug: string): ProviderTool | undefined {
234
return this.toolCache.get(slug);
235
}
@@ -244,7 +241,7 @@ export class StatefulProvider extends BaseNonAgenticProvider<ToolCollection, Too
241
You can compose functionality by extending existing providers:
242
243
```typescript
247
-import { OpenAIProvider } from '@composio/sdk';
244
+import { OpenAIProvider } from '@composio/openai';
245
246
// Extend the OpenAI provider with custom functionality
247
export class EnhancedOpenAIProvider extends OpenAIProvider {
@@ -253,11 +250,11 @@ export class EnhancedOpenAIProvider extends OpenAIProvider {
250
toolCalls: 0,
251
errors: 0,
252
};
256
-
253
+
254
// Override methods to add functionality
255
override async executeToolCall(userId, tool, options, modifiers) {
256
this.analytics.toolCalls++;
260
-
257
+
258
try {
259
// Call the parent implementation
260
const result = await super.executeToolCall(userId, tool, options, modifiers);
@@ -267,16 +264,16 @@ export class EnhancedOpenAIProvider extends OpenAIProvider {
264
throw error;
265
}
266
}
270
-
267
+
268
// Add new methods
269
getAnalytics() {
270
return this.analytics;
271
}
275
-
272
+
273
async executeWithRetry(userId, tool, options, modifiers, maxRetries = 3) {
274
let attempts = 0;
275
let lastError;
279
-
276
+
277
while (attempts < maxRetries) {
278
try {
279
return await this.executeToolCall(userId, tool, options, modifiers);
@@ -286,7 +283,7 @@ export class EnhancedOpenAIProvider extends OpenAIProvider {
283
await new Promise(resolve => setTimeout(resolve, 1000 * attempts));
284
}
285
}
289
-
286
+
287
throw lastError;
288
}
289
}
@@ -297,7 +294,7 @@ export class EnhancedOpenAIProvider extends OpenAIProvider {
294
Here's a more complete example for Anthropic's Claude:
295
296
```typescript
300
-import { BaseNonAgenticProvider, Tool } from '@composio/sdk';
297
+import { BaseNonAgenticProvider, Tool } from '@composio/core';
298
import Anthropic from '@anthropic-ai/sdk';
299
300
interface ClaudeTool {
@@ -315,14 +312,14 @@ type ClaudeToolCollection = ClaudeTool[];
312
export class ClaudeProvider extends BaseNonAgenticProvider<ClaudeToolCollection, ClaudeTool> {
313
readonly name = 'claude';
314
private client: Anthropic;
318
-
315
+
316
constructor(apiKey: string) {
317
super();
318
this.client = new Anthropic({
319
apiKey,
320
});
321
}
325
-
322
+
323
override wrapTool(tool: Tool): ClaudeTool {
324
return {
325
name: tool.slug,
@@ -334,41 +331,36 @@ export class ClaudeProvider extends BaseNonAgenticProvider<ClaudeToolCollection,
331
},
332
};
333
}
337
-
334
+
335
override wrapTools(tools: Tool[]): ClaudeToolCollection {
336
return tools.map(tool => this.wrapTool(tool));
337
}
341
-
338
+
339
// Helper method to create a Claude message with tools
340
async createMessage(prompt: string, tools: ClaudeToolCollection, userId: string) {
341
const response = await this.client.messages.create({
342
model: 'claude-3-opus-20240229',
343
max_tokens: 1024,
344
system: 'You are a helpful assistant with access to tools.',
348
- messages: [
349
- { role: 'user', content: prompt }
350
- ],
345
+ messages: [{ role: 'user', content: prompt }],
346
tools,
347
});
353
-
348
+
349
// Process tool calls if any
355
- if (response.content.some(content =>
356
- content.type === 'tool_use' &&
357
- 'name' in content &&
358
- 'input' in content
359
- )) {
350
+ if (
351
+ response.content.some(
352
+ content => content.type === 'tool_use' && 'name' in content && 'input' in content
353
+ )
354
+ ) {
355
const toolResponses = await Promise.all(
356
response.content
357
.filter(content => content.type === 'tool_use')
358
.map(async (content: any) => {
364
- const result = await this.executeTool(
365
- content.name,
366
- {
367
- userId,
368
- arguments: content.input,
369
- }
370
- );
371
-
359
+ const result = await this.executeTool(content.name, {
360
+ userId,
361
+ arguments: content.input,
362
+ });
363
+
364
return {
365
type: 'tool_result',
366
tool_use_id: content.id,
@@ -376,7 +368,7 @@ export class ClaudeProvider extends BaseNonAgenticProvider<ClaudeToolCollection,
368
};
369
})
370
);
379
-
371
+
372
// Continue the conversation with tool results
373
const followupResponse = await this.client.messages.create({
374
model: 'claude-3-opus-20240229',
@@ -385,14 +377,14 @@ export class ClaudeProvider extends BaseNonAgenticProvider<ClaudeToolCollection,
377
messages: [
378
{ role: 'user', content: prompt },
379
{ role: 'assistant', content: response.content },
388
- { role: 'user', content: toolResponses }
380
+ { role: 'user', content: toolResponses },
381
],
382
tools,
383
});
392
-
384
+
385
return followupResponse;
386
}
395
-
387
+
388
return response;
389
}
390
}
@@ -403,7 +395,7 @@ export class ClaudeProvider extends BaseNonAgenticProvider<ClaudeToolCollection,
395
Here's an example for LangChain:
396
397
```typescript
406
-import { BaseAgenticProvider, Tool, ExecuteToolFn } from '@composio/sdk';
398
+import { BaseAgenticProvider, Tool, ExecuteToolFn } from '@composio/core';
399
import { DynamicTool } from 'langchain/tools';
400
import { ChatOpenAI } from 'langchain/chat_models/openai';
401
import { initializeAgentExecutorWithOptions } from 'langchain/agents';
@@ -421,7 +413,7 @@ interface LangChainToolkit {
413
414
export class LangChainProvider extends BaseAgenticProvider<LangChainToolkit, LangChainTool> {
415
readonly name = 'langchain';
424
-
416
+
417
override wrapTool(tool: Tool, executeToolFn: ExecuteToolFn): LangChainTool {
418
return new DynamicTool({
419
name: tool.slug,
@@ -430,26 +422,26 @@ export class LangChainProvider extends BaseAgenticProvider<LangChainToolkit, Lan
422
try {
423
// Parse input from string to object
424
const args = typeof input === 'string' ? JSON.parse(input) : input;
433
-
425
+
426
// Execute the tool
427
const result = await executeToolFn(tool.slug, args);
436
-
428
+
429
if (!result.successful) {
430
throw new Error(result.error || 'Tool execution failed');
431
}
440
-
432
+
433
// Return the result
434
return JSON.stringify(result.data);
435
} catch (error) {
436
return `Error: ${error.message}`;
437
}
446
- }
438
+ },
439
}) as LangChainTool;
440
}
449
-
441
+
442
override wrapTools(tools: Tool[], executeToolFn: ExecuteToolFn): LangChainToolkit {
443
const langchainTools = tools.map(tool => this.wrapTool(tool, executeToolFn));
452
-
444
+
445
return {
446
tools: langchainTools,
447
createExecutor: async ({ model }) => {
@@ -457,25 +449,17 @@ export class LangChainProvider extends BaseAgenticProvider<LangChainToolkit, Lan
449
modelName: model || 'gpt-4',
450
temperature: 0,
451
});
460
-
461
- return await initializeAgentExecutorWithOptions(
462
- langchainTools,
463
- llm,
464
- {
465
- agentType: 'chat-zero-shot-react-description',
466
- verbose: true,
467
- }
468
- );
469
- }
452
+
453
+ return await initializeAgentExecutorWithOptions(langchainTools, llm, {
454
+ agentType: 'chat-zero-shot-react-description',
455
+ verbose: true,
456
+ });
457
+ },
458
};
459
}
472
-
460
+
461
// Helper method to run the agent
474
- async runAgent(
475
- toolkit: LangChainToolkit,
476
- prompt: string,
477
- model = 'gpt-4'
478
- ): Promise<string> {
462
+ async runAgent(toolkit: LangChainToolkit, prompt: string, model = 'gpt-4'): Promise<string> {
463
const executor = await toolkit.createExecutor({ model });
464
const result = await executor.call({ input: prompt });
465
return result.output;
@@ -491,4 +475,4 @@ export class LangChainProvider extends BaseAgenticProvider<LangChainToolkit, Lan
475
4. **Optimize for performance**: Cache transformed tools when possible
476
5. **Add helper methods**: Provide convenient methods for common platform-specific operations
477
6. **Provide clear documentation**: Document your provider's unique features and usage
494
-7. **Use telemetry**: Set a meaningful provider name for telemetry insights
\ No newline at end of file
478
+7. **Use telemetry**: Set a meaningful provider name for telemetry insights
docs/advanced/telemetry.md
+22
-21
@@ -20,6 +20,7 @@ The telemetry system collects the following types of data:
20
- **Environment Information**: SDK version, provider used, runtime context
21
22
No personal or sensitive information such as:
23
+
24
- API keys
25
- Tool arguments
26
- Tool responses
@@ -31,7 +32,7 @@ No personal or sensitive information such as:
32
You can disable telemetry when initializing the SDK:
33
34
```typescript
34
-import { Composio } from '@composio/sdk';
35
+import { Composio } from '@composio/core';
36
37
const composio = new Composio({
38
apiKey: 'your-api-key',
@@ -51,18 +52,18 @@ COMPOSIO_DISABLE_TELEMETRY=true
52
For advanced use cases, you can provide a custom telemetry transport to process the telemetry data according to your needs:
53
54
```typescript
54
-import { Composio, BaseTelemetryTransport, TelemetryEvent } from '@composio/sdk';
55
+import { Composio, BaseTelemetryTransport, TelemetryEvent } from '@composio/core';
56
57
// Create a custom telemetry transport
58
class CustomTelemetryTransport extends BaseTelemetryTransport {
59
async send(event: TelemetryEvent): Promise<void> {
60
// Process the telemetry event
61
console.log(`Telemetry event: ${event.name}`, event.properties);
61
-
62
+
63
// You can send it to your own analytics system
64
await yourAnalyticsSystem.track(event.name, event.properties);
65
}
65
-
66
+
67
async flush(): Promise<void> {
68
// Clean up any pending events
69
await yourAnalyticsSystem.flush();
@@ -81,35 +82,35 @@ const composio = new Composio({
82
To implement a custom telemetry transport, extend the `BaseTelemetryTransport` class:
83
84
```typescript
84
-import { BaseTelemetryTransport, TelemetryEvent } from '@composio/sdk';
85
+import { BaseTelemetryTransport, TelemetryEvent } from '@composio/core';
86
87
export class CustomTelemetryTransport extends BaseTelemetryTransport {
88
// Optional constructor for configuration
88
- constructor(private config: { endpoint: string, batchSize: number }) {
89
+ constructor(private config: { endpoint: string; batchSize: number }) {
90
super();
91
this.events = [];
92
}
92
-
93
+
94
// Local state for batching events
95
private events: TelemetryEvent[];
95
-
96
+
97
// Required: Implement the send method
98
async send(event: TelemetryEvent): Promise<void> {
99
// Add the event to the batch
100
this.events.push(event);
100
-
101
+
102
// If batch is full, flush it
103
if (this.events.length >= this.config.batchSize) {
104
await this.flush();
105
}
106
}
106
-
107
+
108
// Required: Implement the flush method
109
async flush(): Promise<void> {
110
if (this.events.length === 0) {
111
return;
112
}
112
-
113
+
114
try {
115
// Send the batch to your endpoint
116
await fetch(this.config.endpoint, {
@@ -122,7 +123,7 @@ export class CustomTelemetryTransport extends BaseTelemetryTransport {
123
timestamp: new Date().toISOString(),
124
}),
125
});
125
-
126
+
127
// Clear the batch
128
this.events = [];
129
} catch (error) {
@@ -211,14 +212,14 @@ The telemetry system automatically includes environment context with each event:
212
213
```typescript
214
interface TelemetryMetadata {
214
- apiKey: string; // The Composio API key (first 8 chars only, for identification)
215
- baseUrl: string; // The Composio API base URL
216
- framework: string; // The provider name
217
- isAgentic: boolean; // Whether the provider is agentic
218
- source: string; // The runtime environment
219
- version: string; // The SDK version
220
- isBrowser: boolean; // Whether the SDK is running in a browser
221
- sessionId: string; // A random session ID (changes each init)
215
+ apiKey: string; // The Composio API key (first 8 chars only, for identification)
216
+ baseUrl: string; // The Composio API base URL
217
+ framework: string; // The provider name
218
+ isAgentic: boolean; // Whether the provider is agentic
219
+ source: string; // The runtime environment
220
+ version: string; // The SDK version
221
+ isBrowser: boolean; // Whether the SDK is running in a browser
222
+ sessionId: string; // A random session ID (changes each init)
223
}
224
```
225
@@ -235,4 +236,4 @@ The SDK automatically detects whether it's running in a browser or Node.js envir
236
2. If you need to **disable telemetry** for compliance reasons, use the `allowTracking: false` option
237
3. If you want to **process telemetry locally**, implement a custom transport
238
4. **Never log sensitive data** in your custom transports
238
-5. If you **implement a custom provider**, set a meaningful name to improve telemetry insights
\ No newline at end of file
239
+5. If you **implement a custom provider**, set a meaningful name to improve telemetry insights
docs/api/composio.md
+22
-21
@@ -5,7 +5,7 @@ The `Composio` class is the main entry point to the Composio SDK. It initializes
5
## Initialization
6
7
```typescript
8
-import { Composio } from '@composio/sdk';
8
+import { Composio } from '@composio/core';
9
10
const composio = new Composio({
11
apiKey: 'your-api-key',
@@ -21,27 +21,27 @@ const composio = new Composio({
21
22
The `Composio` constructor accepts a configuration object with the following properties:
23
24
-| Property | Type | Required | Default | Description |
25
-|----------|------|----------|---------|-------------|
26
-| `apiKey` | string | Yes | - | Your Composio API key |
27
-| `baseURL` | string | No | `https://api.composio.dev` | The base URL for the Composio API |
28
-| `allowTracking` | boolean | No | `true` | Whether to allow analytics/tracking |
29
-| `allowTracing` | boolean | No | `true` | Whether to allow tracing |
30
-| `provider` | `BaseComposioProvider` | No | `new OpenAIProvider()` | The provider to use for this Composio instance |
31
-| `telemetryTransport` | `BaseTelemetryTransport` | No | - | Custom transport for telemetry data |
24
+| Property | Type | Required | Default | Description |
25
+| -------------------- | ------------------------ | -------- | -------------------------- | ---------------------------------------------- |
26
+| `apiKey` | string | Yes | - | Your Composio API key |
27
+| `baseURL` | string | No | `https://api.composio.dev` | The base URL for the Composio API |
28
+| `allowTracking` | boolean | No | `true` | Whether to allow analytics/tracking |
29
+| `allowTracing` | boolean | No | `true` | Whether to allow tracing |
30
+| `provider` | `BaseComposioProvider` | No | `new OpenAIProvider()` | The provider to use for this Composio instance |
31
+| `telemetryTransport` | `BaseTelemetryTransport` | No | - | Custom transport for telemetry data |
32
33
## Properties
34
35
The `Composio` class provides access to the following core models:
36
37
-| Property | Type | Description |
38
-|----------|------|-------------|
39
-| `tools` | `Tools` | Access to tools functionality |
40
-| `toolkits` | `Toolkits` | Access to toolkits functionality |
41
-| `triggers` | `Triggers` | Access to triggers functionality |
42
-| `authConfigs` | `AuthConfigs` | Access to auth configs functionality |
43
-| `connectedAccounts` | `ConnectedAccounts` | Access to connected accounts functionality |
44
-| `provider` | `BaseComposioProvider` | The provider being used |
37
+| Property | Type | Description |
38
+| ------------------- | ---------------------- | ------------------------------------------ |
39
+| `tools` | `Tools` | Access to tools functionality |
40
+| `toolkits` | `Toolkits` | Access to toolkits functionality |
41
+| `triggers` | `Triggers` | Access to triggers functionality |
42
+| `authConfigs` | `AuthConfigs` | Access to auth configs functionality |
43
+| `connectedAccounts` | `ConnectedAccounts` | Access to connected accounts functionality |
44
+| `provider` | `BaseComposioProvider` | The provider being used |
45
46
## Methods
47
@@ -62,7 +62,7 @@ const client = composio.getClient();
62
### Basic Initialization
63
64
```typescript
65
-import { Composio } from '@composio/sdk';
65
+import { Composio } from '@composio/core';
66
67
const composio = new Composio({
68
apiKey: process.env.COMPOSIO_API_KEY,
@@ -72,7 +72,8 @@ const composio = new Composio({
72
### Custom Provider
73
74
```typescript
75
-import { Composio, OpenAIProvider } from '@composio/sdk';
75
+import { Composio } from '@composio/core';
76
+import { OpenAIProvider } from '@composio/openai';
77
78
const openaiProvider = new OpenAIProvider();
79
const composio = new Composio({
@@ -84,10 +85,10 @@ const composio = new Composio({
85
### Disable Tracking
86
87
```typescript
87
-import { Composio } from '@composio/sdk';
88
+import { Composio } from '@composio/core';
89
90
const composio = new Composio({
91
apiKey: process.env.COMPOSIO_API_KEY,
92
allowTracking: false,
93
});
93
-```
\ No newline at end of file
94
+```
docs/api/providers.md
+22
-21
@@ -26,7 +26,7 @@ abstract class BaseNonAgenticProvider<TToolCollection, TTool> extends BaseProvid
26
27
// Wrap a tool in the provider specific format
28
abstract wrapTool(tool: Tool): TTool;
29
-
29
+
30
// Wrap a list of tools in the provider specific format
31
abstract wrapTools(tools: Tool[]): TToolCollection;
32
}
@@ -42,7 +42,7 @@ abstract class BaseAgenticProvider<TToolCollection, TTool> extends BaseProvider
42
43
// Wrap a tool in the provider specific format
44
abstract wrapTool(tool: Tool, executeTool: ExecuteToolFn): TTool;
45
-
45
+
46
// Wrap a list of tools in the provider specific format
47
abstract wrapTools(tools: Tool[], executeTool: ExecuteToolFn): TToolCollection;
48
}
@@ -53,7 +53,8 @@ abstract class BaseAgenticProvider<TToolCollection, TTool> extends BaseProvider
53
The default provider for Composio SDK is the OpenAI Provider, which formats tools for use with OpenAI's API.
54
55
```typescript
56
-import { Composio, OpenAIProvider } from '@composio/sdk';
56
+import { Composio } from '@composio/core';
57
+import { OpenAIProvider } from '@composio/openai';
58
59
const composio = new Composio({
60
apiKey: 'your-api-key',
@@ -72,6 +73,7 @@ const openaiTool = openaiProvider.wrapTool(composioTool);
73
```
74
75
**Parameters:**
76
+
77
- `tool` (Tool): The Composio tool to transform
78
79
**Returns:** OpenAI.ChatCompletionTool - The tool in OpenAI format
@@ -85,6 +87,7 @@ const openaiTools = openaiProvider.wrapTools(composioTools);
87
```
88
89
**Parameters:**
90
+
91
- `tools` (Tool[]): The list of Composio tools to transform
92
93
**Returns:** Array<OpenAI.ChatCompletionTool> - The tools in OpenAI format
@@ -98,14 +101,15 @@ const result = await openaiProvider.executeToolCall(
101
'user123',
102
toolCall,
103
{ connectedAccountId: 'conn_abc123' },
101
- {
104
+ {
105
beforeToolExecute: (toolSlug, toolkitSlug, params) => params,
103
- afterToolExecute: (toolSlug, toolkitSlug, result) => result
106
+ afterToolExecute: (toolSlug, toolkitSlug, result) => result,
107
}
108
);
109
```
110
111
**Parameters:**
112
+
113
- `userId` (string): The user ID
114
- `tool` (OpenAI.ChatCompletionMessageToolCall): The tool call from OpenAI
115
- `options` (ExecuteToolFnOptions): Optional parameters for tool execution
@@ -118,13 +122,11 @@ const result = await openaiProvider.executeToolCall(
122
Handles tool calls from an OpenAI chat completion.
123
124
```typescript
121
-const outputs = await openaiProvider.handleToolCall(
122
- 'user123',
123
- chatCompletion
124
-);
125
+const outputs = await openaiProvider.handleToolCall('user123', chatCompletion);
126
```
127
128
**Parameters:**
129
+
130
- `userId` (string): The user ID
131
- `chatCompletion` (OpenAI.ChatCompletion): The chat completion containing tool calls
132
- `options` (ExecuteToolFnOptions): Optional parameters for tool execution
@@ -137,13 +139,11 @@ const outputs = await openaiProvider.handleToolCall(
139
Handles tool calls from an OpenAI assistant run.
140
141
```typescript
140
-const toolOutputs = await openaiProvider.handleAssistantMessage(
141
- 'user123',
142
- run
143
-);
142
+const toolOutputs = await openaiProvider.handleAssistantMessage('user123', run);
143
```
144
145
**Parameters:**
146
+
147
- `userId` (string): The user ID
148
- `run` (OpenAI.Beta.Threads.Run): The run object containing tool calls
149
- `options` (ExecuteToolFnOptions): Optional parameters for tool execution
@@ -167,6 +167,7 @@ for await (const event of openaiProvider.waitAndHandleAssistantStreamToolCalls(
167
```
168
169
**Parameters:**
170
+
171
- `userId` (string): The user ID
172
- `client` (OpenAI): The OpenAI client
173
- `runStream` (Stream<OpenAI.Beta.Assistants.AssistantStreamEvent>): The run stream
@@ -190,6 +191,7 @@ const finalRun = await openaiProvider.waitAndHandleAssistantToolCalls(
191
```
192
193
**Parameters:**
194
+
195
- `userId` (string): The user ID
196
- `client` (OpenAI): The OpenAI client
197
- `run` (OpenAI.Beta.Threads.Run): The run object containing tool calls
@@ -204,7 +206,7 @@ const finalRun = await openaiProvider.waitAndHandleAssistantToolCalls(
206
You can create custom providers by extending either `BaseNonAgenticProvider` or `BaseAgenticProvider`:
207
208
```typescript
207
-import { BaseNonAgenticProvider, Tool } from '@composio/sdk';
209
+import { BaseNonAgenticProvider, Tool } from '@composio/core';
210
211
type AnthropicTool = {
212
name: string;
@@ -214,7 +216,10 @@ type AnthropicTool = {
216
217
type AnthropicToolCollection = AnthropicTool[];
218
217
-export class AnthropicProvider extends BaseNonAgenticProvider<AnthropicToolCollection, AnthropicTool> {
219
+export class AnthropicProvider extends BaseNonAgenticProvider<
220
+ AnthropicToolCollection,
221
+ AnthropicTool
222
+> {
223
readonly name = 'anthropic';
224
225
override wrapTool(tool: Tool): AnthropicTool {
@@ -265,11 +270,7 @@ interface ExecuteToolModifiers {
270
### TransformToolSchemaModifier
271
272
```typescript
268
-type TransformToolSchemaModifier = (
269
- toolSlug: string,
270
- toolkitSlug: string,
271
- tool: Tool
272
-) => Tool;
273
+type TransformToolSchemaModifier = (toolSlug: string, toolkitSlug: string, tool: Tool) => Tool;
274
```
275
276
### BeforeToolExecuteModifier
@@ -290,4 +291,4 @@ type AfterToolExecuteModifier = (
291
toolkitSlug: string,
292
result: ToolExecuteResponse
293
) => ToolExecuteResponse;
293
-```
\ No newline at end of file
294
+```
docs/getting-started.md
+28
-27
@@ -8,13 +8,13 @@ Install the Composio SDK using npm, yarn, or pnpm:
8
9
```bash
10
# Using npm
11
-npm install @composio/sdk
11
+npm install @composio/core
12
13
# Using yarn
14
-yarn add @composio/sdk
14
+yarn add @composio/core
15
16
# Using pnpm
17
-pnpm add @composio/sdk
17
+pnpm add @composio/core
18
```
19
20
## Initialization
@@ -22,7 +22,7 @@ pnpm add @composio/sdk
22
To use the SDK, you need to initialize it with your API key:
23
24
```typescript
25
-import { Composio } from '@composio/sdk';
25
+import { Composio } from '@composio/core';
26
27
// Initialize the SDK
28
const composio = new Composio({
@@ -33,7 +33,8 @@ const composio = new Composio({
33
You can also customize the initialization with additional options:
34
35
```typescript
36
-import { Composio, OpenAIProvider } from '@composio/sdk';
36
+import { Composio } from '@composio/core';
37
+import { OpenAIProvider } from '@composio/openai';
38
39
// Initialize with custom provider and options
40
const composio = new Composio({
@@ -57,7 +58,7 @@ console.log(allToolkits.items);
58
59
// Get toolkits by category
60
const devToolkits = await composio.toolkits.get({
60
- category: 'developer-tools'
61
+ category: 'developer-tools',
62
});
63
```
64
@@ -139,7 +140,7 @@ const result = await composio.tools.execute('GITHUB_GET_REPOS', {
140
Composio integrates seamlessly with OpenAI. Here's an example of using Composio tools with OpenAI:
141
142
```typescript
142
-import { Composio } from '@composio/sdk';
143
+import { Composio } from '@composio/core';
144
import OpenAI from 'openai';
145
146
// Initialize Composio and OpenAI
@@ -161,7 +162,7 @@ const completion = await openai.chat.completions.create({
162
model: 'gpt-4-turbo',
163
messages: [
164
{ role: 'system', content: 'You are a helpful assistant with access to GitHub tools.' },
164
- { role: 'user', content: 'List the repositories in the Composio organization' }
165
+ { role: 'user', content: 'List the repositories in the Composio organization' },
166
],
167
tools, // Pass the tools to OpenAI
168
});
@@ -172,13 +173,13 @@ if (completion.choices[0].message.tool_calls) {
173
for (const toolCall of completion.choices[0].message.tool_calls) {
174
// Parse the arguments
175
const args = JSON.parse(toolCall.function.arguments);
175
-
176
+
177
// Execute the tool
178
const result = await composio.tools.execute(toolCall.function.name, {
179
userId: 'default',
180
arguments: args,
181
});
181
-
182
+
183
// Use the result in your application
184
console.log(`Tool ${toolCall.function.name} result:`, result.data);
185
}
@@ -202,15 +203,15 @@ const customTool = await composio.tools.createCustomTool({
203
properties: {
204
location: {
205
type: 'string',
205
- description: 'The location to get the forecast for'
206
+ description: 'The location to get the forecast for',
207
},
208
days: {
209
type: 'integer',
210
description: 'Number of days for the forecast',
210
- default: 3
211
- }
211
+ default: 3,
212
+ },
213
},
213
- required: ['location']
214
+ required: ['location'],
215
},
216
outputParameters: {
217
type: 'object',
@@ -222,32 +223,32 @@ const customTool = await composio.tools.createCustomTool({
223
properties: {
224
date: { type: 'string' },
225
temperature: { type: 'number' },
225
- conditions: { type: 'string' }
226
- }
227
- }
228
- }
229
- }
226
+ conditions: { type: 'string' },
227
+ },
228
+ },
229
+ },
230
+ },
231
},
232
handler: async (params, context) => {
233
try {
234
const { location, days = 3 } = params.arguments;
234
-
235
+
236
// Here you would call your weather API
237
const forecast = await getWeatherForecast(location, days);
237
-
238
+
239
return {
240
data: { forecast },
241
successful: true,
241
- error: null
242
+ error: null,
243
};
244
} catch (error) {
245
return {
246
data: {},
247
successful: false,
247
- error: error.message
248
+ error: error.message,
249
};
250
}
250
- }
251
+ },
252
});
253
254
// Now you can use your custom tool
@@ -255,8 +256,8 @@ const result = await composio.tools.execute('WEATHER_FORECAST', {
256
userId: 'default',
257
arguments: {
258
location: 'San Francisco, CA',
258
- days: 5
259
- }
259
+ days: 5,
260
+ },
261
});
262
263
console.log(result.data.forecast);
@@ -269,4 +270,4 @@ Now that you understand the basics, you can:
270
- Explore [more examples](../examples) to see how to use Composio in different scenarios
271
- Learn about [custom providers](./api/providers.md) to integrate with other AI frameworks
272
- Understand [error handling](./advanced/error-handling.md) to make your application more robust
272
-- Implement [middleware and modifiers](./advanced/middleware.md) to customize tool execution
\ No newline at end of file
273
+- Implement [middleware and modifiers](./advanced/middleware.md) to customize tool execution
docs/index.md
renamed
+1
-1
@@ -49,7 +49,7 @@ Check out the [Core Concepts](./core-concepts.md) documentation for more detaile
49
Here's a quick example of how to use the Composio SDK:
50
51
```typescript
52
-import { Composio } from '@composio/sdk';
52
+import { Composio } from '@composio/core';
53
54
// Initialize the SDK
55
const composio = new Composio({
docs/providers/custom.md
+35
-27
@@ -14,7 +14,7 @@ Composio supports two types of providers:
14
Non-agentic providers extend the `BaseNonAgenticProvider` class:
15
16
```typescript
17
-import { BaseNonAgenticProvider, Tool } from '@composio/sdk';
17
+import { BaseNonAgenticProvider, Tool } from '@composio/core';
18
19
// Define the tool type for your provider
20
type AnthropicTool = {
@@ -27,7 +27,10 @@ type AnthropicTool = {
27
type AnthropicToolCollection = AnthropicTool[];
28
29
// Create the provider class
30
-export class AnthropicProvider extends BaseNonAgenticProvider<AnthropicToolCollection, AnthropicTool> {
30
+export class AnthropicProvider extends BaseNonAgenticProvider<
31
+ AnthropicToolCollection,
32
+ AnthropicTool
33
+> {
34
// Define the provider name (used for telemetry)
35
readonly name = 'anthropic';
36
@@ -51,7 +54,7 @@ export class AnthropicProvider extends BaseNonAgenticProvider<AnthropicToolColle
54
userId,
55
arguments: params,
56
});
54
-
57
+
58
return JSON.stringify(result);
59
}
60
}
@@ -62,7 +65,7 @@ export class AnthropicProvider extends BaseNonAgenticProvider<AnthropicToolColle
65
Agentic providers extend the `BaseAgenticProvider` class:
66
67
```typescript
65
-import { BaseAgenticProvider, Tool, ExecuteToolFn } from '@composio/sdk';
68
+import { BaseAgenticProvider, Tool, ExecuteToolFn } from '@composio/core';
69
70
// Define the tool type for your provider
71
type LangchainTool = {
@@ -90,19 +93,19 @@ export class LangchainProvider extends BaseAgenticProvider<LangchainToolset, Lan
93
func: async (input: Record<string, unknown>) => {
94
const result = await executeToolFn(tool.slug, input);
95
return result.data;
93
- }
96
+ },
97
};
98
}
99
100
// Implement the wrapTools method (note the executeToolFn parameter)
101
override wrapTools(tools: Tool[], executeToolFn: ExecuteToolFn): LangchainToolset {
102
const langchainTools = tools.map(tool => this.wrapTool(tool, executeToolFn));
100
-
103
+
104
return {
105
tools: langchainTools,
106
executor: async (tool, input) => {
107
return await tool.func(input);
105
- }
108
+ },
109
};
110
}
111
@@ -114,7 +117,7 @@ export class LangchainProvider extends BaseAgenticProvider<LangchainToolset, Lan
117
run: async (prompt: string) => {
118
// Run the agent with the prompt
119
// The agent would use the tools.executor to execute tools
117
- }
120
+ },
121
};
122
}
123
}
@@ -125,7 +128,7 @@ export class LangchainProvider extends BaseAgenticProvider<LangchainToolset, Lan
128
Once you've created a custom provider, you can use it with the Composio SDK:
129
130
```typescript
128
-import { Composio } from '@composio/sdk';
131
+import { Composio } from '@composio/core';
132
import { AnthropicProvider } from './providers/anthropic-provider';
133
134
// Create an instance of your custom provider
@@ -169,11 +172,16 @@ Example:
172
```typescript
173
class MyProvider extends BaseNonAgenticProvider<MyToolCollection, MyTool> {
174
// Other methods...
172
-
173
- async executeWithContext(userId: string, toolSlug: string, args: Record<string, unknown>, context: string) {
175
+
176
+ async executeWithContext(
177
+ userId: string,
178
+ toolSlug: string,
179
+ args: Record<string, unknown>,
180
+ context: string
181
+ ) {
182
// Add context to the arguments
183
const argsWithContext = { ...args, context };
176
-
184
+
185
// Execute the tool
186
return this.executeTool(toolSlug, {
187
userId,
@@ -228,7 +236,7 @@ wrapTools(tools: Tool[], executeToolFn: ExecuteToolFn): TToolCollection;
236
### Claude Provider Example
237
238
```typescript
231
-import { BaseNonAgenticProvider, Tool } from '@composio/sdk';
239
+import { BaseNonAgenticProvider, Tool } from '@composio/core';
240
241
type ClaudeTool = {
242
name: string;
@@ -252,7 +260,7 @@ export class ClaudeProvider extends BaseNonAgenticProvider<ClaudeToolCollection,
260
properties: tool.inputParameters?.properties || {},
261
required: tool.inputParameters?.required || [],
262
};
255
-
263
+
264
return {
265
name: tool.slug,
266
description: tool.description || '',
@@ -270,7 +278,7 @@ export class ClaudeProvider extends BaseNonAgenticProvider<ClaudeToolCollection,
278
userId,
279
arguments: input,
280
});
273
-
281
+
282
return result.data;
283
}
284
}
@@ -279,7 +287,7 @@ export class ClaudeProvider extends BaseNonAgenticProvider<ClaudeToolCollection,
287
### LangChain Provider Example
288
289
```typescript
282
-import { BaseAgenticProvider, Tool, ExecuteToolFn } from '@composio/sdk';
290
+import { BaseAgenticProvider, Tool, ExecuteToolFn } from '@composio/core';
291
292
// These types would match the actual LangChain API
293
type LangChainTool = {
@@ -305,7 +313,7 @@ export class LangChainProvider extends BaseAgenticProvider<LangChainToolset, Lan
313
throw new Error(result.error || 'Tool execution failed');
314
}
315
return result.data;
308
- }
316
+ },
317
};
318
}
319
@@ -328,39 +336,39 @@ You can store provider-specific context or state in your provider class:
336
```typescript
337
class ProviderWithContext extends BaseNonAgenticProvider<MyToolCollection, MyTool> {
338
readonly name = 'provider-with-context';
331
-
339
+
340
// Provider-specific context
341
private cache = new Map<string, any>();
342
private config: any;
335
-
343
+
344
constructor(config: any) {
345
super();
346
this.config = config;
347
}
340
-
348
+
349
override wrapTool(tool: Tool): MyTool {
350
// Use the config when wrapping tools
351
const customizedTool = {
352
name: tool.slug,
345
- description: this.config.addDescriptionPrefix
346
- ? `[${this.config.descriptionPrefix}] ${tool.description}`
353
+ description: this.config.addDescriptionPrefix
354
+ ? `[${this.config.descriptionPrefix}] ${tool.description}`
355
: tool.description,
356
// Other properties...
357
};
350
-
358
+
359
// Cache the tool for later use
360
this.cache.set(tool.slug, customizedTool);
353
-
361
+
362
return customizedTool;
363
}
356
-
364
+
365
override wrapTools(tools: Tool[]): MyToolCollection {
366
return tools.map(tool => this.wrapTool(tool));
367
}
360
-
368
+
369
// Custom method that uses the cache
370
getTool(slug: string): MyTool | undefined {
371
return this.cache.get(slug);
372
}
373
}
366
-```
\ No newline at end of file
374
+```
docs/providers/openai.md
+63
-50
@@ -16,7 +16,7 @@ The OpenAI Provider allows you to:
16
The OpenAI Provider is used by default when you initialize the Composio SDK:
17
18
```typescript
19
-import { Composio } from '@composio/sdk';
19
+import { Composio } from '@composio/core';
20
21
// OpenAI Provider is used by default
22
const composio = new Composio({
@@ -27,7 +27,8 @@ const composio = new Composio({
27
You can also explicitly specify the OpenAI Provider:
28
29
```typescript
30
-import { Composio, OpenAIProvider } from '@composio/sdk';
30
+import { Composio } from '@composio/core';
31
+import { OpenAIProvider } from '@composio/openai';
32
33
// Explicitly specify the OpenAI Provider
34
const composio = new Composio({
@@ -41,7 +42,7 @@ const composio = new Composio({
42
The OpenAI Provider transforms Composio tools into OpenAI function tools:
43
44
```typescript
44
-import { Composio } from '@composio/sdk';
45
+import { Composio } from '@composio/core';
46
import OpenAI from 'openai';
47
48
const composio = new Composio({
@@ -65,7 +66,7 @@ const completion = await openai.chat.completions.create({
66
model: 'gpt-4',
67
messages: [
68
{ role: 'system', content: 'You are a helpful assistant with GitHub tools.' },
68
- { role: 'user', content: 'Find information about the Composio SDK repository' }
69
+ { role: 'user', content: 'Find information about the Composio SDK repository' },
70
],
71
tools, // Pass the tools to OpenAI
72
});
@@ -76,7 +77,8 @@ const completion = await openai.chat.completions.create({
77
When OpenAI's model decides to call a tool, you can use the OpenAI Provider to handle it:
78
79
```typescript
79
-import { Composio, OpenAIProvider } from '@composio/sdk';
80
+import { Composio } from '@composio/core';
81
+import { OpenAIProvider } from '@composio/openai';
82
import OpenAI from 'openai';
83
84
const composio = new Composio({
@@ -100,7 +102,7 @@ const completion = await openai.chat.completions.create({
102
model: 'gpt-4',
103
messages: [
104
{ role: 'system', content: 'You are a helpful assistant with GitHub tools.' },
103
- { role: 'user', content: 'Find information about the Composio SDK repository' }
105
+ { role: 'user', content: 'Find information about the Composio SDK repository' },
106
],
107
tools,
108
});
@@ -113,7 +115,7 @@ if (completion.choices[0].message.tool_calls) {
115
completion,
116
{ connectedAccountId: 'connected_account_123' } // Optional
117
);
116
-
118
+
119
// Continue the conversation with the tool outputs
120
const followupCompletion = await openai.chat.completions.create({
121
model: 'gpt-4',
@@ -121,11 +123,15 @@ if (completion.choices[0].message.tool_calls) {
123
{ role: 'system', content: 'You are a helpful assistant with GitHub tools.' },
124
{ role: 'user', content: 'Find information about the Composio SDK repository' },
125
completion.choices[0].message,
124
- { role: 'tool', content: toolOutputs[0], tool_call_id: completion.choices[0].message.tool_calls[0].id }
126
+ {
127
+ role: 'tool',
128
+ content: toolOutputs[0],
129
+ tool_call_id: completion.choices[0].message.tool_calls[0].id,
130
+ },
131
],
132
tools,
133
});
128
-
134
+
135
console.log(followupCompletion.choices[0].message.content);
136
}
137
```
@@ -135,7 +141,8 @@ if (completion.choices[0].message.tool_calls) {
141
The OpenAI Provider includes helper methods for working with OpenAI Assistants:
142
143
```typescript
138
-import { Composio, OpenAIProvider } from '@composio/sdk';
144
+import { Composio } from '@composio/core';
145
+import { OpenAIProvider } from '@composio/openai';
146
import OpenAI from 'openai';
147
148
const composio = new Composio({
@@ -195,7 +202,8 @@ console.log(messages.data[0].content);
202
The OpenAI Provider can also handle streaming responses with tool calls:
203
204
```typescript
198
-import { Composio, OpenAIProvider } from '@composio/sdk';
205
+import { Composio } from '@composio/core';
206
+import { OpenAIProvider } from '@composio/openai';
207
import OpenAI from 'openai';
208
209
const composio = new Composio({
@@ -262,46 +270,51 @@ for await (const event of openaiProvider.waitAndHandleAssistantStreamToolCalls(
270
You can use modifiers with the OpenAI Provider to transform tools and tool execution:
271
272
```typescript
265
-import { Composio, OpenAIProvider } from '@composio/sdk';
273
+import { Composio } from '@composio/core';
274
+import { OpenAIProvider } from '@composio/openai';
275
276
const composio = new Composio({
277
apiKey: 'your-composio-api-key',
278
});
279
280
// Get GitHub tools with modifiers
272
-const tools = await composio.tools.get('default', {
273
- toolkits: ['github'],
274
-}, {
275
- // Modify tool schema
276
- modifyToolSchema: (toolSlug, toolkitSlug, tool) => {
277
- // Make tool descriptions more concise for OpenAI
278
- if (tool.description && tool.description.length > 100) {
279
- tool.description = tool.description.substring(0, 100) + '...';
280
- }
281
- return tool;
281
+const tools = await composio.tools.get(
282
+ 'default',
283
+ {
284
+ toolkits: ['github'],
285
},
283
-
284
- // Modify parameters before execution
285
- beforeToolExecute: (toolSlug, toolkitSlug, params) => {
286
- console.log(`Executing ${toolSlug} tool`);
287
- return params;
288
- },
289
-
290
- // Transform results after execution
291
- afterToolExecute: (toolSlug, toolkitSlug, result) => {
292
- // Format the result data for better presentation
293
- if (result.successful && toolSlug === 'GITHUB_GET_REPO') {
294
- result.data = {
295
- name: result.data.name,
296
- description: result.data.description,
297
- stars: result.data.stargazers_count,
298
- forks: result.data.forks_count,
299
- url: result.data.html_url,
300
- };
301
- }
302
- return result;
286
+ {
287
+ // Modify tool schema
288
+ modifyToolSchema: (toolSlug, toolkitSlug, tool) => {
289
+ // Make tool descriptions more concise for OpenAI
290
+ if (tool.description && tool.description.length > 100) {
291
+ tool.description = tool.description.substring(0, 100) + '...';
292
+ }
293
+ return tool;
294
+ },
295
+
296
+ // Modify parameters before execution
297
+ beforeToolExecute: (toolSlug, toolkitSlug, params) => {
298
+ console.log(`Executing ${toolSlug} tool`);
299
+ return params;
300
+ },
301
+
302
+ // Transform results after execution
303
+ afterToolExecute: (toolSlug, toolkitSlug, result) => {
304
+ // Format the result data for better presentation
305
+ if (result.successful && toolSlug === 'GITHUB_GET_REPO') {
306
+ result.data = {
307
+ name: result.data.name,
308
+ description: result.data.description,
309
+ stars: result.data.stargazers_count,
310
+ forks: result.data.forks_count,
311
+ url: result.data.html_url,
312
+ };
313
+ }
314
+ return result;
315
+ },
316
}
304
-});
317
+);
318
```
319
320
## Type Definitions
@@ -318,31 +331,31 @@ type OpenAiToolCollection = Array<OpenAiTool>;
331
// The provider class
332
class OpenAIProvider extends BaseNonAgenticProvider<OpenAiToolCollection, OpenAiTool> {
333
readonly name = 'openai';
321
-
334
+
335
wrapTool(tool: Tool): OpenAiTool;
336
wrapTools(tools: Tool[]): OpenAiToolCollection;
324
-
337
+
338
executeToolCall(
339
userId: string,
340
tool: OpenAI.ChatCompletionMessageToolCall,
341
options?: ExecuteToolFnOptions,
342
modifiers?: ExecuteToolModifiers
343
): Promise<string>;
331
-
344
+
345
handleToolCall(
346
userId: string,
347
chatCompletion: OpenAI.ChatCompletion,
348
options?: ExecuteToolFnOptions,
349
modifiers?: ExecuteToolModifiers
350
): Promise<string[]>;
338
-
351
+
352
handleAssistantMessage(
353
userId: string,
354
run: OpenAI.Beta.Threads.Run,
355
options?: ExecuteToolFnOptions,
356
modifiers?: ExecuteToolModifiers
357
): Promise<OpenAI.Beta.Threads.Runs.RunSubmitToolOutputsParams.ToolOutput[]>;
345
-
358
+
359
waitAndHandleAssistantStreamToolCalls(
360
userId: string,
361
client: OpenAI,
@@ -351,7 +364,7 @@ class OpenAIProvider extends BaseNonAgenticProvider<OpenAiToolCollection, OpenAi
364
options?: ExecuteToolFnOptions,
365
modifiers?: ExecuteToolModifiers
366
): AsyncGenerator<OpenAI.Beta.Assistants.AssistantStreamEvent, void, unknown>;
354
-
367
+
368
waitAndHandleAssistantToolCalls(
369
userId: string,
370
client: OpenAI,
@@ -361,4 +374,4 @@ class OpenAIProvider extends BaseNonAgenticProvider<OpenAiToolCollection, OpenAi
374
modifiers?: ExecuteToolModifiers
375
): Promise<OpenAI.Beta.Threads.Run>;
376
}
364
-```
\ No newline at end of file
377
+```