Workflow Engine
Overview
The workflow engine provides DAG-based workflow execution with multiple step types, dependency management, and human-in-the-loop support. Workflows enable complex multi-step processes with automatic parallelization and error handling.
Key Features
- DAG Workflows: Directed acyclic graph workflow execution with dependency resolution
- Multiple Step Types: Agent, tool, HTTP, approval, and conditional steps
- Dependency Management: Automatic parallel execution where possible
- Input/Output Mapping: Step input/output mapping with data transformation
- Compensation Steps: Rollback and compensation logic for failed steps
- Human-in-the-Loop: Approval gates with email/webhook notifications
- Idempotency: Idempotent step execution with key-based caching
- Retries: Configurable retry logic with exponential backoff
- Scheduling: Schedule workflows for future execution with cron-like syntax
DAG Workflows
Workflows are defined as directed acyclic graphs (DAGs), where each node represents a step and edges represent dependencies. The engine automatically resolves dependencies and executes steps in the correct order.
Workflow Definition
Workflows are defined using JSON or YAML, specifying steps, dependencies, inputs, outputs, and execution parameters.
Execution Model
The engine executes workflows by resolving dependencies, scheduling steps for execution, and managing state throughout the workflow lifecycle.
Workflow Steps
Workflows support multiple step types, each optimized for different use cases and integration patterns.
Agent Steps
Execute an agent with specific input, enabling agent-based workflow orchestration.
Tool Steps
Execute a tool directly, bypassing agent execution for simple operations.
HTTP Steps
Make HTTP requests to external services, enabling integration with external APIs.
Approval Steps
Human approval gates that pause workflow execution until approval is received.
Conditional Steps
Branching logic based on conditions, enabling dynamic workflow paths.
Dependency Management
The workflow engine automatically manages step dependencies, executing steps in parallel when possible and ensuring correct execution order.
Dependency Resolution
Dependencies are resolved from the workflow definition, creating an execution plan that respects all dependencies.
Parallel Execution
Steps without dependencies are executed in parallel, improving workflow performance.
Input/Output Mapping
Step inputs and outputs are automatically mapped, enabling data flow between steps.
Human-in-the-Loop
Human-in-the-loop (HITL) support enables workflows to pause for human approval, feedback, or intervention at specific points.
Approval Gates
Approval steps pause workflow execution and send notifications to designated approvers via email or webhook.
Approval Notifications
Approvers receive notifications with approval links and context about the pending approval.
Approval Timeouts
Configurable timeouts for approvals with automatic escalation if approval is not received.
Feedback Integration
Human feedback is integrated into workflow execution, enabling dynamic workflow adaptation.
Compensation Steps
Compensation steps provide rollback and compensation logic for failed workflow steps, enabling transactional workflow execution.
Compensation Logic
Compensation steps are automatically executed when a step fails, undoing changes made by previous steps.
Error Handling
Failed steps trigger compensation logic, ensuring workflow consistency and data integrity.
Workflow Scheduling
Workflows can be scheduled for future execution using cron-like syntax, enabling automated workflow execution.
Scheduling Syntax
Workflows support cron-like scheduling syntax for flexible scheduling patterns.
Execution Monitoring
Scheduled workflow executions are monitored and logged, providing visibility into workflow execution history.
API Reference
The workflow engine is accessible through the NeuronAgent REST API for creating, managing, and executing workflows.
Workflow Endpoints
POST /api/v1/workflows- Create a workflowGET /api/v1/workflows- List workflowsGET /api/v1/workflows/:id- Get workflow detailsPUT /api/v1/workflows/:id- Update a workflowDELETE /api/v1/workflows/:id- Delete a workflowPOST /api/v1/workflows/:id/execute- Execute a workflowGET /api/v1/workflows/:id/executions- List workflow executionsPOST /api/v1/workflows/:id/schedule- Schedule a workflow