Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

docs: Use generateText + stopWhen (latest Vercel AI SDK paradigm)

Sushmithamallesh880fbbf32557
diff --git a/docs/content/docs/providers/vercel.mdx b/docs/content/docs/providers/vercel.mdx
index c33e51124..460015a2f 100644
--- a/docs/content/docs/providers/vercel.mdx
+++ b/docs/content/docs/providers/vercel.mdx
@@ -35,14 +35,14 @@ ANTHROPIC_API_KEY=xxxxxxxxx
<Step>
**Create session and run**
-The Vercel provider is **agentic** — tools include an `execute` function, so the AI SDK handles tool calls automatically via `maxSteps`.
+The Vercel provider is **agentic** — tools include an `execute` function, so the AI SDK handles tool calls automatically via [`stopWhen`](https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling).
```typescript
// @noErrors
import { anthropic } from "@ai-sdk/anthropic";
import { Composio } from "@composio/core";
import { VercelProvider } from "@composio/vercel";
-import { streamText, stepCountIs } from "ai";
+import { generateText, stepCountIs } from "ai";
const composio = new Composio({ provider: new VercelProvider() });
@@ -50,16 +50,14 @@ const composio = new Composio({ provider: new VercelProvider() });
const session = await composio.create("user_123");
const tools = await session.tools();
-const stream = await streamText({
+const { text } = await generateText({
model: anthropic("claude-opus-4-6"),
tools,
prompt: "Send an email to [email protected] with the subject 'Hello' and body 'Hello from Composio!'",
stopWhen: stepCountIs(10),
});
-for await (const textPart of stream.textStream) {
- process.stdout.write(textPart);
-}
+console.log(text);
```
</Step>
</Steps>