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
fix quickstart
Sushmithamallesh696ab53af683
diff --git a/fern/snippets/tool-router/typescript/quickstart-openai.ts b/fern/snippets/tool-router/typescript/quickstart-openai.tsindex 72954174a..36aa8996d 100644--- a/fern/snippets/tool-router/typescript/quickstart-openai.ts+++ b/fern/snippets/tool-router/typescript/quickstart-openai.ts@@ -1,34 +1,36 @@import { Composio } from "@composio/core";import { Agent, run, hostedMcpTool } from "@openai/agents";+import { createInterface } from "readline/promises";+const composioApiKey = process.env.COMPOSIO_API_KEY;const userId = "550e8400-e29b-41d4-a716-446655440000"; // Your user's unique identifierconst composio = new Composio({ apiKey: composioApiKey });-const { mcp } = await composio.create(userId);-console.log(`Tool Router session created: ${mcp.url}`);const agent = new Agent({name: "Personal Assistant",- instructions: "You are a helpful personal assistant. You should use composio tools to take action.",- model: 'gpt-5.1',+ instructions: "You are a helpful personal assistant. Use Composio tools to take action.",+ model: "gpt-5.1",modelSettings: {- reasoning: { effort: 'low' },+ reasoning: { effort: "low" },},tools: [hostedMcpTool({serverLabel: "composio",serverUrl: mcp.url,headers: {- 'x-api-key': composioApiKey,+ "x-api-key": composioApiKey,},}),],});-console.log("Running the Open AI agent to fetch gmail inbox")-const result = await run(- agent,- "Summarize all the emails in my Gmail inbox today"-);-console.log(result.finalOutput);+const rl = createInterface({ input: process.stdin, output: process.stdout });+while (true) {+ const input = await rl.question("You: ");+ if (input === "exit") break;+ const result = await run(agent, input);+ console.log(`Agent: ${result.finalOutput}\n`);+}+rl.close();