Overview
Workflow generation transforms human intent into executable workflow definitions through intelligent parsing and template matching. The system manages the entire workflow lifecycle: from initial generation through validation to optimization and execution.Key Capabilities
- Natural Language Processing: Convert business descriptions to structured workflows
- Template Library Integration: Leverage pre-built patterns for common operations
- Dependency Resolution: Automatically manage task ordering and dependencies
- Parallel Execution Planning: Identify and optimize concurrent execution opportunities
- Temporal Cloud Integration: Deploy optimized workflows for production execution
- Draft-Based Approval: All generated workflows require review before execution
Quick Reference
Generate from Natural Language
Validate Workflow Definition
Identify Optimization Opportunities
Detailed Reference
generate_workflow
Type: Tool (langchain_core.tools) Input Schema:GenerateWorkflowInput
Returns: Dict[str, Any]
Description
Generates a workflow from natural language description using GPT-4-powered parsing. The system analyzes the request, selects appropriate template steps, configures dependencies, and identifies parallelization opportunities. All generated workflows are created as drafts requiring explicit approval before execution. The tool handles parameterized templates through variable substitution, enabling reusable workflow patterns across different contexts. Retry policies and timeout configurations are automatically applied based on step type.Parameters
-
request(str, required): Natural language description of the desired workflow. Should specify:- Primary operations (ingest, validate, calculate, report)
- Scheduling requirements (daily, weekly, on-demand)
- Data sources and destinations
- Approval or notification steps
- Tolerance thresholds or business rules
-
context(Dict[str, Any], optional): Additional execution context:portfolio_ids: List of portfolio identifiers to processbusiness_date: Reference date for calculationsdata_sources: Available data ingestion endpointsapproval_groups: Teams requiring sign-offnotification_channels: Where to send results
Returns
Success response:Examples
Daily Data Ingestion Workflow Natural language request:- Scheduled: 0 9 * * * (daily at 9am)
- Steps: ingest → validate → calculate → notify
- Retry: 3 attempts with exponential backoff on ingest failures
- Parallel: None in this case (sequential dependencies)
- Schedule: 0 17 * * 5 (Friday at 5pm)
- Steps: fetch_admin_data (parallelized), reconcile, generate_report, approval_gate, post_adjustments
- Timeout: 1800 seconds (30 minutes)
- Approval: Manual review required
- Trigger: portfolio_change event
- Conditional steps based on change magnitude
- Parallelization: Validation and impact estimation run concurrently
Throws
ValueError: Invalid or incomplete natural language requestTemplateNotFound: No matching template for requested operationContextError: Missing required context variables
See Also
validate_workflow_tool: Verify generated workflow before approvaloptimize_workflow: Identify efficiency improvements- Workflow Patterns: Common workflow templates
validate_workflow_tool
Type: Tool (langchain_core.tools) Input Schema:ValidateWorkflowInput
Returns: Dict[str, Any]
Description
Validates a workflow definition for structural integrity and logical consistency. Checks include circular dependency detection, step reference validation, required field verification, and configuration error detection. This tool is automatically invoked during generation but can be called independently to verify manually-created or modified workflows.Parameters
workflow_json(str, required): Complete workflow definition as JSON string. Must include:name: Workflow identifiersteps: Array of workflow steps with dependenciesschedule: Cron expression (for scheduled workflows) or null (for on-demand)
Returns
Validation Rules
- Circular Dependencies: No step can transitively depend on itself
- Step References: All
depends_onreferences must exist - Required Fields: Every step must have name, type, and action
- Timeout Values: Must be positive integers (seconds)
- Schedule Format: Valid cron expression or null
- Retry Policy: max_retries >= 1, valid backoff strategy
optimize_workflow
Type: Tool (langchain_core.tools) Input Schema:OptimizeWorkflowInput
Returns: Dict[str, Any]
Description
Analyzes workflow structure and identifies optimization opportunities for improved performance and resource efficiency. Provides specific recommendations with quantified time savings estimates.Parameters
workflow_json(str, required): Workflow definition as JSON string
Returns
Optimization Types
- Parallelization: Independent steps executing sequentially can run concurrently
- Caching: Repeated data fetches can be cached to avoid redundant operations
- Batching: Multiple similar operations can be combined into single batch operations
- Resource Allocation: Step-specific resource requirements can be optimized
- Retry Policy: Aggressive retry policies on flaky steps can be tuned
Workflow Patterns
Data Ingestion Pattern
Reconciliation Pattern with Approval
Temporal Cloud Integration
Generated workflows deploy to Temporal Cloud for production execution:- Durability: Workflow state persists across server restarts
- Scalability: Horizontal scaling for high-throughput operations
- Monitoring: Built-in observability with execution history
- Retry Semantics: Automatic retry with exponential backoff
- Task Routing: Route tasks to specific worker pools (portfolio data, risk calculations)
Error Handling
All tools return structured responses withsuccess flag:
- Generation Failure: Request too ambiguous or unsupported operations
- Validation Failure: Circular dependencies, missing references
- Optimization Timeout: Complex workflows may require manual optimization
- Template Not Found: Requested operation not in template library
Configuration Reference
Workflow Definition Schema
Return Format Envelope
All tools return consistent envelope:See Also
- Temporal Cloud Documentation - Orchestration platform details