@composio/core 0.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -0
- package/dist/index.cjs +1453 -0
- package/dist/index.d.cts +653 -0
- package/dist/index.d.ts +653 -0
- package/dist/index.js +1419 -0
- package/package.json +39 -0
- package/src/index.ts +30 -0
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# @composio/core
|
|
2
|
+
|
|
3
|
+
The core package of Composio SDK, providing essential functionality for building and managing AI-powered tools and toolsets.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### 1. Core Functionality
|
|
8
|
+
- **Composio Client Integration**: Seamless integration with Composio API
|
|
9
|
+
- **Tool Management**: Create, manage, and execute tools
|
|
10
|
+
- **Toolkit Support**: Organize tools into toolsets
|
|
11
|
+
- **Authentication & Authorization**: Built-in auth configuration and management
|
|
12
|
+
- **Connected Accounts**: Manage multiple account connections
|
|
13
|
+
|
|
14
|
+
### 2. Toolsets
|
|
15
|
+
- **Default OpenAI Toolset**: Ships with built-in OpenAI integration
|
|
16
|
+
- **Extensible Base Toolset**: Create custom toolsets by extending `BaseComposioToolset`
|
|
17
|
+
- **Tool Wrapping**: Standardized tool wrapping and execution
|
|
18
|
+
|
|
19
|
+
### 3. Advanced Features
|
|
20
|
+
- **Telemetry**: Built-in telemetry for monitoring and debugging
|
|
21
|
+
- **Logging**: Configurable logging system with multiple levels
|
|
22
|
+
- **Environment Management**: Flexible configuration through environment variables
|
|
23
|
+
- **Version Management**: Automatic version checking and updates
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @composio/core
|
|
29
|
+
# or
|
|
30
|
+
yarn add @composio/core
|
|
31
|
+
# or
|
|
32
|
+
pnpm add @composio/core
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { Composio } from '@composio/core';
|
|
39
|
+
|
|
40
|
+
// Initialize Composio with default OpenAI toolset
|
|
41
|
+
const composio = new Composio({
|
|
42
|
+
apiKey: 'your-api-key',
|
|
43
|
+
baseURL: 'https://api.composio.dev', // optional
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Get available tools
|
|
47
|
+
const tools = await composio.getTools();
|
|
48
|
+
|
|
49
|
+
// Execute a specific tool
|
|
50
|
+
const result = await composio.tools.execute('tool-slug', {
|
|
51
|
+
// tool parameters
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
The Composio constructor accepts the following configuration options:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
interface ComposioConfig {
|
|
61
|
+
apiKey?: string; // Your Composio API key
|
|
62
|
+
baseURL?: string; // Custom API base URL (optional)
|
|
63
|
+
allowTracking?: boolean; // Enable/disable telemetry (default: true)
|
|
64
|
+
allowTracing?: boolean; // Enable/disable tracing (default: true)
|
|
65
|
+
toolset?: TToolset; // Custom toolset (default: OpenAIToolset)
|
|
66
|
+
userId?: string; // Custom user ID
|
|
67
|
+
connectedAccountIds?: Record<string, string>; // Connected account mappings
|
|
68
|
+
telemetryTransport?: BaseTelemetryTransport; // Custom telemetry transport
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Toolsets
|
|
73
|
+
|
|
74
|
+
### Default OpenAI Toolset
|
|
75
|
+
|
|
76
|
+
The core package ships with OpenAI toolset by default. For more information about the OpenAI toolset and its capabilities, check out the [OpenAI Toolset Documentation](./toolset/OpenAIToolset.md).
|
|
77
|
+
|
|
78
|
+
### Creating Custom Toolsets
|
|
79
|
+
|
|
80
|
+
You can create custom toolsets by extending the `BaseComposioToolset`:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { BaseComposioToolset, Tool } from '@composio/core';
|
|
84
|
+
|
|
85
|
+
interface CustomTool {
|
|
86
|
+
name: string;
|
|
87
|
+
// ... custom tool properties
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
class CustomToolset extends BaseComposioToolset<CustomTool[], CustomTool> {
|
|
91
|
+
readonly FILE_NAME = 'custom/toolset.ts';
|
|
92
|
+
|
|
93
|
+
_wrapTool = (tool: Tool): CustomTool => {
|
|
94
|
+
// Implement tool wrapping logic
|
|
95
|
+
return {
|
|
96
|
+
name: tool.name,
|
|
97
|
+
// ... map other properties
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
async getTools() {
|
|
102
|
+
const tools = await this.client?.tools.list();
|
|
103
|
+
return tools?.items.map(tool => this._wrapTool(tool)) ?? [];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Environment Variables
|
|
109
|
+
|
|
110
|
+
- `COMPOSIO_API_KEY`: Your Composio API key
|
|
111
|
+
- `COMPOSIO_BASE_URL`: Custom API base URL
|
|
112
|
+
- `COMPOSIO_LOGGING_LEVEL`: Logging level (silent, error, warn, info, debug)
|
|
113
|
+
- `DEVELOPMENT`: Development mode flag
|
|
114
|
+
- `CI`: CI environment flag
|
|
115
|
+
|
|
116
|
+
## Contributing
|
|
117
|
+
|
|
118
|
+
We welcome contributions! Please see our [Contributing Guide](../../CONTRIBUTING.md) for more details.
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
ISC License
|
|
123
|
+
|
|
124
|
+
## Support
|
|
125
|
+
|
|
126
|
+
For support, please visit our [Documentation](https://docs.composio.dev) or join our [Discord Community](https://discord.gg/composio).
|