Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

feat(cli): add parallel execute support and help examples (#3033)

Rahul Tarakc9a43db6ca94
diff --git a/ts/packages/cli/src/commands/root-help.ts b/ts/packages/cli/src/commands/root-help.ts
index aaf57823b..8a703cca7 100644
--- a/ts/packages/cli/src/commands/root-help.ts
+++ b/ts/packages/cli/src/commands/root-help.ts
@@ -177,7 +177,7 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp> = {
],
},
execute: {
- usage: 'composio execute <slug> [-d, --data text] [--dry-run] [--get-schema]',
+ usage: 'composio execute <slug> [-d, --data text] [--dry-run] [--get-schema] [--parallel]',
description:
'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.',
args: [{ name: '<slug>', description: 'Tool slug (e.g. "GITHUB_CREATE_ISSUE")' }],
@@ -187,6 +187,10 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp> = {
description:
'JSON or JS-style object arguments, e.g. -d \'{ repo: "foo" }\', @file, or - for stdin',
},
+ {
+ name: '-p, --parallel',
+ description: 'Execute repeated TOOL_SLUG -d <text> groups concurrently',
+ },
{
name: '--get-schema',
description: 'Fetch and print the raw tool schema without executing',
@@ -219,6 +223,9 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp> = {
'',
'# Read arguments from a file',
'composio execute GITHUB_CREATE_ISSUE -d @issue.json',
+ '',
+ '# Execute multiple tools concurrently',
+ `composio execute --parallel GMAIL_SEND_EMAIL -d '{ recipient_email: "[email protected]" }' GITHUB_CREATE_AN_ISSUE -d '{ owner: "acme", repo: "app", title: "Bug" }'`,
],
seeAlso: [
'composio search "<query>" Find tool slugs by use case',
diff --git a/ts/packages/cli/src/commands/tools/commands/tools.execute.cmd.ts b/ts/packages/cli/src/commands/tools/commands/tools.execute.cmd.ts
index 440cdf84c..07308e522 100644
--- a/ts/packages/cli/src/commands/tools/commands/tools.execute.cmd.ts
+++ b/ts/packages/cli/src/commands/tools/commands/tools.execute.cmd.ts
@@ -649,36 +649,6 @@ type ParsedParallelExecuteArgs = SharedRunToolsExecuteParams & {
readonly specs: ReadonlyArray<ParallelExecuteSpec>;
};
-type ParallelExecuteResult =
- | {
- readonly slug: string;
- readonly successful: true;
- readonly dryRun: true;
- readonly arguments: Record<string, unknown>;
- readonly userId: string;
- readonly schemaPath?: string;
- readonly schemaVersion?: string | null;
- }
- | {
- readonly slug: string;
- readonly successful: true;
- readonly version: string | null;
- readonly schemaPath: string;
- readonly inputSchema: Record<string, unknown>;
- }
- | ({
- readonly slug: string;
- } & ToolExecuteResponse)
- | ({
- readonly slug: string;
- } & StoredExecuteOutputSummary)
- | {
- readonly slug: string;
- readonly successful: false;
- readonly error: string;
- readonly logId?: string;
- };
-
type ResolvedExecuteContext = {
readonly ui: TerminalUI;
readonly executor: ToolsExecutor;
@@ -1599,6 +1569,7 @@ export const runParallelToolsExecuteFromArgv = (argv: ReadonlyArray<string>) =>
catch: error => (error instanceof Error ? error : new Error(String(error))),
}).pipe(Effect.flatMap(runParallelToolsExecuteFromParsed));
};
+
export const rootToolsCmd$Execute = Command.make(
'execute',
{ slug, data, getSchema, dryRun, skipConnectionCheck, skipToolParamsCheck, skipChecks },
@@ -1624,10 +1595,12 @@ export const rootToolsCmd$Execute = Command.make(
'',
'Examples:',
' composio execute GMAIL_SEND_EMAIL -d \'{ recipient_email: "[email protected]", body: "Hello" }\'',
+ ' composio execute --parallel GMAIL_SEND_EMAIL -d \'{ recipient_email: "[email protected]" }\' GITHUB_CREATE_AN_ISSUE -d \'{ owner: "acme", repo: "app", title: "Bug" }\'',
" composio execute GMAIL_SEND_EMAIL --dry-run -d '{ ... }' Preview without executing",
' composio execute GMAIL_SEND_EMAIL --get-schema Fetch and print the input schema',
'',
'Flags:',
+ ' -p, --parallel Execute repeated TOOL_SLUG -d <json> groups concurrently',
' --skip-connection-check Skip the connected-account check',
' --skip-tool-params-check Skip input validation against cached schema',
' --skip-checks Skip both checks above',
@@ -1688,6 +1661,9 @@ export const devToolsCmd$Execute = Command.make(
' composio dev playground-execute GMAIL_SEND_EMAIL -d \'{ recipient_email: "[email protected]", body: "Hello" }\'',
' composio dev playground-execute GMAIL_SEND_EMAIL --dry-run -d \'{ recipient_email: "[email protected]", body: "Hello" }\'',
' composio dev playground-execute GMAIL_SEND_EMAIL --get-schema',
+ '',
+ 'Flags:',
+ ' -p, --parallel Execute repeated TOOL_SLUG -d <json> groups concurrently',
].join('\n')
)
);
diff --git a/ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts b/ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts
index f44cca140..c333c737e 100644
--- a/ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts
+++ b/ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts
@@ -819,9 +819,12 @@ describe('CLI: composio execute', () => {
const output = lines.join('\n');
expect(output).toContain('USAGE');
- expect(output).toContain('composio execute <slug> [-d, --data text] [--dry-run]');
+ expect(output).toContain(
+ 'composio execute <slug> [-d, --data text] [--dry-run] [--get-schema] [--parallel]'
+ );
expect(output).toContain('composio execute GMAIL_SEND_EMAIL --get-schema');
- expect(output).not.toContain('--parallel');
+ expect(output).toContain('--parallel');
+ expect(output).toContain('GITHUB_CREATE_AN_ISSUE');
})
);
});