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 21, 04:45 UTC
| 1 | import { query } from '@anthropic-ai/claude-agent-sdk'; |
| 2 | import { Composio } from '@composio/core'; |
| 3 | import 'dotenv/config'; |
| 4 | |
| 5 | const composio = new Composio(); |
| 6 | |
| 7 | const session = await composio.create('user_123', { toolkits: ['gmail'], mcp: true }); |
| 8 | |
| 9 | const stream = await query({ |
| 10 | prompt: 'Use composio tools to fetch my last email from gmail', |
| 11 | options: { |
| 12 | model: 'claude-sonnet-4-5-20250929', |
| 13 | permissionMode: 'bypassPermissions', |
| 14 | mcpServers: { |
| 15 | composio: { |
| 16 | type: 'http', |
| 17 | url: session.mcp.url, |
| 18 | headers: session.mcp.headers, |
| 19 | }, |
| 20 | }, |
| 21 | }, |
| 22 | }); |
| 23 | |
| 24 | for await (const event of stream) { |
| 25 | if (event.type === 'result' && event.subtype === 'success') { |
| 26 | process.stdout.write(event.result); |
| 27 | } |
| 28 | } |