Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | import * as readline from 'node:readline/promises'; |
| 2 | import { askForApproval, runWithApprovals } from './approval'; |
| 3 | import { |
| 4 | createApprovalSession, |
| 5 | createComposio, |
| 6 | multiArguments, |
| 7 | tool, |
| 8 | toolArguments, |
| 9 | } from './session'; |
| 10 | |
| 11 | const composio = createComposio(); |
| 12 | const session = await createApprovalSession(composio); |
| 13 | const terminal = readline.createInterface({ input: process.stdin, output: process.stdout }); |
| 14 | try { |
| 15 | const result = await runWithApprovals( |
| 16 | options => |
| 17 | process.argv.includes('--multi') |
| 18 | ? session.executeMeta('COMPOSIO_MULTI_EXECUTE_TOOL', multiArguments, options) |
| 19 | : session.execute(tool, toolArguments, options), |
| 20 | question => askForApproval(question, prompt => terminal.question(prompt)) |
| 21 | ); |
| 22 | console.log(JSON.stringify(result, null, 2)); |
| 23 | } finally { |
| 24 | terminal.close(); |
| 25 | await composio.sessions.delete(session.sessionId); |
| 26 | } |