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 22, 17:00 UTC
native tools update
Sushmithamallesh committed
Dec 16, 2025 at 01:25 UTC
2f1b298967fd41f43baccad80a559613aa73497c
3 files changed
+13
-28
fern/pages/src/tool-router/using-as-a-native-tool.mdx
+2
-2
@@ -45,7 +45,7 @@ Create a Tool Router session and use it as a native tool with OpenAI Agents SDK:
45
### Installation
46
47
```bash
48
-npm install @composio/core @composio/vercel ai @ai-sdk/openai
48
+npm install @composio/core @composio/vercel ai @ai-sdk/anthropic
49
```
50
51
### Usage
@@ -54,7 +54,7 @@ Create a Tool Router session and use it as a native tool with Vercel AI SDK:
54
55
<Info>
56
- Set your `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
57
-- Set your `OPENAI_API_KEY` environment variable with your [OpenAI API key](https://platform.openai.com/api-keys).
57
+- Set your `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://console.anthropic.com/settings/keys).
58
</Info>
59
60
<SnippetCode src="fern/snippets/tool-router/typescript/native-tools-vercel.ts" />
fern/snippets/tool-router/typescript/native-tools-vercel.ts
+9
-24
@@ -1,9 +1,9 @@
1
import "dotenv/config";
2
import { Composio } from "@composio/core";
3
import { VercelProvider } from "@composio/vercel";
4
-import { openai } from "@ai-sdk/openai";
5
-import { generateText } from "ai";
4
+import { generateText, stepCountIs, ModelMessage } from "ai";
5
import { createInterface } from "readline/promises";
6
+import { anthropic } from "@ai-sdk/anthropic";
7
8
const composio = new Composio({
9
apiKey: process.env.COMPOSIO_API_KEY,
@@ -11,41 +11,26 @@ const composio = new Composio({
11
});
12
13
const session = await composio.create("user_123");
14
-
15
-// Get native tools from Composio
14
const tools = await session.tools();
15
18
-const messages: any[] = [];
16
+const rl = createInterface({ input: process.stdin, output: process.stdout });
17
+const messages: ModelMessage[] = [];
18
20
-// Execute an initial task that requires GitHub access
19
+// Initial task
20
+const initialPrompt = "Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.";
21
console.log("Executing initial task: Fetching GitHub issues...\n");
22
-const initialResult = await generateText({
23
- model: openai("gpt-4-turbo"),
24
- prompt: "Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
25
- tools: tools,
26
-});
27
-console.log(`Result: ${initialResult.text}\n`);
28
-
29
-// Add initial conversation to history
30
-messages.push(
31
- { role: "user", content: "Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs." },
32
- { role: "assistant", content: initialResult.text }
33
-);
34
-
35
-// Continue with interactive conversation
36
-const rl = createInterface({ input: process.stdin, output: process.stdout });
37
-console.log("Assistant: What else would you like me to do? Type 'exit' to end the conversation.\n");
22
23
while (true) {
40
- const userInput = await rl.question("> ");
24
+ const userInput = messages.length === 0 ? initialPrompt : await rl.question("> ");
25
if (userInput.toLowerCase() === "exit") break;
26
27
messages.push({ role: "user", content: userInput });
28
29
const result = await generateText({
46
- model: openai("gpt-4-turbo"),
30
+ model: anthropic("claude-sonnet-4-5"),
31
messages: messages,
32
tools: tools,
33
+ stopWhen: stepCountIs(10),
34
});
35
36
messages.push({ role: "assistant", content: result.text });
fern/snippets/tool-router/typescript/quickstart-native-vercel.ts
+2
-2
@@ -1,7 +1,7 @@
1
import "dotenv/config";
2
import { Composio } from "@composio/core";
3
import { VercelProvider } from "@composio/vercel";
4
-import { generateText, stepCountIs } from "ai";
4
+import { generateText, stepCountIs, ModelMessage } from "ai";
5
import { createInterface } from "readline/promises";
6
import { anthropic } from "@ai-sdk/anthropic";
7
@@ -14,7 +14,7 @@ const session = await composio.create("user_123");
14
const tools = await session.tools();
15
16
const rl = createInterface({ input: process.stdin, output: process.stdout });
17
-const messages: any[] = [];
17
+const messages: ModelMessage[] = [];
18
19
console.log("Assistant: What would you like me to do today?\n");
20