Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added allow tracing in toolset #1374

Merged
merged 2 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions js/src/frameworks/cloudflare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class CloudflareToolSet extends BaseComposioToolSet {
baseUrl?: Optional<string>;
entityId?: string;
connectedAccountIds?: Record<string, string>;
allowTracing?: boolean;
} = {}
) {
super({
Expand All @@ -40,6 +41,7 @@ export class CloudflareToolSet extends BaseComposioToolSet {
runtime: null,
entityId: config.entityId || CloudflareToolSet.DEFAULT_ENTITY_ID,
connectedAccountIds: config.connectedAccountIds,
allowTracing: config.allowTracing || false,
});
}

Expand Down
2 changes: 2 additions & 0 deletions js/src/frameworks/langchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class LangchainToolSet extends BaseComposioToolSet {
entityId?: string;
runtime?: string;
connectedAccountIds?: Record<string, string>;
allowTracing?: boolean;
} = {}
) {
super({
Expand All @@ -32,6 +33,7 @@ export class LangchainToolSet extends BaseComposioToolSet {
runtime: config?.runtime || LangchainToolSet.FRAMEWORK_NAME,
entityId: config.entityId || LangchainToolSet.DEFAULT_ENTITY_ID,
connectedAccountIds: config.connectedAccountIds,
allowTracing: config.allowTracing || false,
});
}

Expand Down
2 changes: 2 additions & 0 deletions js/src/frameworks/langgraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class LangGraphToolSet extends BaseComposioToolSet {
baseUrl?: Optional<string>;
entityId?: string;
connectedAccountIds?: Record<string, string>;
allowTracing?: boolean;
} = {}
) {
super({
Expand All @@ -25,6 +26,7 @@ export class LangGraphToolSet extends BaseComposioToolSet {
entityId: config.entityId || LangGraphToolSet.DEFAULT_ENTITY_ID,
runtime: LangGraphToolSet.FRAMEWORK_NAME,
connectedAccountIds: config.connectedAccountIds,
allowTracing: config.allowTracing || false,
});
}
}
2 changes: 2 additions & 0 deletions js/src/frameworks/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class OpenAIToolSet extends BaseComposioToolSet {
baseUrl?: Optional<string>;
entityId?: string;
connectedAccountIds?: Record<string, string>;
allowTracing?: boolean;
} = {}
) {
super({
Expand All @@ -38,6 +39,7 @@ export class OpenAIToolSet extends BaseComposioToolSet {
runtime: OpenAIToolSet.FRAMEWORK_NAME,
entityId: config.entityId || OpenAIToolSet.DEFAULT_ENTITY_ID,
connectedAccountIds: config.connectedAccountIds,
allowTracing: config.allowTracing || false,
});
}

Expand Down
2 changes: 2 additions & 0 deletions js/src/frameworks/vercel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class VercelAIToolSet extends BaseComposioToolSet {
baseUrl?: Optional<string>;
entityId?: string;
connectedAccountIds?: Record<string, string>;
allowTracing?: boolean;
} = {}
) {
super({
Expand All @@ -36,6 +37,7 @@ export class VercelAIToolSet extends BaseComposioToolSet {
runtime: "vercel-ai",
entityId: config.entityId || "default",
connectedAccountIds: config.connectedAccountIds,
allowTracing: config.allowTracing || false,
});
}

Expand Down
4 changes: 4 additions & 0 deletions js/src/sdk/base.toolset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,22 @@ export class ComposioToolSet {
* @param {string|null} config.runtime - Runtime environment
* @param {string} config.entityId - Entity ID for operations
* @param {Record<string, string>} config.connectedAccountIds - Map of app names to their connected account IDs
* @param {boolean} config.allowTracing - Whether to allow tracing for the SDK
*/
constructor({
apiKey,
baseUrl,
runtime,
entityId,
connectedAccountIds,
allowTracing,
}: {
apiKey?: string | null;
baseUrl?: string | null;
runtime?: string | null;
entityId?: string;
connectedAccountIds?: Record<string, string>;
allowTracing?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a type definition for the tracing configuration to make it more extensible in the future. For example:

type TracingConfig = {
  enabled: boolean;
  level?: 'debug' | 'info' | 'error';
  // Add other tracing-specific configurations here
};

This would make it easier to add more tracing features later without breaking changes.

} = {}) {
const clientApiKey: string | undefined =
apiKey ||
Expand All @@ -102,6 +105,7 @@ export class ComposioToolSet {
apiKey: this.apiKey,
baseUrl: baseUrl || undefined,
runtime: runtime as string,
allowTracing: allowTracing || false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding validation for the tracing configuration in the constructor. For example:

if (allowTracing && typeof allowTracing !== 'boolean') {
  throw new Error('allowTracing must be a boolean value');
}

This would help catch configuration errors early.

});

this.runtime = runtime || null;
Expand Down
Loading