Workflows (Early Access)
Workflows are the orchestration backbone of Eden, providing a powerful mechanism for automating complex multi-step processes. They enable you to coordinate actions across different systems, implement business processes, and create end-to-end automation solutions with sophisticated logic and error handling.
Understanding Eden WorkflowsCopied!
At their core, Eden workflows are directed graphs of operations where:
-
Each node represents a discrete action or decision
-
Edges define the flow between operations
-
Conditions determine which paths are taken
-
Data is transformed and passed between steps
Workflows transcend simple linear sequences by supporting:
-
Parallel execution paths
-
Conditional branching
-
Error handling and recovery
-
Loops and iterations
-
Long-running processes
-
Human interaction steps
This flexibility allows workflows to model everything from simple data pipelines to complex business processes requiring coordination across multiple systems and teams.
Workflow ComponentsCopied!
An Eden workflow consists of several key components:
-
Triggers
-
Define what initiates the workflow
-
Can be scheduled (time-based), event-driven, or manual
-
Examples include API calls, data changes, or time schedules
-
-
Actions
-
Represent individual operations
-
Include calling endpoints, applying templates, or invoking services
-
Each action has inputs, outputs, and configuration options
-
-
Control Flow Elements
-
Determine the execution path
-
Include conditions, loops, parallel execution, and waits
-
Enable complex decision-making logic
-
-
Data Flow
-
Defines how information moves between actions
-
Supports transformations, aggregations, and filtering
-
Maintains state throughout workflow execution
-
-
Error Handling
-
Defines responses to failures
-
Includes retries, fallbacks, and compensation actions
-
Ensures graceful handling of exceptions
-
Managing WorkflowsCopied!
-
Create a Workflow:
POST /workflows
-
Defines a new process automation
-
Requires specifying the workflow structure, triggers, actions, and flow logic
-
Validates the workflow definition before creation
-
Example request for a customer onboarding workflow:
POST /workflows{ "name": "CustomerOnboarding", "description": "Process new customer registration and setup", "version": "1.0", "trigger": { "type": "event", "source": "api.customer.registration" }, "input": { "schema": { "type": "object", "properties": { "customerId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "plan": { "type": "string" } }, "required": ["customerId", "email"] } }, "actions": [ { "id": "validate_customer", "type": "template", "template": "CustomerValidation", "input": { "customer": "$.input" }, "next": { "condition": "$.output.valid", "true": "create_account", "false": "send_validation_error" } }, { "id": "create_account", "type": "endpoint", "endpoint": "AccountSystem", "operation": "write", "input": { "action": "create", "data": "$.input" }, "next": "provision_resources" }, { "id": "provision_resources", "type": "parallel", "branches": [ { "id": "setup_storage", "type": "endpoint", "endpoint": "StorageSystem", "operation": "write", "input": { "customerId": "$.input.customerId", "plan": "$.input.plan" } }, { "id": "setup_compute", "type": "endpoint", "endpoint": "ComputeSystem", "operation": "write", "input": { "customerId": "$.input.customerId", "plan": "$.input.plan" } } ], "next": "send_welcome_email" }, { "id": "send_welcome_email", "type": "template", "template": "WelcomeEmailTemplate", "input": { "customer": "$.input", "accountDetails": "$.actions.create_account.output" }, "next": null }, { "id": "send_validation_error", "type": "template", "template": "ValidationErrorEmail", "input": { "customer": "$.input", "errors": "$.actions.validate_customer.output.errors" }, "next": null } ], "errorHandler": { "default": { "action": "send_error_notification", "retry": { "maxAttempts": 3, "backoffRate": 2.0, "initialInterval": 60 } }, "actions": { "create_account": { "retryOnErrors": ["ServiceUnavailable", "RateLimitExceeded"], "maxAttempts": 5 } } }}
-
-
Get Workflow Details:
GET /workflows/{workflow}
-
Retrieves the complete definition of a workflow
-
Includes all actions, conditions, and error handling logic
-
Provides execution statistics and version history
-
Example response includes complete workflow definition plus:
{ "id": "wf_cust_onboard_01", "name": "CustomerOnboarding", "status": "active", "created": "2025-04-10T15:30:22Z", "createdBy": "jane.doe@example.com", "lastModified": "2025-05-01T09:12:44Z", "lastModifiedBy": "john.smith@example.com", "execution": { "totalExecutions": 1247, "successRate": 0.982, "averageDuration": 45.3, "last24Hours": { "executions": 42, "successRate": 0.976 } }, "versions": [ { "version": "1.0", "created": "2025-04-10T15:30:22Z", "active": true }, { "version": "0.9", "created": "2025-03-22T11:15:06Z", "active": false } ]}
-
-
Update a Workflow:
PATCH /workflows/{workflow}
-
Modifies an existing workflow
-
Can update actions, conditions, error handling, or metadata
-
Supports versioning to maintain compatibility
-
Changes are validated before being applied
-
Example update request:
PATCH /workflows/wf_cust_onboard_01{ "description": "Enhanced customer onboarding with compliance checks", "version": "1.1", "actions": [ { "id": "compliance_check", "type": "endpoint", "endpoint": "ComplianceSystem", "operation": "read", "input": { "customerId": "$.input.customerId", "name": "$.input.name", "email": "$.input.email" }, "next": { "condition": "$.output.approved", "true": "validate_customer", "false": "send_compliance_rejection" } }, { "id": "send_compliance_rejection", "type": "template", "template": "ComplianceRejectionEmail", "input": { "customer": "$.input", "reason": "$.actions.compliance_check.output.reason" }, "next": null } ]}
-
-
Delete a Workflow:
DELETE /workflows/{workflow}
-
Permanently removes a workflow from the system
-
Requires confirmation for workflows in active use
-
All versions of the workflow are removed
-
Any scheduled or triggered instances may be canceled
-
API ReferenceCopied!
Create Workflow
-
URL:
/workflows
-
Method:
POST
-
Headers Required: Authorization with JWT token
-
Request Body: Workflow details
-
Success Response: 200 OK with confirmation message
-
Example Response:
{ "id": "wf_cust_onboard_01", "name": "CustomerOnboarding", "version": "1.0", "message": "Workflow created successfully"}
Get Workflow
-
URL:
/workflows/{workflow}
-
Method:
GET
-
Headers Required: Authorization with JWT token
-
URL Parameters:
-
workflow
: The ID of the workflow
-
-
Success Response: 200 OK with workflow details
-
Example Response: See the workflow details example above
Update Workflow
-
URL:
/workflows/{workflow}
-
Method:
PATCH
-
Headers Required: Authorization with JWT token
-
URL Parameters:
-
workflow
: The ID of the workflow
-
-
Request Body: Updated workflow details
-
Success Response: 200 OK with confirmation message
-
Example Response:
{ "id": "wf_cust_onboard_01", "name": "CustomerOnboarding", "version": "1.1", "message": "Workflow updated successfully", "updatedFields": ["description", "version", "actions"]}
Delete Workflow
-
URL:
/workflows/{workflow}
-
Method:
DELETE
-
Headers Required: Authorization with JWT token
-
URL Parameters:
-
workflow
: The ID of the workflow
-
-
Success Response: 200 OK with confirmation message
-
Example Response:
{ "message": "Workflow deleted successfully", "id": "wf_cust_onboard_01", "activeInstances": 3, "terminationStatus": "scheduled"}
Workflow Execution ModelCopied!
Eden workflows follow a robust execution model designed for reliability and observability:
-
Initialization
-
Workflow instance is created when triggered
-
Input data is validated against schema
-
Execution context is established
-
-
Execution
-
Actions are executed according to flow logic
-
State is maintained throughout execution
-
Progress is tracked and persisted
-
-
State Management
-
Each workflow instance has its own state
-
State includes action outputs, variables, and metadata
-
State can be queried during execution
-
-
Error Handling
-
Errors trigger defined error handlers
-
Recovery actions can be executed
-
Retry policies apply based on configuration
-
-
Completion
-
Workflow concludes when terminal state is reached
-
Output is generated based on execution results
-
Execution record is maintained for auditing
-
Workflow TriggersCopied!
Eden supports various trigger mechanisms to initiate workflows:
-
API Triggers
-
Manual invocation via API call
-
Synchronous or asynchronous execution
-
Input validation against schema
-
Example:
"trigger": { "type": "api", "synchronous": true, "authentication": { "required": true }}
-
-
Scheduled Triggers
-
Time-based execution
-
CRON-style scheduling
-
Timezone configuration
-
Optional input data
-
Example:
"trigger": { "type": "schedule", "schedule": "0 0 * * *", // Daily at midnight "timezone": "America/New_York", "input": { "reportType": "daily", "sendNotification": true }}
-
-
Event Triggers
-
React to events from endpoints
-
Filter events based on patterns
-
Extract data from events
-
Example:
"trigger": { "type": "event", "source": "OrderSystem", "event": "order.created", "filter": "$.payload.total > 1000", "mapping": { "orderId": "$.payload.id", "customer": "$.payload.customer", "amount": "$.payload.total" }}
-
-
Webhook Triggers
-
Expose HTTP endpoint for external systems
-
Support authentication mechanisms
-
Transform incoming data
-
Example:
"trigger": { "type": "webhook", "path": "/callbacks/payment-processor", "authentication": { "type": "hmac", "header": "X-Signature", "secret": "${ENV_WEBHOOK_SECRET}" }, "mapping": { "transactionId": "$.body.transaction.id", "status": "$.body.transaction.status", "amount": "$.body.transaction.amount" }}
-
-
Data Change Triggers
-
Monitor data changes in endpoints
-
Trigger on specific conditions
-
Capture before/after values
-
Example:
"trigger": { "type": "dataChange", "endpoint": "CustomerDatabase", "collection": "customers", "operation": ["update"], "filter": "$.changes.status == 'active' && $.before.status != 'active'", "mapping": { "customerId": "$.after.id", "name": "$.after.name", "email": "$.after.email", "previousStatus": "$.before.status", "newStatus": "$.after.status" }}
-
Workflow Action TypesCopied!
Eden workflows support various action types to perform different operations:
-
Endpoint Actions
-
Interact with external systems via endpoints
-
Read or write data
-
Process responses
-
Example:
{ "id": "get_customer_data", "type": "endpoint", "endpoint": "CustomerDatabase", "operation": "read", "input": { "query": { "customerId": "$.input.customerId" } }}
-
-
Template Actions
-
Apply templates to transform data
-
Validate inputs
-
Generate structured outputs
-
Example:
{ "id": "format_customer_data", "type": "template", "template": "CustomerDataFormatter", "input": { "rawData": "$.actions.get_customer_data.output" }}
-
-
Conditional Actions
-
Branch workflow based on conditions
-
Evaluate expressions against workflow data
-
Direct flow to different paths
-
Example:
{ "id": "check_customer_type", "type": "condition", "condition": "$.actions.get_customer_data.output.customerType == 'business'", "true": "process_business_customer", "false": "process_individual_customer"}
-
-
Parallel Actions
-
Execute multiple branches simultaneously
-
Wait for all branches to complete
-
Combine results from parallel executions
-
Example:
{ "id": "process_in_parallel", "type": "parallel", "branches": [ { "id": "update_crm", "type": "endpoint", "endpoint": "CrmSystem", "operation": "write", "input": { "customer": "$.input.customer" } }, { "id": "update_erp", "type": "endpoint", "endpoint": "ErpSystem", "operation": "write", "input": { "customer": "$.input.customer" } } ], "joinResults": true}
-
-
Loop Actions
-
Iterate over collections
-
Process items sequentially or in parallel
-
Aggregate results from iterations
-
Example:
{ "id": "process_orders", "type": "loop", "collection": "$.input.orders", "as": "order", "mode": "sequential", // or "parallel" "maxConcurrency": 5, // for parallel mode "action": { "id": "process_single_order", "type": "template", "template": "OrderProcessor", "input": { "order": "$.item" // Current item in the loop } }, "aggregation": { "processed": "$.results", // All results from iterations "count": "$.count", // Number of iterations "successful": "$.successful.length" // Count of successful iterations }}
-
-
Wait Actions
-
Pause workflow execution
-
Wait for specific duration or until condition
-
Continue based on events or timeouts
-
Example:
{ "id": "wait_for_approval", "type": "wait", "mode": "event", "eventSource": "ApprovalSystem", "eventPattern": { "type": "approval.decision", "requestId": "$.actions.submit_approval.output.requestId" }, "timeout": { "duration": "P2D", // ISO 8601 duration - 2 days "action": "approval_timeout" }}
-
-
Human Task Actions
-
Create tasks requiring human input
-
Assign to users or roles
-
Wait for task completion
-
Process human decisions
-
Example:
{ "id": "manual_review", "type": "humanTask", "title": "Review Customer Application", "description": "Please review the customer application and approve or reject", "assignees": { "roles": ["Underwriter"], "users": ["jane.doe@example.com"] }, "form": { "fields": [ { "id": "decision", "type": "select", "label": "Decision", "options": ["approve", "reject", "request_more_info"], "required": true }, { "id": "notes", "type": "textarea", "label": "Notes", "required": false } ] }, "timeout": { "duration": "P1D", // 1 day "escalation": { "roles": ["UnderwritingManager"] } }}
-
-
Subworkflow Actions
-
Invoke other workflows
-
Compose complex workflows from simpler ones
-
Encapsulate reusable processes
-
Example:
{ "id": "process_payment", "type": "subworkflow", "workflow": "PaymentProcessing", "input": { "amount": "$.input.amount", "currency": "$.input.currency", "paymentMethod": "$.input.paymentMethod", "customerId": "$.input.customerId" }, "waitForCompletion": true}
-
Workflow Advanced FeaturesCopied!
Eden workflows support several advanced capabilities:
-
Long-Running Workflows
-
Support for processes spanning hours or days
-
Persistence of workflow state
-
Resumability after system restarts
-
Example configuration:
"executionSettings": { "type": "longRunning", "persistence": { "level": "full", // Persists state after each action "durability": "high" // Multiple redundant storage }, "timeouts": { "total": "P7D", // Total workflow can run for 7 days "inactivity": "P1D" // Fail if inactive for 1 day }}
-
-
Human Interaction
-
Integration with approval systems
-
Wait states for manual intervention
-
Notification and reminder capabilities
-
Form generation for structured input
-
Example human interaction configuration:
"humanInteraction": { "notifications": { "channels": ["email", "slack", "sms"], "templates": { "taskAssigned": "TaskAssignmentNotification", "taskReminder": "TaskReminderNotification", "taskEscalated": "TaskEscalationNotification" } }, "ui": { "theme": "corporate", "logo": "https://company.example.com/logo.png", "customStyles": true }}
-
-
Dynamic Workflow Modification
-
Runtime decision of which actions to execute
-
Dynamic path selection based on data
-
Conditional inclusion of workflow segments
-
Example dynamic action selection:
{ "id": "select_verification_method", "type": "dynamicAction", "selection": { "expression": "$.input.verificationType", "options": { "email": { "id": "email_verification", "type": "subworkflow", "workflow": "EmailVerification" }, "phone": { "id": "phone_verification", "type": "subworkflow", "workflow": "PhoneVerification" }, "document": { "id": "document_verification", "type": "subworkflow", "workflow": "DocumentVerification" } }, "default": "email" }}
-
-
Workflow Monitoring
-
Real-time execution tracking
-
Visual representation of workflow progress
-
Detailed execution logs and history
-
Example monitoring capabilities:
"monitoring": { "metrics": { "collect": ["duration", "actionCounts", "errorRates"], "customMetrics": [ { "name": "highValueTransactions", "counter": true, "condition": "$.input.amount > 10000" } ] }, "logging": { "level": "detailed", // basic, detailed, or debug "includePayloads": true, "sensitiveFields": ["creditCardNumber", "ssn"] }, "alerting": { "conditions": [ { "name": "LongRunningWorkflow", "condition": "$.duration > 300", // > 5 minutes "channels": ["email", "pagerduty"] } ] }}
-
-
Cross-Organization Workflows
-
Coordination across organizational boundaries
-
Secure data sharing between workflows
-
Distributed execution with centralized monitoring
-
Example cross-organization configuration:
"collaboration": { "externalWorkflows": [ { "organization": "partner-org-id", "workflow": "PartnerProcessing", "dataSharing": { "input": ["orderId", "amount", "productIds"], "output": ["status", "trackingNumber"] }, "authentication": { "type": "tokenExchange", "audience": "partner-api.example.com" } } ]}
-
Error Handling StrategiesCopied!
Eden provides sophisticated error handling capabilities for robust workflows:
-
Retry Policies
-
Automatically retry failed actions
-
Configurable retry attempts and delays
-
Exponential backoff for transient failures
-
Example retry configuration:
"errorHandler": { "actions": { "process_payment": { "retry": { "maxAttempts": 3, "initialInterval": 5, "multiplier": 2.0, "maxInterval": 60, "retryableErrors": [ "CONNECTION_ERROR", "TIMEOUT", "RATE_LIMITED" ] } } }}
-
-
Compensation Actions
-
Rollback previously completed actions
-
Clean up resources after failures
-
Maintain system consistency
-
Example compensation configuration:
{ "id": "create_account", "type": "endpoint", "endpoint": "AccountSystem", "operation": "write", "input": { "action": "create", "data": "$.input" }, "compensation": { "id": "delete_account", "type": "endpoint", "endpoint": "AccountSystem", "operation": "write", "input": { "action": "delete", "accountId": "$.actions.create_account.output.accountId" } }}
-
-
Fallback Actions
-
Alternative execution paths on failure
-
Graceful degradation for critical processes
-
Maintain basic functionality despite errors
-
Example fallback configuration:
"errorHandler": { "actions": { "retrieve_customer_profile": { "fallback": { "id": "use_basic_profile", "type": "template", "template": "GenerateBasicProfile", "input": { "customerId": "$.input.customerId", "name": "$.input.name", "email": "$.input.email" } } } }}
-
-
Error Escalation
-
Forward critical errors to specialized handlers
-
Notify operators of significant failures
-
Trigger incident management processes
-
Example escalation configuration:
"errorHandler": { "default": { "escalation": { "threshold": 3, // Escalate after 3 failures "notification": { "channels": ["email", "slack", "pagerduty"], "template": "CriticalWorkflowFailure", "recipients": { "roles": ["SystemOperator"], "emails": ["oncall@example.com"] } }, "incident": { "create": true, "severity": "high", "category": "workflow_failure" } } }}
-
-
Dead Letter Queues
-
Capture failed executions for later processing
-
Preserve data for debugging and recovery
-
Prevent data loss during system failures
-
Example DLQ configuration:
"errorHandler": { "deadLetterQueue": { "enabled": true, "destination": "WorkflowErrors", "includeState": true, "retryable": true, "retention": "P14D" // Keep failed executions for 14 days }}
-
Workflow Design Best PracticesCopied!
-
Start Small, Iterate Often
-
Begin with core functionality
-
Test thoroughly at each stage
-
Expand complexity incrementally
-
Follow an incremental implementation approach:
1. Implement the "happy path" workflow2. Add validation and error handling3. Incorporate human interaction and approvals4. Implement advanced monitoring and reporting5. Optimize for performance and scalability
-
-
Design for Failure
-
Anticipate and handle errors at every step
-
Implement appropriate retry policies
-
Create clear failure paths and recovery mechanisms
-
Consider failure scenarios at design time:
- What if an external system is down?- What if a transaction takes longer than expected?- What if reference data is missing or corrupted?- What if an upstream process sends invalid data?- What if human approval is delayed or rejected?
-
-
Maintain Idempotency
-
Ensure actions can be repeated safely
-
Avoid side effects that can't be managed
-
Implement transaction management where needed
-
Example idempotency implementation:
{ "id": "create_order", "type": "endpoint", "endpoint": "OrderSystem", "operation": "write", "idempotencyKey": "$.input.requestId", // Client-provided ID "input": { "action": "create", "order": "$.input.order" }}
-
-
Optimize Data Flow
-
Minimize data passed between actions
-
Transform data close to where it's used
-
Use templates for complex transformations
-
Example data transformation approach:
{ "id": "prepare_customer_data", "type": "template", "template": "CustomerDataPreparation", "input": { "rawData": "$.actions.get_customer.output" }, "comment": "Transform data once, then use in multiple actions"}
-
-
Document and Version
-
Maintain clear documentation of workflow purpose
-
Version workflows for significant changes
-
Track dependencies on endpoints and templates
-
Example documentation and versioning approach:
{ "name": "OrderProcessing", "description": "End-to-end order processing from submission to fulfillment", "version": "2.3", "documentation": { "purpose": "Handles the complete lifecycle of an order", "businessOwner": "Order Management Team", "technicalContact": "integration-team@example.com", "changeLog": [ { "version": "2.3", "changes": "Added fraud check step, improved error handling", "date": "2025-04-15" }, { "version": "2.2", "changes": "Enhanced inventory verification", "date": "2025-03-10" } ], "dependencies": { "endpoints": ["OrderSystem", "InventorySystem", "PaymentProcessor"], "templates": ["OrderValidation", "PaymentProcessing", "EmailGenerator"] } }}
-
Common Workflow PatternsCopied!
Sequential Process
A simple linear sequence of operations, where each step depends on the previous one.
{
"name": "SimpleOrderProcess",
"description": "Basic order processing workflow",
"actions": [
{
"id": "validate_order",
"type": "template",
"template": "OrderValidation",
"next": "check_inventory"
},
{
"id": "check_inventory",
"type": "endpoint",
"endpoint": "InventorySystem",
"next": "process_payment"
},
{
"id": "process_payment",
"type": "endpoint",
"endpoint": "PaymentSystem",
"next": "send_confirmation"
},
{
"id": "send_confirmation",
"type": "template",
"template": "EmailNotification",
"next": null
}
]
}
Conditional Branching
A workflow that follows different paths based on conditions.
{
"name": "PaymentProcessing",
"description": "Process payments with different methods",
"actions": [
{
"id": "validate_payment",
"type": "template",
"template": "PaymentValidation",
"next": "check_payment_method"
},
{
"id": "check_payment_method",
"type": "condition",
"condition": "$.input.paymentMethod == 'credit_card'",
"true": "process_credit_card",
"false": "check_alternative_method"
},
{
"id": "check_alternative_method",
"type": "condition",
"condition": "$.input.paymentMethod == 'bank_transfer'",
"true": "process_bank_transfer",
"false": "process_alternative_payment"
},
{
"id": "process_credit_card",
"type": "endpoint",
"endpoint": "CreditCardProcessor",
"next": "send_receipt"
},
{
"id": "process_bank_transfer",
"type": "endpoint",
"endpoint": "BankingSystem",
"next": "send_receipt"
},
{
"id": "process_alternative_payment",
"type": "endpoint",
"endpoint": "AlternativePaymentProcessor",
"next": "send_receipt"
},
{
"id": "send_receipt",
"type": "template",
"template": "ReceiptGenerator",
"next": null
}
]
}
Parallel Processing
A workflow that executes multiple steps simultaneously for efficiency.
{
"name": "CustomerOnboarding",
"description": "Onboard new customers with parallel processing",
"actions": [
{
"id": "validate_customer",
"type": "template",
"template": "CustomerValidation",
"next": "parallel_setup"
},
{
"id": "parallel_setup",
"type": "parallel",
"branches": [
{
"id": "create_account",
"type": "endpoint",
"endpoint": "AccountSystem"
},
{
"id": "setup_billing",
"type": "endpoint",
"endpoint": "BillingSystem"
},
{
"id": "create_user_profile",
"type": "endpoint",
"endpoint": "ProfileSystem"
}
],
"next": "send_welcome"
},
{
"id": "send_welcome",
"type": "template",
"template": "WelcomeEmailGenerator",
"next": null
}
]
}
Human Approval
A workflow that incorporates human decision-making.
{
"name": "ExpenseApproval",
"description": "Process and approve employee expenses",
"actions": [
{
"id": "validate_expense",
"type": "template",
"template": "ExpenseValidation",
"next": "check_amount"
},
{
"id": "check_amount",
"type": "condition",
"condition": "$.input.amount > 1000",
"true": "manager_approval",
"false": "auto_approve"
},
{
"id": "manager_approval",
"type": "humanTask",
"title": "Approve Expense Report",
"assignees": {
"expression": "$.input.managerEmail"
},
"form": {
"fields": [
{
"id": "decision",
"type": "select",
"options": ["approve", "reject"],
"required": true
},
{
"id": "comments",
"type": "textarea"
}
]
},
"next": "check_approval"
},
{
"id": "check_approval",
"type": "condition",
"condition": "$.actions.manager_approval.output.decision == 'approve'",
"true": "process_payment",
"false": "send_rejection"
},
{
"id": "auto_approve",
"type": "template",
"template": "AutoApproval",
"next": "process_payment"
},
{
"id": "process_payment",
"type": "endpoint",
"endpoint": "PaymentSystem",
"next": "send_confirmation"
},
{
"id": "send_confirmation",
"type": "template",
"template": "ApprovalNotification",
"next": null
},
{
"id": "send_rejection",
"type": "template",
"template": "RejectionNotification",
"next": null
}
]
}
Event-Based Processing
A workflow triggered by external events with event correlation.
{
"name": "OrderFulfillment",
"description": "Track and process order fulfillment with event correlation",
"trigger": {
"type": "event",
"source": "OrderSystem",
"event": "order.placed"
},
"correlation": {
"key": "orderId",
"source": "$.event.orderId"
},
"actions": [
{
"id": "initiate_fulfillment",
"type": "endpoint",
"endpoint": "WarehouseSystem",
"next": "wait_for_shipment"
},
{
"id": "wait_for_shipment",
"type": "wait",
"mode": "event",
"eventSource": "WarehouseSystem",
"eventPattern": {
"type": "order.shipped",
"orderId": "$.correlation.orderId"
},
"timeout": {
"duration": "P2D",
"action": "shipment_delayed"
},
"next": "process_shipment"
},
{
"id": "process_shipment",
"type": "template",
"template": "ShipmentProcessor",
"next": "send_tracking"
},
{
"id": "send_tracking",
"type": "endpoint",
"endpoint": "NotificationSystem",
"next": "wait_for_delivery"
},
{
"id": "wait_for_delivery",
"type": "wait",
"mode": "event",
"eventSource": "DeliverySystem",
"eventPattern": {
"type": "order.delivered",
"orderId": "$.correlation.orderId"
},
"timeout": {
"duration": "P7D",
"action": "delivery_follow_up"
},
"next": "complete_order"
},
{
"id": "complete_order",
"type": "endpoint",
"endpoint": "OrderSystem",
"next": "send_satisfaction_survey"
},
{
"id": "send_satisfaction_survey",
"type": "template",
"template": "SurveyGenerator",
"next": null
},
{
"id": "shipment_delayed",
"type": "template",
"template": "DelayNotification",
"next": "escalate_shipment"
},
{
"id": "delivery_follow_up",
"type": "humanTask",
"title": "Check Delivery Status",
"next": null
}
]
}
Saga Pattern
A workflow implementing the saga pattern for distributed transactions.
{
"name": "OrderSaga",
"description": "Complete order processing with compensating transactions",
"actions": [
{
"id": "reserve_inventory",
"type": "endpoint",
"endpoint": "InventorySystem",
"compensation": {
"id": "release_inventory",
"type": "endpoint",
"endpoint": "InventorySystem"
},
"next": "process_payment"
},
{
"id": "process_payment",
"type": "endpoint",
"endpoint": "PaymentSystem",
"compensation": {
"id": "refund_payment",
"type": "endpoint",
"endpoint": "PaymentSystem"
},
"next": "create_shipment"
},
{
"id": "create_shipment",
"type": "endpoint",
"endpoint": "ShippingSystem",
"compensation": {
"id": "cancel_shipment",
"type": "endpoint",
"endpoint": "ShippingSystem"
},
"next": "update_order_status"
},
{
"id": "update_order_status",
"type": "endpoint",
"endpoint": "OrderSystem",
"compensation": {
"id": "revert_order_status",
"type": "endpoint",
"endpoint": "OrderSystem"
},
"next": "send_confirmation"
},
{
"id": "send_confirmation",
"type": "template",
"template": "OrderConfirmation",
"next": null
}
],
"errorHandler": {
"default": {
"strategy": "compensate",
"compensation": {
"mode": "reverse"
}
}
}
}