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 workdlows
haxzie committed
May 20, 2025 at 11:36 UTC
5ad91aecd2abbc90bd433ab7dbbbae53b670adfb
4 files changed
+50
-8
.github/workflows/manual-release.yml
examples/connected-accounts/src/magic-flow-demo.ts
new
+47
@@ -0,0 +1,47 @@
1
+import { Composio } from '@composio/core';
2
+import { OpenAI } from 'openai';
3
+
4
+const userId = 'default';
5
+
6
+const composio = new Composio({
7
+ apiKey: process.env.COMPOSIO_API_KEY,
8
+});
9
+
10
+const openai = new OpenAI({
11
+ apiKey: process.env.OPENAI_API_KEY,
12
+});
13
+
14
+// ------------------------------------------------------------
15
+// 1. Authorize the user to GitHub
16
+// ------------------------------------------------------------
17
+
18
+const connectionRequest = await composio.toolkits.authorize(userId, 'github');
19
+// Redirect the user to continue to auth flow
20
+const redirectUrl = connectionRequest.redirectUrl;
21
+
22
+// Wait for the user to connect the account / singin to GitHub
23
+const connectedAccount = await connectionRequest.waitForConnection();
24
+
25
+// ------------------------------------------------------------
26
+// 2. Get the GitHub tools
27
+// ------------------------------------------------------------
28
+
29
+const tools = await composio.tools.get(userId, {
30
+ toolkits: ['github'],
31
+});
32
+
33
+// ------------------------------------------------------------
34
+// 3. Use the Composio GitHub tools with OpenAI
35
+// ------------------------------------------------------------
36
+const task = 'Star the composio repository on GitHub';
37
+const messages: OpenAI.ChatCompletionMessageParam[] = [
38
+ { role: 'system', content: 'You are a helpful assistant that can help with tasks.' },
39
+ { role: 'user', content: task },
40
+];
41
+
42
+const response = await openai.chat.completions.create({
43
+ model: 'gpt-4o-mini',
44
+ messages,
45
+ tools: tools,
46
+ tool_choice: 'auto',
47
+});
examples/toolkits/src/index.ts
+1
-7
@@ -5,10 +5,4 @@ const composio = new Composio({
5
});
6
7
const toolkit = await composio.toolkits.get('hackernews');
8
-
9
-const connectedAccount = await composio.connectedAccounts.list({
10
- user_id: 'default',
11
- toolkit_slug: 'hackernews',
12
-});
13
-
14
-console.log(JSON.stringify(connectedAccount, null, 2));
8
+const client = composio.getClient();
packages/core/src/models/Tools.ts
+2
-1
@@ -200,7 +200,7 @@ export class Tools<
200
201
/**
202
* Lists all tools available in the Composio SDK as well as custom tools.
203
- * This method fetches the tools from the Composio API and wraps them using the provider.
203
+ * This method fetches the tools from the Composio API in the raw format.
204
* @returns {ToolList} List of tools
205
*/
206
async getRawComposioTools(
@@ -257,6 +257,7 @@ export class Tools<
257
258
/**
259
* Retrieves a tool by its Slug.
260
+ * This method is used to get the raw tools from the composio API.
261
* @param slug The ID of the tool to be retrieved
262
* @returns {Promise<Tool>} The tool
263
*