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, 08:15 UTC
fix(docs): update Vercel AI SDK quickstart snippets
- Rename experimental_createMCPClient to createMCPClient (graduated in @ai-sdk/mcp v1.0) - Fix multi-turn message history to include tool calls via result.response.messages - Add missing client.close() cleanup in MCP snippet Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sushmithamallesh committed
Feb 19, 2026 at 01:28 UTC
75759f31e858d0af09a1e1a203b9ad3af4e62fa4
3 files changed
+47
-68
docs/bun.lock
+10
-14
@@ -37,7 +37,7 @@
37
"@composio/mastra": "^0.5.5",
38
"@composio/openai": "^0.5.5",
39
"@composio/openai-agents": "^0.5.5",
40
- "@composio/vercel": "^0.5.5",
40
+ "@composio/vercel": "^0.6.3",
41
"@google/genai": "^1.35.0",
42
"@langchain/core": "^1.1.12",
43
"@langchain/langgraph": "^1.0.15",
@@ -70,17 +70,17 @@
70
"packages": {
71
"@a2a-js/sdk": ["@a2a-js/sdk@0.2.5", "", { "dependencies": { "@types/cors": "^2.8.17", "@types/express": "^4.17.23", "body-parser": "^2.2.0", "cors": "^2.8.5", "express": "^4.21.2", "uuid": "^11.1.0" } }, "sha512-VTDuRS5V0ATbJ/LkaQlisMnTAeYKXAK6scMguVBstf+KIBQ7HIuKhiXLv+G/hvejkV+THoXzoNifInAkU81P1g=="],
72
73
- "@ai-sdk/anthropic": ["@ai-sdk/anthropic@3.0.12", "", { "dependencies": { "@ai-sdk/provider": "3.0.2", "@ai-sdk/provider-utils": "4.0.5" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-1ygMQ2acJ9k+CPRuDiywtkuQwSdsZwAISgbRIayE3PF/Ct2b80c4iGS1CbycYMx+yswPyBMOuPTqebh9vvwMMg=="],
73
+ "@ai-sdk/anthropic": ["@ai-sdk/anthropic@3.0.45", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.15" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-bpIS3RakSsaUhCRTIvL9bcVNeeUMDXWbndpYdXNeMJIIPcElTcvwktvla+JxIfbeK1AdQjB8ggYVChepeXPGwQ=="],
74
75
- "@ai-sdk/gateway": ["@ai-sdk/gateway@3.0.22", "", { "dependencies": { "@ai-sdk/provider": "3.0.5", "@ai-sdk/provider-utils": "4.0.9", "@vercel/oidc": "3.1.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-NgnlY73JNuooACHqUIz5uMOEWvqR1MMVbb2soGLMozLY1fgwEIF5iJFDAGa5/YArlzw2ATVU7zQu7HkR/FUjgA=="],
75
+ "@ai-sdk/gateway": ["@ai-sdk/gateway@3.0.50", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.15", "@vercel/oidc": "3.1.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-Jdd1a8VgbD7l7r+COj0h5SuaYRfPvOJ/AO6l0OrmTPEcI2MUQPr3C4JttfpNkcheEN+gOdy0CtZWuG17bW2fjw=="],
76
77
- "@ai-sdk/mcp": ["@ai-sdk/mcp@1.0.6", "", { "dependencies": { "@ai-sdk/provider": "3.0.2", "@ai-sdk/provider-utils": "4.0.5", "pkce-challenge": "^5.0.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-ybDhfRArYXrA6Lg6JCPgr3FI3h2COPDRLN9DW6mSFITy4eFK3EccC7UyRTJBY+qp7u2qcqUChrOuYFua/HeFPQ=="],
77
+ "@ai-sdk/mcp": ["@ai-sdk/mcp@1.0.21", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.15", "pkce-challenge": "^5.0.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-dRX2X6GDadZNpiylNnw0HP7zJC8ggVOOJV/JtxuF6CgtP8CKnc7a/wEzpUw1m/4AGdD3mTDhKnKFwC4y10a8FQ=="],
78
79
"@ai-sdk/openai": ["@ai-sdk/openai@3.0.9", "", { "dependencies": { "@ai-sdk/provider": "3.0.2", "@ai-sdk/provider-utils": "4.0.5" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-azgo1gmAFwkCDHKWlv9goKBe7SOG5c8zxIX94SEf8748t+ZL0sjPH2RNXk7G6POaZ4A6Os4zhkUnx9KwSk9Bjw=="],
80
81
- "@ai-sdk/provider": ["@ai-sdk/provider@3.0.2", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-HrEmNt/BH/hkQ7zpi2o6N3k1ZR1QTb7z85WYhYygiTxOQuaml4CMtHCWRbric5WPU+RNsYI7r1EpyVQMKO1pYw=="],
81
+ "@ai-sdk/provider": ["@ai-sdk/provider@3.0.8", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-oGMAgGoQdBXbZqNG0Ze56CHjDZ1IDYOwGYxYjO5KLSlz5HiNQ9udIXsPZ61VWaHGZ5XW/jyjmr6t2xz2jGVwbQ=="],
82
83
- "@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.5", "", { "dependencies": { "@ai-sdk/provider": "3.0.2", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-Ow/X/SEkeExTTc1x+nYLB9ZHK2WUId8+9TlkamAx7Tl9vxU+cKzWx2dwjgMHeCN6twrgwkLrrtqckQeO4mxgVA=="],
83
+ "@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.15", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-8XiKWbemmCbvNN0CLR9u3PQiet4gtEVIrX4zzLxnCj06AwsEDJwJVBbKrEI4t6qE8XRSIvU2irka0dcpziKW6w=="],
84
85
"@ai-sdk/provider-utils-v5": ["@ai-sdk/provider-utils@3.0.12", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@standard-schema/spec": "^1.0.0", "eventsource-parser": "^3.0.5" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-ZtbdvYxdMoria+2SlNarEk6Hlgyf+zzcznlD55EAl+7VZvJaSg2sqPvwArY7L6TfDEDJsnCq0fdhBSkYo0Xqdg=="],
86
@@ -178,7 +178,7 @@
178
179
"@composio/openai-agents": ["@composio/openai-agents@0.5.5", "", { "peerDependencies": { "@composio/core": "0.5.5", "@openai/agents": "^0.1.3", "zod": "^4.1.0" } }, "sha512-s8fXolOPf+rbya312QsgNU31ly9d/2xIbRn2Ig2AKkdsIZhB5/kXh710n+pGm7ssTXFOs/Jb9/fiXD+M9PL4Ug=="],
180
181
- "@composio/vercel": ["@composio/vercel@0.5.5", "", { "peerDependencies": { "@composio/core": "0.5.5", "ai": "^5.0.0 || ^6.0.0" } }, "sha512-Z2nT3/5KLFmGQJVxpq5sXZNoa+PSNWEJnIvjB/9J31adR3K/rnanB+L943R1fQtCk93g+nnv3ggZZfaxMZqktw=="],
181
+ "@composio/vercel": ["@composio/vercel@0.6.3", "", { "peerDependencies": { "@composio/core": "0.6.3", "ai": "^5.0.0 || ^6.0.0" } }, "sha512-hwtqufR2mWNwdATsRfrAuWRjPVZG4maRcqWZB4jDLpuIZU1NEBMLmL2Ae7b/QFXvNYXibA4w0Ug8XavV4Zkxlg=="],
182
183
"@emnapi/core": ["@emnapi/core@1.7.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.1.0", "tslib": "^2.4.0" } }, "sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg=="],
184
@@ -854,7 +854,7 @@
854
855
"agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="],
856
857
- "ai": ["ai@6.0.49", "", { "dependencies": { "@ai-sdk/gateway": "3.0.22", "@ai-sdk/provider": "3.0.5", "@ai-sdk/provider-utils": "4.0.9", "@opentelemetry/api": "1.9.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-LABniBX/0R6Tv+iUK5keUZhZLaZUe4YjP5M2rZ4wAdZ8iKV3EfTAoJxuL1aaWTSJKIilKa9QUEkCgnp89/32bw=="],
857
+ "ai": ["ai@6.0.91", "", { "dependencies": { "@ai-sdk/gateway": "3.0.50", "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.15", "@opentelemetry/api": "1.9.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-k1/8BusZMhYVxxLZt0BUZzm9HVDCCh117nyWfWUx5xjR2+tWisJbXgysL7EBMq2lgyHwgpA1jDR3tVjWSdWZXw=="],
858
859
"ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="],
860
@@ -2262,9 +2262,9 @@
2262
2263
"@a2a-js/sdk/uuid": ["uuid@11.1.0", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A=="],
2264
2265
- "@ai-sdk/gateway/@ai-sdk/provider": ["@ai-sdk/provider@3.0.5", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-2Xmoq6DBJqmSl80U6V9z5jJSJP7ehaJJQMy2iFUqTay06wdCqTnPVBBQbtEL8RCChenL+q5DC5H5WzU3vV3v8w=="],
2265
+ "@ai-sdk/openai/@ai-sdk/provider": ["@ai-sdk/provider@3.0.2", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-HrEmNt/BH/hkQ7zpi2o6N3k1ZR1QTb7z85WYhYygiTxOQuaml4CMtHCWRbric5WPU+RNsYI7r1EpyVQMKO1pYw=="],
2266
2267
- "@ai-sdk/gateway/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.9", "", { "dependencies": { "@ai-sdk/provider": "3.0.5", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-bB4r6nfhBOpmoS9mePxjRoCy+LnzP3AfhyMGCkGL4Mn9clVNlqEeKj26zEKEtB6yoSVcT1IQ0Zh9fytwMCDnow=="],
2267
+ "@ai-sdk/openai/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.5", "", { "dependencies": { "@ai-sdk/provider": "3.0.2", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-Ow/X/SEkeExTTc1x+nYLB9ZHK2WUId8+9TlkamAx7Tl9vxU+cKzWx2dwjgMHeCN6twrgwkLrrtqckQeO4mxgVA=="],
2268
2269
"@ai-sdk/provider-utils-v5/@ai-sdk/provider": ["@ai-sdk/provider@2.0.0", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-6o7Y2SeO9vFKB8lArHXehNuusnpddKPk7xqL7T2/b+OvXMRIXUO1rR4wcv1hAFUAT9avGZshty3Wlua/XA7TvA=="],
2270
@@ -2368,10 +2368,6 @@
2368
2369
"@vue/compiler-sfc/estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],
2370
2371
- "ai/@ai-sdk/provider": ["@ai-sdk/provider@3.0.5", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-2Xmoq6DBJqmSl80U6V9z5jJSJP7ehaJJQMy2iFUqTay06wdCqTnPVBBQbtEL8RCChenL+q5DC5H5WzU3vV3v8w=="],
2372
-
2373
- "ai/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.9", "", { "dependencies": { "@ai-sdk/provider": "3.0.5", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-bB4r6nfhBOpmoS9mePxjRoCy+LnzP3AfhyMGCkGL4Mn9clVNlqEeKj26zEKEtB6yoSVcT1IQ0Zh9fytwMCDnow=="],
2374
-
2371
"chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
2372
2373
"chevrotain/lodash-es": ["lodash-es@4.17.21", "", {}, "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="],
docs/content/docs/quickstart.mdx
+36
-53
@@ -697,7 +697,6 @@ ANTHROPIC_API_KEY=your_anthropic_api_key
697
<StepTitle>Create session and run agent</StepTitle>
698
699
```typescript
700
-// @noErrors
700
import "dotenv/config";
701
import { anthropic } from "@ai-sdk/anthropic";
702
import { Composio } from "@composio/core";
@@ -724,7 +723,6 @@ Example tasks:
723
- 'List all open issues on the composio github repository'
724
`);
725
727
-// Message history for multi-turn conversation
726
const messages: ModelMessage[] = [];
727
728
while (true) {
@@ -734,32 +732,25 @@ while (true) {
732
messages.push({ role: "user", content: input });
733
process.stdout.write("Assistant: ");
734
737
- try {
738
- const result = await streamText({
739
- system: "You are a helpful personal assistant. Use Composio tools to take action.",
740
- model: anthropic("claude-sonnet-4-5"),
741
- messages,
742
- stopWhen: stepCountIs(10),
743
- onStepFinish: (step) => {
744
- for (const toolCall of step.toolCalls) {
745
- process.stdout.write(`\n[Using tool: ${toolCall.toolName}]`);
746
- }
747
- },
748
- tools,
749
- });
750
-
751
- let assistantResponse = "";
752
- for await (const textPart of result.textStream) {
753
- process.stdout.write(textPart);
754
- assistantResponse += textPart;
755
- }
756
- console.log();
735
+ const result = await streamText({
736
+ system: "You are a helpful personal assistant. Use Composio tools to take action.",
737
+ model: anthropic("claude-sonnet-4-6"),
738
+ messages,
739
+ stopWhen: stepCountIs(10),
740
+ onStepFinish: (step) => {
741
+ for (const toolCall of step.toolCalls) {
742
+ process.stdout.write(`\n[Using tool: ${toolCall.toolName}]`);
743
+ }
744
+ },
745
+ tools,
746
+ });
747
758
- // Add assistant response to history for context
759
- messages.push({ role: "assistant", content: assistantResponse });
760
- } catch (error) {
761
- console.error("\n[Error]:", error instanceof Error ? error.message : error);
748
+ for await (const textPart of result.textStream) {
749
+ process.stdout.write(textPart);
750
}
751
+ console.log();
752
+
753
+ messages.push(...(await result.response).messages);
754
}
755
756
readline.close();
@@ -796,10 +787,9 @@ ANTHROPIC_API_KEY=your_anthropic_api_key
787
<StepTitle>Create session and run agent</StepTitle>
788
789
```typescript
799
-// @noErrors
790
import "dotenv/config";
791
import { anthropic } from "@ai-sdk/anthropic";
802
-import { experimental_createMCPClient as createMCPClient } from "@ai-sdk/mcp";
792
+import { createMCPClient } from "@ai-sdk/mcp";
793
import { Composio } from "@composio/core";
794
import { streamText, stepCountIs, type ModelMessage } from "ai";
795
import { createInterface } from "readline/promises";
@@ -832,7 +822,6 @@ Example tasks:
822
- 'List all open issues on the composio github repository'
823
`);
824
835
-// Message history for multi-turn conversation
825
const messages: ModelMessage[] = [];
826
827
while (true) {
@@ -842,34 +831,28 @@ while (true) {
831
messages.push({ role: "user", content: input });
832
process.stdout.write("Assistant: ");
833
845
- try {
846
- const result = await streamText({
847
- system: "You are a helpful personal assistant. Use Composio tools to take action.",
848
- model: anthropic("claude-sonnet-4-5"),
849
- messages,
850
- stopWhen: stepCountIs(10),
851
- onStepFinish: (step) => {
852
- for (const toolCall of step.toolCalls) {
853
- process.stdout.write(`\n[Using tool: ${toolCall.toolName}]`);
854
- }
855
- },
856
- tools,
857
- });
858
-
859
- let assistantResponse = "";
860
- for await (const textPart of result.textStream) {
861
- process.stdout.write(textPart);
862
- assistantResponse += textPart;
863
- }
864
- console.log();
834
+ const result = await streamText({
835
+ system: "You are a helpful personal assistant. Use Composio tools to take action.",
836
+ model: anthropic("claude-sonnet-4-6"),
837
+ messages,
838
+ stopWhen: stepCountIs(10),
839
+ onStepFinish: (step) => {
840
+ for (const toolCall of step.toolCalls) {
841
+ process.stdout.write(`\n[Using tool: ${toolCall.toolName}]`);
842
+ }
843
+ },
844
+ tools,
845
+ });
846
866
- // Add assistant response to history for context
867
- messages.push({ role: "assistant", content: assistantResponse });
868
- } catch (error) {
869
- console.error("\n[Error]:", error instanceof Error ? error.message : error);
847
+ for await (const textPart of result.textStream) {
848
+ process.stdout.write(textPart);
849
}
850
+ console.log();
851
+
852
+ messages.push(...(await result.response).messages);
853
}
854
855
+await client.close();
856
readline.close();
857
```
858
</Step>
docs/package.json
+1
-1
@@ -47,7 +47,7 @@
47
"@composio/mastra": "^0.5.5",
48
"@composio/openai": "^0.5.5",
49
"@composio/openai-agents": "^0.5.5",
50
- "@composio/vercel": "^0.5.5",
50
+ "@composio/vercel": "^0.6.3",
51
"@google/genai": "^1.35.0",
52
"@langchain/core": "^1.1.12",
53
"@langchain/langgraph": "^1.0.15",