@tpmjs/tools-workflow-variant-generate
Generate multiple variations of a workflow with configurable constraints. Useful for creating test scenarios, exploring optimization options, or generating alternative execution paths. Constraints control which modifications are allowed (reordering, removal, modification).
Workflow must have a name string
Last checked: 1/1/2026, 8:18:25 AM
Test @tpmjs/tools-workflow-variant-generate (workflowVariantGenerateTool) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/tools-workflow-variant-generatepnpm add @tpmjs/tools-workflow-variant-generateyarn add @tpmjs/tools-workflow-variant-generatebun add @tpmjs/tools-workflow-variant-generatedeno add npm:@tpmjs/tools-workflow-variant-generateimport { workflowVariantGenerateTool } from '@tpmjs/tools-workflow-variant-generate';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { workflowVariantGenerateTool } from '@tpmjs/tools-workflow-variant-generate';
const result = await generateText({
model: openai('gpt-4o'),
tools: { workflowVariantGenerateTool },
prompt: 'Your prompt here...',
});
console.log(result.text);Available configuration options
workflowobjectBase workflow to generate variants from
variationCountnumberNumber of variants to generate (1-50)
constraintsobjectOptional constraints for variant generation
Schema extracted: 1/1/2026, 8:18:25 AM
Generate multiple variations of a workflow with configurable constraints for testing, optimization, and exploration.
npm install @tpmjs/tools-workflow-variant-generate
import { workflowVariantGenerateTool } from '@tpmjs/tools-workflow-variant-generate'; const result = await workflowVariantGenerateTool.execute({ workflow: { name: 'CI/CD Pipeline', description: 'Continuous integration and deployment', steps: [ { action: 'checkout', details: 'Clone repository', duration: 1 }, { action: 'test', details: 'Run test suite', duration: 5 }, { action: 'build', details: 'Build production bundle', duration: 3 }, { action: 'deploy', details: 'Deploy to production', duration: 2 } ] }, variationCount: 3, constraints: { allowStepRemoval: true, allowStepModification: true, allowReordering: false, requiredSteps: ['checkout', 'deploy'] } }); console.log(result.variants); // [ // { // name: 'CI/CD Pipeline (Variant 1)', // steps: [...], // Modified version // metadata: { // variantNumber: 1, // hash: 'abc123...', // modifications: ['Modified test duration: 5m → 7m'] // } // }, // ... // ]
Control how variants are generated:
maxSteps (number) - Maximum steps per variant (default: 20)minSteps (number) - Minimum steps per variant (default: 1)allowStepRemoval (boolean) - Allow removing steps (default: true)allowStepModification (boolean) - Allow modifying step properties (default: true)allowReordering (boolean) - Allow reordering steps (default: true)preserveOrder (boolean) - Force original order (default: false)requiredSteps (string[]) - Step actions that must be includedforbiddenSteps (string[]) - Step actions that must not be includedconst result = await workflowVariantGenerateTool.execute({ workflow: { name: 'Deployment', steps: [ { action: 'build' }, { action: 'test' }, { action: 'deploy' } ] }, variationCount: 5 });
const result = await workflowVariantGenerateTool.execute({ workflow: { name: 'Data Pipeline', steps: [ { action: 'extract', duration: 10 }, { action: 'transform', duration: 20 }, { action: 'load', duration: 5 } ] }, variationCount: 3, constraints: { preserveOrder: true, allowStepModification: true, allowStepRemoval: false } }); // Variants will have same order but different durations/details
const result = await workflowVariantGenerateTool.execute({ workflow: { name: 'Security Scan', steps: [ { action: 'scan-dependencies' }, { action: 'scan-code' }, { action: 'scan-secrets' }, { action: 'generate-report' }, { action: 'upload-results' } ] }, variationCount: 4, constraints: { requiredSteps: ['generate-report'], // Must include forbiddenSteps: ['upload-results'], // Must exclude allowStepRemoval: true } });
const result = await workflowVariantGenerateTool.execute({ workflow: { name: 'Full Test Suite', steps: [ { action: 'unit-tests', duration: 5 }, { action: 'integration-tests', duration: 10 }, { action: 'e2e-tests', duration: 20 }, { action: 'performance-tests', duration: 15 }, { action: 'security-tests', duration: 8 } ] }, variationCount: 3, constraints: { maxSteps: 3, // Optimize by reducing steps requiredSteps: ['unit-tests'] } });
const result = await workflowVariantGenerateTool.execute({ workflow: { name: 'User Onboarding', steps: [ { action: 'create-account' }, { action: 'verify-email' }, { action: 'complete-profile' }, { action: 'setup-preferences' }, { action: 'tutorial' } ] }, variationCount: 5, constraints: { requiredSteps: ['create-account', 'verify-email'], allowStepRemoval: true, allowReordering: true } }); // Creates different user flow variants for testing
{ variants: [ { name: 'Workflow Name (Variant 1)', description: 'Workflow description - Variant 1', steps: [ { action: 'step1', details: '...', duration: 5 } ], metadata: { variantNumber: 1, derivedFrom: 'Workflow Name', generatedAt: '2025-01-01T00:00:00.000Z', hash: 'abc123...', // Variant hash modifications: [ 'Modified step1 duration: 5m → 7m', 'Removed step: step2' ] } } ], originalHash: 'xyz789...', // Original workflow hash variantHashes: ['abc123...', 'def456...'] // All variant hashes }
The tool can apply these modifications:
Each variant tracks its modifications in the metadata.
Hashes can be used for:
MIT
Downloads/month
0
Quality Score