Kuetix Engine Architecture
This section provides a comprehensive overview of the Kuetix Engine architecture, describing its layers, components, relationships, and data flow.
Overview
Kuetix Engine is a modular workflow engine that powers Kuetix applications. It provides:
- Lightweight Bootstrap: Fast initialization with dependency injection
- Workflow Specification Language (WSL): A domain-specific language for defining workflows
- Pluggable Module System: Extensible architecture for custom transitions
- Event-Driven Communication: Asynchronous event bus for decoupled components
High-Level Architecture
┌─────────────────────────────────────────────────────────────────────┐
│ Application Layer │
│ (engine.go) │
├─────────────────────────────────────────────────────────────────────┤
│ Bootstrap Layer │
│ (boot/) │
├─────────────────────────────────────────────────────────────────────┤
│ ┌──────────────────┐ ┌─────────────────┐ ┌─────────────────────┐ │
│ │ Workflow Engine │ │ WSL Compiler │ │ Module System │ │
│ │ (engine/workflow)│ │ (internal/wsl/)│ │ (modules/) │ │
│ └──────────────────┘ └─────────────────┘ └─────────────────────┘ │
├─────────────────────────────────────────────────────────────────────┤
│ Core Layer │
│ (engine/domain/, engine/helpers/, engine/services/) │
├─────────────────────────────────────────────────────────────────────┤
│ Event System │
│ (event/) │
└─────────────────────────────────────────────────────────────────────┘
Directory Structure Reference
engine/
├── engine.go # Top-level RunWorkflow entry point
├── boot/ # Bootstrap and initialization
│ ├── bootstrap.go # DI container setup
│ ├── enable.go # Feature enablement
│ ├── entities.go # Entity configuration
│ ├── helpers.go # Bootstrap utilities
│ ├── metadata.go # Function metadata cache
│ ├── services.go # Service registration
│ └── transitions.go # Transition handlers
├── cmd/ # CLI entry points
│ └── mcp-server/ # MCP server binary
├── engine/ # Core engine packages
│ ├── defines/ # Constants and shared types
│ ├── domain/ # Domain models (Flow, Options, Environment, …)
│ ├── helpers/ # Internal helpers
│ ├── manager/ # Sync/async workflow managers
│ ├── services/ # Internal services (atomic, caches, generator)
│ └── workflow/ # Engine, worker, runners, execution
├── event/ # Event system
│ └── bus.go # Event bus implementation
├── internal/ # Internal packages
│ └── wsl/ # WSL/SWSL compiler (lexer, CST, AST, IR)
├── modules/ # Extensible modules
│ ├── di.go # Generated DI configuration
│ ├── meta.go # Generated function metadata
│ └── modules.go # Hand-written module registration
├── runtime/ # Runtime configuration
│ ├── etc/ # Config profiles (development/, production/)
│ └── workflows/ # Example workflow files
└── tests/ # Test suites
Summary
Kuetix Engine provides a robust, extensible workflow execution platform with:
- Clear Layered Architecture: Separation of concerns across application, bootstrap, core, and workflow layers
- Powerful WSL Compiler: Full compilation pipeline from source to executable graphs
- Flexible Workflow Engine: State machine-based execution with customizable transitions
- Extensible Module System: Plugin architecture for custom functionality
- Event-Driven Design: Loose coupling via event bus
- Configuration Management: Environment-specific configuration profiles
This architecture enables developers to define complex workflows declaratively while maintaining the flexibility to extend the engine with custom modules and transitions.