Skip to content

Workflow Engine Overview

Document ID: WF-001 Version: 1.0.0 Status: Draft Owner: Workflow Engine Team Last Updated: 2026-06-26


The Workflow Engine is the core orchestration runtime of the Wovyr AI Platform.

It is responsible for executing durable, long-running, event-driven workflows that coordinate:

  • AI model inference
  • Tool execution
  • Human interactions
  • External service calls
  • Timers and schedules
  • Parallel execution
  • State management
  • Recovery and replay

The engine provides deterministic orchestration while allowing controlled interaction with non-deterministic systems such as LLMs.


The Workflow Engine is designed to provide:

  • Durable execution
  • Deterministic orchestration
  • Horizontal scalability
  • Long-running workflow support
  • Event-driven execution
  • Failure recovery
  • Replay capability
  • High observability
  • Extensibility

The engine follows these principles:

  1. Durable by default
  2. Event-driven execution
  3. Deterministic state transitions
  4. Explicit side effects
  5. Idempotent activity execution
  6. Checkpoint-based recovery
  7. Versioned workflow definitions
  8. Pluggable activity implementations

The Workflow Engine is responsible for:

  • Parsing workflow definitions
  • Building execution graphs
  • Scheduling work
  • Executing activities
  • Managing workflow state
  • Handling retries
  • Coordinating compensation
  • Persisting execution progress
  • Publishing lifecycle events
  • Supporting replay and recovery

The engine is not responsible for business logic inside activities.


Activities execute one after another.

Example:

Start
Validate Input
Generate Prompt
Invoke LLM
Store Result
End

Multiple branches execute concurrently.

Start
┌─────┴─────┐
▼ ▼
Activity A Activity B
└─────┬─────┘
Merge
End

Execution path depends on workflow state or activity results.

Supported constructs:

  • If / Else
  • Switch
  • Pattern matching

Execution pauses until an external event is received.

Examples:

  • Payment received
  • Human approval
  • Webhook callback
  • File uploaded

Execution starts based on:

  • Cron expression
  • Fixed interval
  • One-time schedule
  • Calendar trigger

AI activities participate as first-class workflow steps.

Examples:

  • Prompt generation
  • Summarization
  • Classification
  • Code generation
  • Decision support

AI outputs are treated as activity results and persisted like any other activity.


A versioned blueprint describing activities, transitions, and policies.


A running execution created from a workflow definition.

Each instance has:

  • Unique ID
  • Current state
  • Variables
  • History
  • Metadata

The smallest executable unit.

Examples:

  • HTTP call
  • Rust function
  • AI inference
  • Database operation
  • Human task
  • Timer
  • Tool invocation

Activities are isolated and independently retryable.


Contains runtime information:

  • Variables
  • Inputs
  • Outputs
  • Correlation ID
  • Execution metadata
  • Security context

Created
Validated
Scheduled
Running
├────────► Waiting
│ │
│ ▼
│ Resumed
Completed
├────────► Failed
├────────► Cancelled
└────────► Compensated

Every state transition is persisted.


The engine supports multiple activity types:

Activity TypePurpose
FunctionExecute Rust code
HTTPInvoke REST APIs
gRPCCall remote services
AIInvoke LLM providers
ToolExecute registered tools
ScriptRun sandboxed scripts
TimerDelay execution
HumanAwait manual approval
EventWait for external event
Sub-workflowInvoke another workflow

Each activity type shares a common execution contract.


Execution is driven by a state machine.

Key characteristics:

  • Durable checkpoints
  • Explicit state transitions
  • Replay support
  • Optimistic concurrency
  • Deterministic scheduling

No workflow progress is lost after a process restart.


Workflow state is persisted after every significant transition.

Persisted data includes:

  • Current state
  • Activity status
  • Variables
  • Event history
  • Retry counters
  • Checkpoints

Persistence is abstracted behind repository interfaces.


Scheduling capabilities include:

  • Immediate execution
  • Delayed execution
  • Cron schedules
  • Periodic execution
  • Event-triggered execution

Scheduling is delegated to the Scheduler component.


The engine supports:

  • Configurable retry policies
  • Exponential backoff
  • Compensation workflows
  • Dead-letter handling
  • Manual intervention

Failure handling policies are defined per activity and workflow.


Every workflow execution emits:

  • Lifecycle events
  • Metrics
  • Structured logs
  • Distributed traces

Operators should be able to inspect:

  • Current state
  • Activity history
  • Retry attempts
  • Timing information

Workflow execution must enforce:

  • Authorization
  • Tenant isolation
  • Activity permissions
  • Secret masking
  • Audit logging

Sensitive workflow data should be protected at rest and in transit.


The engine supports:

  • Horizontal worker scaling
  • Distributed execution
  • Queue-based scheduling
  • Partitioned workloads

Execution ownership can move between workers without losing progress.


The Workflow Engine supports extension through:

  • Custom activity types
  • Scheduling strategies
  • Persistence providers
  • Event bus implementations
  • Serialization formats
  • Monitoring integrations

Extensions must implement stable public interfaces.


Primary integrations include:

  • Agent Runtime
  • Memory Engine
  • LLM Gateway
  • Tool Runtime
  • Event Bus
  • Scheduler
  • Platform Kernel

Each integration is accessed through ports defined by the domain layer.


RequirementTarget
Workflow startup latency< 100 ms
Activity scheduling latency< 50 ms
Workflow durabilityNo data loss after checkpoint
Horizontal scalabilityLinear scaling with workers
Availability99.9%+
Replay capabilityFull execution history

  • Execution Model
  • Workflow DSL
  • DAG Engine
  • Scheduler
  • State Machine
  • Checkpointing
  • Retry Engine
  • Compensation
  • Distributed Execution
  • Persistence
  • Rust Crate Design
  • Temporal Gap Closure (next phase)

VersionDateDescription
1.0.02026-06-26Initial Workflow Engine Overview