π― ExecModule Functionality Specification
Date: October 25, 2025
Status: π PRODUCTION IMPLEMENTATION
Scope: Complete ExecModule configuration, visualization, and execution
πͺ Overviewβ
ValkyrAI's workflow engine uses ExecModules as pluggable execution units. Each module needs:
- β Configuration UI - Visual forms for all parameters
- β Visual Representation - Special nodes/containers on canvas
- β Execution Logic - Backend implementation (already exists)
- β State Management - Redux integration for real-time updates
π Control Flow Modulesβ
1. LooperModule (com.valkyrlabs.workflow.modules.control.LooperModule)β
Purpose: Advanced loop control with FOR, WHILE, FOR-EACH, DO-WHILE modes
Configuration Parameters:
interface LooperConfig {
loopType: "FOR" | "WHILE" | "FOR_EACH" | "DO_WHILE";
// FOR loop
iterations?: number; // Number of iterations (default: 10)
startIndex?: number; // Starting index (default: 0)
// WHILE/DO_WHILE loop
condition?: string; // Loop continuation condition
// FOR_EACH loop
collection?: string; // Path to collection (e.g., "workflow.state.items")
itemVariable?: string; // Variable name for current item (default: "item")
indexVariable?: string; // Variable name for current index (default: "index")
// Common
breakCondition?: string; // Exit loop early
continueCondition?: string; // Skip to next iteration
maxIterations?: number; // Safety limit (default: 1000)
nested_task?: string; // Task ID to execute per iteration
// Progress tracking
trackProgress?: boolean; // Enable real-time progress (default: true)
progressCallback?: string; // Webhook/endpoint for progress updates
}
Visual Representation:
- Container Node with loop icon (π)
- Progress Bar showing current iteration / total
- Circular Progress arc around node
- Iteration Counter badge
- Break/Continue condition indicators
- Child Tasks nested inside container with connecting lines
UI Components Needed:
LooperConfigPanel.tsx- Configuration formLooperNode.tsx- Canvas visual (already exists, needs enhancement)LooperContainer.tsx- Container for nested tasksLooperProgressIndicator.tsx- Real-time progress display
Backend Integration:
- β Already implemented in Java
- Needs: Progress webhooks, state persistence
2. MultiThreaderModule (com.valkyrlabs.workflow.modules.control.MultiThreaderModule)β
Purpose: Parallel execution with FAN-OUT, FAN-IN, RACE, and ALL strategies
Configuration Parameters:
interface MultiThreaderConfig {
mode: "FAN_OUT" | "FAN_IN" | "RACE" | "ALL";
maxThreads: number; // Thread pool size (default: 5)
timeout: number; // Per-task timeout in ms (default: 30000)
// Task selection
parallel_tasks: string[]; // Array of task IDs to execute
// Join strategy
joinStrategy: "WAIT_ALL" | "WAIT_ANY" | "WAIT_FIRST";
// Error handling
retryOnFailure: boolean; // Retry failed tasks (default: false)
maxRetries: number; // Max retry attempts (default: 3)
continueOnError: boolean; // Continue if some tasks fail (default: false)
// Output
outputField: string; // Field name for results (default: "parallel_results")
aggregateStrategy: "MERGE" | "ARRAY" | "FIRST" | "CUSTOM";
}
Visual Representation:
- Container Node with parallel icon (β‘ or |||)
- Thread Pool Indicator showing active threads
- Branch Endpoints for each parallel task
- Visual Container enclosing all parallel tasks
- Progress Indicators for each branch
- Join Point where branches reconverge
- Color-coded branches (different colors for each thread)
UI Components Needed:
MultiThreaderConfigPanel.tsx- Configuration formMultiThreaderNode.tsx- Canvas visual nodeMultiThreaderContainer.tsx- Container with branch visualizationThreadPoolIndicator.tsx- Active threads displayParallelBranchHandle.tsx- Special handles for branches
Backend Integration:
- β Already implemented in Java
- Needs: Real-time progress tracking, thread state monitoring
π§ Communication Modulesβ
3. EmailModule (com.valkyrlabs.workflow.modules.email.EmailModule)β
Configuration:
interface EmailConfig {
provider: "SMTP" | "SendGrid" | "Mailtrap" | "Mailersend";
to: string | string[];
from: string;
subject: string;
body: string;
bodyType: "text" | "html";
cc?: string | string[];
bcc?: string | string[];
attachments?: Array<{
filename: string;
path: string;
contentType?: string;
}>;
template?: string; // Template ID for provider
templateVars?: Record<string, any>;
}
UI: Standard form with rich text editor for body
4. WebhookReceiverModule (com.valkyrlabs.workflow.modules.WebhookReceiverModule)β
Configuration:
interface WebhookConfig {
endpoint: string; // Auto-generated or custom
method: "POST" | "GET" | "PUT" | "PATCH";
authentication: "NONE" | "API_KEY" | "JWT" | "HMAC";
secret?: string; // For HMAC validation
headers?: Record<string, string>;
responseTemplate?: string; // Response body template
responseStatus?: number; // HTTP status code (default: 200)
}
Visual: Display generated webhook URL with copy button
π Integration Modulesβ
5. RestApiModule (com.valkyrlabs.workflow.modules.rest.RestApiModule)β
Configuration:
interface RestApiConfig {
url: string;
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
headers?: Record<string, string>;
query?: Record<string, string>;
body?: any;
authentication: {
type: "NONE" | "BASIC" | "BEARER" | "API_KEY" | "OAUTH2";
credentials?: {
username?: string;
password?: string;
token?: string;
apiKey?: string;
headerName?: string;
};
};
timeout?: number;
retries?: number;
responseMapping?: Record<string, string>;
}
UI: Visual API builder with test functionality
6. StripeModule (com.valkyrlabs.workflow.modules.stripe.StripeModule)β
Configuration:
interface StripeConfig {
operation:
| "CREATE_PAYMENT_INTENT"
| "CREATE_CUSTOMER"
| "CREATE_SUBSCRIPTION"
| "REFUND";
apiKey: string; // Encrypted
amount?: number; // In cents
currency?: string; // Default: 'usd'
customerId?: string;
productId?: string;
priceId?: string;
metadata?: Record<string, string>;
}
7. AWS Modules (S3, Lambda, SQS, SNS)β
S3 Configuration:
interface S3Config {
operation: "UPLOAD" | "DOWNLOAD" | "LIST" | "DELETE";
bucket: string;
key: string;
region: string;
accessKeyId: string; // Encrypted
secretAccessKey: string; // Encrypted
contentType?: string;
acl?: "private" | "public-read" | "public-read-write";
}
8. Social Media Modulesβ
LinkedIn, Twitter, Facebook, Instagram:
interface SocialMediaConfig {
platform: "LINKEDIN" | "TWITTER" | "FACEBOOK" | "INSTAGRAM";
operation: "POST" | "SCHEDULE" | "DELETE" | "GET_METRICS";
accessToken: string; // Encrypted via OAuth
content: {
text?: string;
media?: string[]; // URLs or file paths
link?: string;
hashtags?: string[];
};
schedule?: string; // ISO date or cron
targetAudience?: string;
}
π Transform Modulesβ
9. HandlebarsExecModule (com.valkyrlabs.workflow.modules.transform.HandlebarsExecModule)β
Configuration:
interface HandlebarsConfig {
template: string; // Handlebars template
data: Record<string, any>; // Context data
helpers?: Record<string, string>; // Custom helpers (JS functions)
partials?: Record<string, string>;
outputField?: string;
}
UI: Code editor with syntax highlighting and preview
10. MapModule (com.valkyrlabs.workflow.modules.transform.MapModule)β
Configuration:
interface MapConfig {
mappings: Array<{
source: string; // JSONPath or field name
target: string; // Output field name
transform?: "UPPERCASE" | "LOWERCASE" | "TRIM" | "PARSE_JSON" | "TO_STRING";
default?: any;
}>;
dropUnmapped?: boolean; // Remove fields not in mappings
}
π€ AI Modulesβ
11. ImageGenModule (com.valkyrlabs.workflow.modules.ai.ImageGenModule)β
Configuration:
interface ImageGenConfig {
provider: "DALL_E" | "STABLE_DIFFUSION" | "MIDJOURNEY";
prompt: string;
negativePrompt?: string;
size: "256x256" | "512x512" | "1024x1024" | "1024x1792" | "1792x1024";
quality: "standard" | "hd";
style?: "natural" | "vivid";
n: number; // Number of images
apiKey: string; // Encrypted
outputPath?: string; // Where to save
}
12. OpenAIModule (com.valkyrlabs.workflow.modules.ai.OpenAIModule)β
Configuration:
interface OpenAIConfig {
model: "gpt-4" | "gpt-4-turbo" | "gpt-3.5-turbo";
messages: Array<{
role: "system" | "user" | "assistant";
content: string;
}>;
temperature?: number; // 0-2
maxTokens?: number;
topP?: number;
frequencyPenalty?: number;
presencePenalty?: number;
stop?: string[];
apiKey: string; // Encrypted
}
π¨ UI Component Architectureβ
Component Hierarchyβ
WorkflowCanvas
βββ StandardNode (task, branch, start, end)
βββ LooperNode
β βββ LooperHeader (with progress)
β βββ LooperConfigPanel (modal)
β βββ LooperContainer
β βββ NestedTasks[]
βββ MultiThreaderNode
β βββ MultiThreaderHeader
β βββ MultiThreaderConfigPanel (modal)
β βββ ThreadPoolIndicator
β βββ MultiThreaderContainer
β βββ ParallelBranch[1]
β β βββ BranchTasks[]
β βββ ParallelBranch[2]
β β βββ BranchTasks[]
β βββ JoinPoint
βββ ExecModuleNode (generic)
βββ ModuleIcon
βββ ModuleLabel
βββ ModuleConfigPanel (modal)
Shared Componentsβ
ExecModuleConfigModal.tsx- Base modal for all module configsConfigFormField.tsx- Reusable form fieldsConditionEditor.tsx- For break/continue conditionsJSONPathSelector.tsx- Visual JSONPath builderEncryptedField.tsx- For API keys, secretsCodeEditor.tsx- Monaco editor for templates/codeTestButton.tsx- Test module configuration
π State Managementβ
Redux Slicesβ
// workflowCanvasSlice.ts
interface CanvasState {
nodes: Node[];
edges: Edge[];
selectedNodeId: string | null;
looperStates: Record<string, LooperState>;
multiThreaderStates: Record<string, MultiThreaderState>;
}
interface LooperState {
nodeId: string;
currentIteration: number;
totalIterations: number;
isRunning: boolean;
progress: number; // 0-100
breakConditionMet: boolean;
}
interface MultiThreaderState {
nodeId: string;
activeThreads: number;
maxThreads: number;
completedTasks: number;
totalTasks: number;
branchStates: Record<string, BranchState>;
}
interface BranchState {
branchId: string;
status: "pending" | "running" | "completed" | "failed" | "timeout";
progress: number;
result?: any;
error?: string;
}
π― Implementation Priorityβ
Phase 1: Core Control Modules (Week 1)β
- LooperModule configuration UI
- LooperNode visual enhancement
- LooperContainer with nested tasks
- MultiThreaderModule configuration UI
- MultiThreaderNode visual
- MultiThreaderContainer with branches
- Redux state management
Phase 2: Visual Polish (Week 1-2)β
- Progress indicators
- Thread pool visualization
- Branch color coding
- Container styling
- Animations and transitions
Phase 3: Integration Modules (Week 2)β
- REST API module UI
- Email module UI
- Webhook module UI
- AWS modules UI
- Social media modules UI
Phase 4: AI & Transform (Week 3)β
- OpenAI module UI
- Image generation UI
- Handlebars editor
- Map/transform UI
Phase 5: Testing & Documentation (Week 3-4)β
- End-to-end tests
- Visual regression tests
- Performance optimization
- User documentation
- Video tutorials
π Success Criteriaβ
Functional Requirementsβ
- β All modules have configuration UIs
- β Looper shows real-time progress
- β MultiThreader displays active threads
- β Containers visually distinct
- β Nested tasks render correctly
- β State persists across page reload
Non-Functional Requirementsβ
- β Configuration forms are intuitive
- β Visual feedback is immediate
- β Performance: < 16ms render time
- β Accessibility: Keyboard navigable
- β Mobile: Touch-friendly on tablets
π Notesβ
- All encrypted fields use
@SecureFieldbackend annotation - API keys never logged or exposed in client
- Progress updates use WebSocket for real-time
- Container nodes support zoom/pan
- Nested tasks inherit parent auth context
Status: Ready for implementation
Owner: AI Coding Agent + Human Review
Timeline: 3-4 weeks for complete implementation
LET'S BUILD THE MOST FUNCTIONAL WORKFLOW ENGINE EVER! π