Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
import { Composio } from '@composio/core';
import { stepCountIs, streamText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { VercelProvider } from '@composio/vercel';
/**
* Initialize the Composio SDK with the Vercel provider
*/
const composio = new Composio({
apiKey: process.env.COMPOSIO_API_KEY,
provider: new VercelProvider(),
});
const tools = await composio.tools.get('test-user-id', 'HACKERNEWS_GET_TOP_STORIES');
const stream = await streamText({
model: openai('gpt-4o-mini'),
tools,
prompt: 'Summarize the front page of HackerNews',
stopWhen: stepCountIs(5),
});
for await (const textPart of stream.textStream) {
process.stdout.write(textPart);
}