Architecture Overview
Osmedeus is a workflow engine for security automation. It executes YAML-defined workflows with support for multiple execution environments, distributed processing, and extensive customization.Layered Architecture
Core Packages
| Package | Purpose |
|---|---|
internal/core | Type definitions: Workflow, Step, Trigger, RunnerConfig, ExecutionContext |
internal/parser | YAML parsing, validation, and caching (Loader) |
internal/executor | Workflow execution engine with step dispatching |
internal/runner | Execution environments implementing Runner interface |
internal/template | {{Variable}} interpolation engine (Engine, ShardedEngine) |
internal/functions | Utility functions via Goja JavaScript runtime pool |
internal/scheduler | Cron, event, and file-watch triggers |
internal/database | SQLite/PostgreSQL via Bun ORM |
internal/linter | Workflow validation and linting |
pkg/cli | Cobra CLI commands |
pkg/server | Fiber REST API |
internal/snapshot | Workspace export/import as ZIP archives |
internal/installer | Binary installation (direct-fetch and Nix) |
internal/state | Run state export for debugging |
internal/updater | Self-update via GitHub releases |
Workflow Execution Flow
Step Type Routing
The Step Dispatcher routes steps to the appropriate executor based on type:Key Types
WorkflowKind
StepType
RunnerType
TriggerType
Step Executors
| Executor | Description | Runner |
|---|---|---|
BashExecutor | Execute shell commands | Host/Docker/SSH |
FunctionExecutor | Execute utility functions | Goja runtime |
ParallelExecutor | Concurrent step execution | Multiple |
ForeachExecutor | Iterate with parallelism | Multiple |
RemoteBashExecutor | Remote command execution | Docker/SSH |
HTTPExecutor | HTTP requests | Built-in |
LLMExecutor | LLM API calls | Built-in |
FragmentStepExecutor | Inline fragment execution | Dispatcher |
Template Engine
The template engine provides{{variable}} interpolation:
Function Runtime
Functions are executed via the Goja JavaScript runtime with VM pooling:Database Schema
Scheduler
The scheduler manages automated workflow triggers:Decision Routing
Steps support conditional branching using switch/case syntax:goto: _end to terminate the workflow.
Plugin Registry Pattern
Step executors are registered in a plugin registry for extensibility:Configuration
Configuration is loaded from~/osmedeus-base/osm-settings.yaml:
Adding New Features
New Step Type
-
Add constant in
internal/core/types.go: -
Create executor implementing
StepExecutorininternal/executor/: -
Register in
dispatcher.go:
New Runner
-
Implement Runner interface in
internal/runner/: - Add type constant and register in runner factory.
New Utility Function
-
Add Go implementation in
internal/functions/: -
Add constant in
constants.go: -
Register in
goja_runtime.go:
New CLI Command
-
Create in
pkg/cli/: -
Add to
rootCmdininit().
New API Endpoint
-
Add handler in
pkg/server/handlers/: -
Register route in
server.go. -
Document in
docs/api/.