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

make composio config optional

haxzie committed May 22, 2025 at 18:24 UTC 77c6fd97a84ce9807a0fa4646087d6cdb52f3a6d
2 files changed +6 -8
examples/toolkits/src/index.ts
+1 -3
@@ -1,8 +1,6 @@
1 import { Composio } from '@composio/core';
2
3 -const composio = new Composio({
4 - apiKey: process.env.COMPOSIO_API_KEY,
5 -});
3 +const composio = new Composio();
4
5 const toolkit = await composio.tools.get('default', 'INvalid tool');
6 // const client = composio.getClient();
packages/core/src/composio.ts
+5 -5
@@ -64,7 +64,7 @@ export class Composio<TProvider extends BaseComposioProvider<unknown, unknown> =
64 * @param {boolean} config.allowTracing Whether to allow tracing. Defaults to true.
65 * @param {TProvider} config.provider The provider to use for this Composio instance.
66 */
67 - constructor({ ...config }: ComposioConfig<TProvider>) {
67 + constructor(config?: ComposioConfig<TProvider>) {
68 const { baseURL: baseURLParsed, apiKey: apiKeyParsed } = getSDKConfig(
69 config?.baseURL,
70 config?.apiKey
@@ -89,14 +89,14 @@ export class Composio<TProvider extends BaseComposioProvider<unknown, unknown> =
89 */
90 this.config = {
91 ...config,
92 - allowTracking: config.allowTracking ?? true,
93 - allowTracing: config.allowTracing ?? true,
92 + allowTracking: config?.allowTracking ?? true,
93 + allowTracing: config?.allowTracing ?? true,
94 };
95
96 /**
97 * Set the default provider, if not provided by the user.
98 */
99 - this.provider = (config.provider ?? new OpenAIProvider()) as TProvider;
99 + this.provider = (config?.provider ?? new OpenAIProvider()) as TProvider;
100 this.tools = new Tools(this.client, this.provider);
101
102 this.toolkits = new Toolkits(this.client);
@@ -124,7 +124,7 @@ export class Composio<TProvider extends BaseComposioProvider<unknown, unknown> =
124 // @TODO: We shouldn't be doing this as people might always have one session id throughout the process in server
125 sessionId: this.config.allowTracing ? getRandomUUID() : undefined, // @TODO: get the session id
126 },
127 - config.telemetryTransport
127 + config?.telemetryTransport
128 );
129 }
130 telemetry.instrument(this);