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 { OpenAI } from 'openai';
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
});
const composio = new Composio({
apiKey: process.env.COMPOSIO_API_KEY,
});
const tools = await composio.tools.get('default', {
tools: ['HACKERNEWS_GET_USER'],
});
const query = 'What is the user "pg"';
const response = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [
{
role: 'system',
content: 'You are a helpful assistant that can use tools to answer questions.',
},
{ role: 'user', content: query },
],
tools: tools,
tool_choice: 'auto',
});
const toolCall = await composio.provider.handleToolCalls('default', response);
console.log(toolCall);