@devries-cameron20 / composio Mirror · read-only / commits / 5c5599508
Fork 0

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 22, 02:00 UTC

Add parallel tool execution to CLI (#3012)

## Summary - Added `--parallel` support to `composio execute`, `composio manage tools execute`, and `composio dev execute` for running multiple `TOOL_SLUG -d <data>` groups concurrently. - Implemented parsing, validation, execution, and aggregated JSON output for parallel tool runs, including dry-run and schema-fetch flows. - Updated CLI help text and usage examples to document the new parallel execution mode. - Added test coverage for parallel execution output and help text updates. ## Testing - Added/updated CLI tests in `ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts` covering repeated slug/data groups and help output. - Not run locally in this turn.

Rahul Tarak committed Mar 24, 2026 at 20:34 UTC 5c55995082d667eab821dadccb415a33a4db63e6
4 files changed +532 -3
ts/packages/cli/src/commands/index.ts
+12 -1
@@ -16,7 +16,10 @@ import { installCmd } from './install.cmd';
16 import { generateCmd } from './generate/generate.cmd';
17 import { manageCmd } from './manage/manage.cmd';
18 import { devCmd } from './dev.cmd';
19 -import { showToolsExecuteInputHelp } from './tools/commands/tools.execute.cmd';
19 +import {
20 + runParallelToolsExecuteFromArgv,
21 + showToolsExecuteInputHelp,
22 +} from './tools/commands/tools.execute.cmd';
23 import { printRootHelp, matchSubcommandHelp, printSubcommandHelp } from './root-help';
24 import { rootToolsCmd$Search } from './tools/commands/tools.search.cmd';
25 import { rootToolsCmd$Execute } from './tools/commands/tools.execute.cmd';
@@ -83,6 +86,8 @@ const parseExecuteInputHelpSlug = (argv: ReadonlyArray<string>): string | undefi
86 if (
87 token === '--data' ||
88 token === '-d' ||
89 + token === '--parallel' ||
90 + token === '-p' ||
91 token === '--user-id' ||
92 token === '--project-name'
93 ) {
@@ -92,6 +97,8 @@ const parseExecuteInputHelpSlug = (argv: ReadonlyArray<string>): string | undefi
97 if (
98 token.startsWith('--data=') ||
99 token.startsWith('-d=') ||
100 + token === '--parallel' ||
101 + token === '-p' ||
102 token.startsWith('--user-id=') ||
103 token.startsWith('--project-name=')
104 ) {
@@ -198,6 +205,10 @@ export const runWithConfig = Effect.gen(function* () {
205 if (subHelp) {
206 return printSubcommandHelp(subHelp);
207 }
208 + const parallelExecute = runParallelToolsExecuteFromArgv(normalizedArgv);
209 + if (parallelExecute) {
210 + return parallelExecute;
211 + }
212 if (isGenerateGraph(normalizedArgv)) {
213 return Effect.sync(() => {
214 process.stdout.write(`${JSON.stringify(renderCommandHintGraph(), null, 2)}\n`);
ts/packages/cli/src/commands/root-help.ts
+8 -1
@@ -176,7 +176,7 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp> = {
176 ],
177 },
178 execute: {
179 - usage: 'composio execute <slug> [-d, --data text] [--dry-run] [--get-schema]',
179 + usage: 'composio execute <slug> [-d, --data text] [--dry-run] [--get-schema] [--parallel]',
180 description:
181 'Execute a tool by slug. Validates inputs against cached schemas and checks connections automatically — just try it and it will tell you what to fix.',
182 args: [{ name: '<slug>', description: 'Tool slug (e.g. "GITHUB_CREATE_ISSUE")' }],
@@ -186,6 +186,10 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp> = {
186 description:
187 'JSON or JS-style object arguments, e.g. -d \'{ repo: "foo" }\', @file, or - for stdin',
188 },
189 + {
190 + name: '-p, --parallel',
191 + description: 'Execute repeated TOOL_SLUG -d <text> groups concurrently',
192 + },
193 {
194 name: '--get-schema',
195 description: 'Fetch and print the raw tool schema without executing',
@@ -218,6 +222,9 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp> = {
222 '',
223 '# Read arguments from a file',
224 'composio execute GITHUB_CREATE_ISSUE -d @issue.json',
225 + '',
226 + '# Execute multiple tools concurrently',
227 + `composio execute --parallel GMAIL_SEND_EMAIL -d '{ recipient_email: "a@b.com" }' GITHUB_CREATE_AN_ISSUE -d '{ owner: "acme", repo: "app", title: "Bug" }'`,
228 ],
229 seeAlso: [
230 'composio search "<query>" Find tool slugs by use case',
ts/packages/cli/src/commands/tools/commands/tools.execute.cmd.ts
+456
@@ -602,6 +602,47 @@ type RunToolsExecuteParams = {
602 noVerify: boolean;
603 };
604
605 +type SharedRunToolsExecuteParams = Omit<RunToolsExecuteParams, 'slug' | 'data'>;
606 +
607 +type ParallelExecuteSpec = {
608 + readonly slug: string;
609 + readonly data: Option.Option<string>;
610 +};
611 +
612 +type ParsedParallelExecuteArgs = SharedRunToolsExecuteParams & {
613 + readonly specs: ReadonlyArray<ParallelExecuteSpec>;
614 +};
615 +
616 +type ParallelExecuteResult =
617 + | {
618 + readonly slug: string;
619 + readonly successful: true;
620 + readonly dryRun: true;
621 + readonly arguments: Record<string, unknown>;
622 + readonly userId: string;
623 + readonly schemaPath?: string;
624 + readonly schemaVersion?: string | null;
625 + }
626 + | {
627 + readonly slug: string;
628 + readonly successful: true;
629 + readonly version: string | null;
630 + readonly schemaPath: string;
631 + readonly inputSchema: Record<string, unknown>;
632 + }
633 + | ({
634 + readonly slug: string;
635 + } & ToolExecuteResponse)
636 + | ({
637 + readonly slug: string;
638 + } & StoredExecuteOutputSummary)
639 + | {
640 + readonly slug: string;
641 + readonly successful: false;
642 + readonly error: string;
643 + readonly logId?: string;
644 + };
645 +
646 type ResolvedExecuteContext = {
647 readonly ui: TerminalUI;
648 readonly executor: ToolsExecutor;
@@ -1122,6 +1163,416 @@ const runToolsExecute = (params: RunToolsExecuteParams) =>
1163 });
1164 });
1165
1166 +const parseParallelExecuteArgs = (
1167 + args: ReadonlyArray<string>,
1168 + config: {
1169 + readonly surface: 'root' | 'manage' | 'dev';
1170 + readonly projectMode: 'consumer' | 'developer';
1171 + readonly allowUserId: boolean;
1172 + readonly allowProjectName: boolean;
1173 + }
1174 +): ParsedParallelExecuteArgs => {
1175 + let getSchema = false;
1176 + let dryRun = false;
1177 + let skipConnectionCheck = false;
1178 + let skipToolParamsCheck = false;
1179 + let noVerify = false;
1180 + let userId = Option.none<string>();
1181 + let projectName = Option.none<string>();
1182 + const specs: ParallelExecuteSpec[] = [];
1183 + let currentSpec: ParallelExecuteSpec | null = null;
1184 +
1185 + const pushCurrentSpec = () => {
1186 + if (!currentSpec) return;
1187 + specs.push(currentSpec);
1188 + currentSpec = null;
1189 + };
1190 +
1191 + const readValue = (token: string, index: number) => {
1192 + if (token.includes('=')) {
1193 + return {
1194 + value: token.slice(token.indexOf('=') + 1),
1195 + nextIndex: index,
1196 + };
1197 + }
1198 +
1199 + const next = args[index + 1];
1200 + if (!next) {
1201 + throw new Error(`Missing value for ${token}.`);
1202 + }
1203 + return { value: next, nextIndex: index + 1 };
1204 + };
1205 +
1206 + for (let i = 0; i < args.length; i += 1) {
1207 + const token = args[i];
1208 + if (!token) continue;
1209 +
1210 + if (token === '--parallel' || token === '-p') {
1211 + continue;
1212 + }
1213 + if (token === '--get-schema') {
1214 + getSchema = true;
1215 + continue;
1216 + }
1217 + if (token === '--dry-run') {
1218 + dryRun = true;
1219 + continue;
1220 + }
1221 + if (token === '--skip-connection-check') {
1222 + skipConnectionCheck = true;
1223 + continue;
1224 + }
1225 + if (token === '--skip-tool-params-check') {
1226 + skipToolParamsCheck = true;
1227 + continue;
1228 + }
1229 + if (token === '--no-verify') {
1230 + noVerify = true;
1231 + continue;
1232 + }
1233 + if (token === '--user-id' || token.startsWith('--user-id=')) {
1234 + if (!config.allowUserId) {
1235 + throw new Error(`${token} is not supported for this execute command.`);
1236 + }
1237 + const parsed = readValue(token, i);
1238 + userId = Option.some(parsed.value);
1239 + i = parsed.nextIndex;
1240 + continue;
1241 + }
1242 + if (token === '--project-name' || token.startsWith('--project-name=')) {
1243 + if (!config.allowProjectName) {
1244 + throw new Error(`${token} is not supported for this execute command.`);
1245 + }
1246 + const parsed = readValue(token, i);
1247 + projectName = Option.some(parsed.value);
1248 + i = parsed.nextIndex;
1249 + continue;
1250 + }
1251 + if (
1252 + token === '--data' ||
1253 + token === '-d' ||
1254 + token.startsWith('--data=') ||
1255 + token.startsWith('-d=')
1256 + ) {
1257 + if (!currentSpec) {
1258 + throw new Error(
1259 + `Expected a tool slug before ${token}. Use: composio execute --parallel TOOL_SLUG -d '{}' TOOL_SLUG_2 -d '{}'.`
1260 + );
1261 + }
1262 + const parsed = readValue(token, i);
1263 + currentSpec = {
1264 + slug: currentSpec.slug,
1265 + data: Option.some(parsed.value),
1266 + };
1267 + i = parsed.nextIndex;
1268 + continue;
1269 + }
1270 + if (token.startsWith('-')) {
1271 + throw new Error(`Unknown option for parallel execute: ${token}`);
1272 + }
1273 +
1274 + pushCurrentSpec();
1275 + currentSpec = {
1276 + slug: token,
1277 + data: Option.none(),
1278 + };
1279 + }
1280 +
1281 + pushCurrentSpec();
1282 +
1283 + if (specs.length === 0) {
1284 + throw new Error(
1285 + "No tool slugs were provided. Use: composio execute --parallel TOOL_SLUG -d '{}' TOOL_SLUG_2 -d '{}'."
1286 + );
1287 + }
1288 +
1289 + return {
1290 + specs,
1291 + userId,
1292 + projectName,
1293 + surface: config.surface,
1294 + projectMode: config.projectMode,
1295 + getSchema,
1296 + dryRun,
1297 + skipConnectionCheck,
1298 + skipToolParamsCheck,
1299 + noVerify,
1300 + };
1301 +};
1302 +
1303 +const isParallelExecuteCommand = (argv: ReadonlyArray<string>) => {
1304 + const args = argv.slice(2);
1305 + if (args[0] === 'execute') {
1306 + return {
1307 + matched: args.includes('--parallel') || args.includes('-p'),
1308 + tail: args.slice(1),
1309 + surface: 'root' as const,
1310 + projectMode: 'consumer' as const,
1311 + allowUserId: false,
1312 + allowProjectName: false,
1313 + };
1314 + }
1315 + if (args[0] === 'manage' && args[1] === 'tools' && args[2] === 'execute') {
1316 + return {
1317 + matched: args.includes('--parallel') || args.includes('-p'),
1318 + tail: args.slice(3),
1319 + surface: 'manage' as const,
1320 + projectMode: 'consumer' as const,
1321 + allowUserId: true,
1322 + allowProjectName: true,
1323 + };
1324 + }
1325 + if (args[0] === 'dev' && args[1] === 'execute') {
1326 + return {
1327 + matched: args.includes('--parallel') || args.includes('-p'),
1328 + tail: args.slice(2),
1329 + surface: 'dev' as const,
1330 + projectMode: 'developer' as const,
1331 + allowUserId: true,
1332 + allowProjectName: true,
1333 + };
1334 + }
1335 + return null;
1336 +};
1337 +
1338 +const checkConnectedToolkitOrFail = (params: {
1339 + readonly slug: string;
1340 + readonly resolvedProject: ResolvedExecuteContext['resolvedProject'];
1341 + readonly resolvedUserId: string;
1342 + readonly skipConnectionCheck: boolean;
1343 + readonly noVerify: boolean;
1344 +}) =>
1345 + Effect.gen(function* () {
1346 + if (params.skipConnectionCheck || params.noVerify) return;
1347 + if (params.resolvedProject.projectType !== 'CONSUMER') return;
1348 +
1349 + yield* refreshConsumerConnectedToolkitsCache({
1350 + orgId: params.resolvedProject.orgId,
1351 + consumerUserId: params.resolvedUserId,
1352 + }).pipe(
1353 + Effect.catchAll(() => Effect.void),
1354 + Effect.forkDaemon,
1355 + Effect.asVoid
1356 + );
1357 +
1358 + const toolkit = toolkitFromToolSlug(params.slug);
1359 + if (!toolkit) return;
1360 +
1361 + const cachedToolkits = yield* getFreshConsumerConnectedToolkitsFromCache({
1362 + orgId: params.resolvedProject.orgId,
1363 + consumerUserId: params.resolvedUserId,
1364 + });
1365 +
1366 + if (Option.isSome(cachedToolkits) && !cachedToolkits.value.includes(toolkit)) {
1367 + throw new ToolExecutionError(
1368 + `Toolkit "${toolkit}" is not connected for this user (cached within the last 5 minutes). If you just connected the account, use --skip-connection-check.`
1369 + );
1370 + }
1371 + });
1372 +
1373 +const runParallelToolsExecuteFromParsed = (params: ParsedParallelExecuteArgs) =>
1374 + Effect.gen(function* () {
1375 + if (!(yield* requireAuth)) return;
1376 +
1377 + const contexts = yield* Effect.forEach(
1378 + params.specs,
1379 + spec =>
1380 + resolveExecuteContext({
1381 + slug: spec.slug,
1382 + data: spec.data,
1383 + userId: params.userId,
1384 + projectName: params.projectName,
1385 + surface: params.surface,
1386 + projectMode: params.projectMode,
1387 + getSchema: params.getSchema,
1388 + dryRun: params.dryRun,
1389 + skipConnectionCheck: params.skipConnectionCheck,
1390 + skipToolParamsCheck: params.skipToolParamsCheck,
1391 + noVerify: params.noVerify,
1392 + }),
1393 + { concurrency: 'unbounded' }
1394 + );
1395 + const entries = contexts.map((context, index) => ({
1396 + context,
1397 + spec: params.specs[index]!,
1398 + }));
1399 +
1400 + const ui = contexts[0]?.ui;
1401 + const results = yield* Effect.forEach(
1402 + entries,
1403 + ({ context, spec }) =>
1404 + Effect.gen(function* () {
1405 + const toolSlug = spec.slug;
1406 +
1407 + try {
1408 + if (params.getSchema) {
1409 + const definition = yield* getOrFetchToolInputDefinition(toolSlug, {
1410 + orgId: context.resolvedProject.orgId,
1411 + projectId: context.resolvedProject.projectId,
1412 + });
1413 + return {
1414 + slug: toolSlug,
1415 + successful: true,
1416 + version: definition.version,
1417 + schemaPath: definition.schemaPath,
1418 + inputSchema: definition.schema,
1419 + };
1420 + }
1421 +
1422 + yield* checkConnectedToolkitOrFail({
1423 + slug: toolSlug,
1424 + resolvedProject: context.resolvedProject,
1425 + resolvedUserId: context.resolvedUserId,
1426 + skipConnectionCheck: params.skipConnectionCheck,
1427 + noVerify: params.noVerify,
1428 + });
1429 +
1430 + if (params.dryRun) {
1431 + const verificationDisabled = params.noVerify || params.skipToolParamsCheck;
1432 + const definition = verificationDisabled
1433 + ? null
1434 + : yield* getOrFetchToolInputDefinition(toolSlug, {
1435 + orgId: context.resolvedProject.orgId,
1436 + projectId: context.resolvedProject.projectId,
1437 + });
1438 + if (definition) {
1439 + yield* validateToolInputArgumentsWithDefinition(toolSlug, context.args, definition);
1440 + }
1441 + return {
1442 + successful: true,
1443 + dryRun: true,
1444 + slug: toolSlug,
1445 + arguments: context.args,
1446 + userId: context.resolvedUserId,
1447 + schemaPath: definition?.schemaPath,
1448 + schemaVersion: definition?.version,
1449 + } satisfies DryRunSummary;
1450 + }
1451 +
1452 + if (!params.noVerify && !params.skipToolParamsCheck) {
1453 + const definition = yield* getOrFetchToolInputDefinition(toolSlug, {
1454 + orgId: context.resolvedProject.orgId,
1455 + projectId: context.resolvedProject.projectId,
1456 + });
1457 + yield* validateToolInputArgumentsWithDefinition(toolSlug, context.args, definition);
1458 + }
1459 +
1460 + const result = yield* context.executor.execute(toolSlug, context.executeParams);
1461 + if (!result.successful) {
1462 + return {
1463 + slug: toolSlug,
1464 + successful: false,
1465 + error: result.error ?? 'Execution failed.',
1466 + logId: result.logId,
1467 + };
1468 + }
1469 +
1470 + const output = yield* prepareExecuteOutput(toolSlug, result, context.executeOutputDir);
1471 + if (output.kind === 'file') {
1472 + return {
1473 + slug: toolSlug,
1474 + ...output.summary,
1475 + };
1476 + }
1477 +
1478 + return {
1479 + slug: toolSlug,
1480 + ...result,
1481 + };
1482 + } catch (error) {
1483 + const mapped = mapComposioError({ error, toolSlug });
1484 + return {
1485 + slug: toolSlug,
1486 + successful: false,
1487 + error: mapped.message,
1488 + };
1489 + }
1490 + }),
1491 + { concurrency: 'unbounded' }
1492 + );
1493 +
1494 + if (ui) {
1495 + for (const result of results) {
1496 + if (!result.successful) {
1497 + const logId =
1498 + 'logId' in result && typeof result.logId === 'string' && result.logId.length > 0
1499 + ? ` (logId: ${redact({ value: result.logId, prefix: 'log_' })})`
1500 + : '';
1501 + yield* ui.log.error(`[${result.slug}] ${result.error}${logId}`);
1502 + continue;
1503 + }
1504 +
1505 + if ('dryRun' in result && result.dryRun) {
1506 + yield* ui.log.step(`[${result.slug}] Dry run successful`);
1507 + continue;
1508 + }
1509 +
1510 + if ('inputSchema' in result) {
1511 + yield* ui.log.step(`[${result.slug}] Schema fetched: ${result.schemaPath}`);
1512 + continue;
1513 + }
1514 +
1515 + if ('storedInFile' in result && result.storedInFile) {
1516 + yield* ui.log.step(
1517 + `[${result.slug}] Response stored in ${result.outputFilePath} (${result.tokenCount} tokens)`
1518 + );
1519 + continue;
1520 + }
1521 +
1522 + const logId =
1523 + 'logId' in result && typeof result.logId === 'string' && result.logId.length > 0
1524 + ? ` (logId: ${redact({ value: result.logId, prefix: 'log_' })})`
1525 + : '';
1526 + yield* ui.log.step(`[${result.slug}] Execution successful${logId}`);
1527 + if ('data' in result) {
1528 + yield* ui.note(serializeExecuteOutput(result), `Response: ${result.slug}`);
1529 + }
1530 + }
1531 + }
1532 +
1533 + const successful = results.every(result => result.successful);
1534 + if (ui) {
1535 + yield* ui.log.message(
1536 + `Parallel execute completed: ${results.filter(result => result.successful).length}/${results.length} successful`
1537 + );
1538 + yield* ui.output(
1539 + JSON.stringify(
1540 + {
1541 + successful,
1542 + parallel: true,
1543 + results,
1544 + },
1545 + ciRedactReplacer,
1546 + 2
1547 + )
1548 + );
1549 + }
1550 +
1551 + if (!successful) {
1552 + return yield* Effect.fail(
1553 + new ToolExecutionError('One or more parallel tool executions failed.')
1554 + );
1555 + }
1556 + });
1557 +
1558 +export const runParallelToolsExecuteFromArgv = (argv: ReadonlyArray<string>) => {
1559 + const command = isParallelExecuteCommand(argv);
1560 + if (!command?.matched) {
1561 + return null;
1562 + }
1563 +
1564 + return Effect.try({
1565 + try: () =>
1566 + parseParallelExecuteArgs(command.tail, {
1567 + surface: command.surface,
1568 + projectMode: command.projectMode,
1569 + allowUserId: command.allowUserId,
1570 + allowProjectName: command.allowProjectName,
1571 + }),
1572 + catch: error => (error instanceof Error ? error : new Error(String(error))),
1573 + }).pipe(Effect.flatMap(runParallelToolsExecuteFromParsed));
1574 +};
1575 +
1576 export const toolsCmd$Execute = Command.make(
1577 'execute',
1578 {
@@ -1167,10 +1618,12 @@ export const toolsCmd$Execute = Command.make(
1618 '',
1619 'Examples:',
1620 ' composio execute GMAIL_SEND_EMAIL -d \'{ recipient_email: "a@b.com", body: "Hello" }\'',
1621 + ' composio execute --parallel GMAIL_SEND_EMAIL -d \'{ recipient_email: "a@b.com", subject: "Hello", body: "World" }\' GITHUB_CREATE_ISSUE -d \'{ owner: "acme", repo: "app", title: "Bug report", body: "Steps to reproduce..." }\'',
1622 " composio execute GMAIL_SEND_EMAIL --dry-run -d '{ ... }' Preview without executing",
1623 ' composio execute GMAIL_SEND_EMAIL --get-schema Fetch and print the input schema',
1624 '',
1625 'Flags:',
1626 + ' -p, --parallel Execute repeated TOOL_SLUG -d <json> groups concurrently',
1627 ' --skip-connection-check Skip the linked-account check',
1628 ' --skip-tool-params-check Skip input validation against cached schema',
1629 ' --no-verify Skip both checks above',
@@ -1208,10 +1661,12 @@ export const rootToolsCmd$Execute = Command.make(
1661 '',
1662 'Examples:',
1663 ' composio execute GMAIL_SEND_EMAIL -d \'{ recipient_email: "a@b.com", body: "Hello" }\'',
1664 + ' composio execute --parallel GMAIL_SEND_EMAIL -d \'{ recipient_email: "a@b.com", subject: "Hello", body: "World" }\' GITHUB_CREATE_ISSUE -d \'{ owner: "acme", repo: "app", title: "Bug report", body: "Steps to reproduce..." }\'',
1665 " composio execute GMAIL_SEND_EMAIL --dry-run -d '{ ... }' Preview without executing",
1666 ' composio execute GMAIL_SEND_EMAIL --get-schema Fetch and print the input schema',
1667 '',
1668 'Flags:',
1669 + ' -p, --parallel Execute repeated TOOL_SLUG -d <json> groups concurrently',
1670 ' --skip-connection-check Skip the linked-account check',
1671 ' --skip-tool-params-check Skip input validation against cached schema',
1672 ' --no-verify Skip both checks above',
@@ -1270,6 +1725,7 @@ export const devToolsCmd$Execute = Command.make(
1725 '',
1726 'Examples:',
1727 ' composio dev execute GMAIL_SEND_EMAIL -d \'{ recipient_email: "a@b.com", body: "Hello" }\'',
1728 + ' composio dev execute --parallel GMAIL_SEND_EMAIL -d \'{ recipient_email: "a@b.com", subject: "Hello", body: "World" }\' GITHUB_CREATE_ISSUE -d \'{ owner: "acme", repo: "app", title: "Bug report", body: "Steps to reproduce..." }\'',
1729 ' composio dev execute GMAIL_SEND_EMAIL --dry-run -d \'{ recipient_email: "a@b.com", body: "Hello" }\'',
1730 ' composio dev execute GMAIL_SEND_EMAIL --get-schema',
1731 ].join('\n')
ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts
+56 -1
@@ -472,6 +472,60 @@ describe('CLI: composio execute', () => {
472 );
473 });
474
475 + layer(
476 + TestLive({
477 + baseConfigProvider: testConfigProvider,
478 + fixture: 'global-test-user-id',
479 + stdin: { isTTY: true, data: '' },
480 + })
481 + )('[Given] composio execute --parallel [Then] it executes repeated slug/data groups', it => {
482 + it.scoped('aggregates results from multiple tool calls', () =>
483 + Effect.gen(function* () {
484 + yield* cli([
485 + 'execute',
486 + '--parallel',
487 + '--no-verify',
488 + 'GMAIL_SEND_EMAIL',
489 + '-d',
490 + '{"recipient":"a"}',
491 + 'GITHUB_CREATE_ISSUE',
492 + '-d',
493 + '{"title":"Bug"}',
494 + ]);
495 + const lines = yield* MockConsole.getLines({ stripAnsi: true });
496 + const output = parseLastJson(lines) as unknown as {
497 + successful: boolean;
498 + parallel: boolean;
499 + results: Array<{
500 + slug: string;
501 + successful: boolean;
502 + data?: Record<string, unknown>;
503 + }>;
504 + };
505 +
506 + expect(output.successful).toBe(true);
507 + expect(output.parallel).toBe(true);
508 + expect(output.results).toHaveLength(2);
509 + expect(output.results[0]).toMatchObject({
510 + slug: 'GMAIL_SEND_EMAIL',
511 + successful: true,
512 + data: {
513 + tool_slug: 'GMAIL_SEND_EMAIL',
514 + arguments: { recipient: 'a' },
515 + },
516 + });
517 + expect(output.results[1]).toMatchObject({
518 + slug: 'GITHUB_CREATE_ISSUE',
519 + successful: true,
520 + data: {
521 + tool_slug: 'GITHUB_CREATE_ISSUE',
522 + arguments: { title: 'Bug' },
523 + },
524 + });
525 + })
526 + );
527 + });
528 +
529 layer(
530 TestLive({
531 baseConfigProvider: testConfigProvider,
@@ -766,9 +820,10 @@ describe('CLI: composio execute', () => {
820
821 expect(output).toContain('USAGE');
822 expect(output).toContain(
769 - 'composio execute <slug> [-d, --data text] [--dry-run] [--get-schema]'
823 + 'composio execute <slug> [-d, --data text] [--dry-run] [--get-schema] [--parallel]'
824 );
825 expect(output).toContain('composio execute GMAIL_SEND_EMAIL --get-schema');
826 + expect(output).toContain('--parallel');
827 })
828 );
829 });