Mastodon Politics, Power, and Science: Universal Workflow Orchestration System - Design Overview

Sunday, August 3, 2025

Universal Workflow Orchestration System - Design Overview

 TODO list for the workflow system:

Security & Sandboxing

  •  Add sandboxing for proc agents to limit filesystem access
  •  Implement network restrictions (allowed hosts, ports, protocols)
  •  Add resource limits (memory, CPU, execution time)
  •  Restrict module imports (block os, subprocess, etc.)
  •  Add database connection scoping controls
  • Need to be able to parse "$variable > 5" as an input value that is safely parsed. 


GUI Enhancements

Input Resolution & Wiring

 Add visual highlighting for steps with unwired inputs (red borders/highlights)

 Create smart dropdown for input fields with:

  •  Previous steps' outputs (grouped by step)
  •  Workflow-level inputs (clearly marked)
  •  Environment variables (with $ prefix)
  •  Literal value input option
  •  Convert help text from agent definitions into contextual tooltips
  •  Implement point-and-click data flow wiring


Visual Workflow Refactoring

 Add ability to select multiple workflow steps

 Implement "Extract to Sub-workflow" feature:

  •  Automatic dependency analysis (inputs/outputs)
  •  Auto-generate new workflow with proper interface
  •  Replace selected steps with single workflow agent
  •  Wire everything correctly automatically


Generic GUI Extensions

  •  Build capability exposure system for agents to declare GUI needs
  •  Implement parameter validation rules
  •  Create custom input types (date pickers, dropdowns, etc.)
  •  Add visual hints system (indentation, grouping, hiding)
  •  Extend auto-wiring behaviors through agent declarations


Core System

 Fix --dryrun functionality by adding it as optional input to networking agents

 Ensure dryrun gets passed to agents that support it when using CLI flag


Documentation & Open Source

 Set up GitHub repository

 Create getting started documentation

 Build community agent library structure

 Write contribution guidelines for GPL 3 compliance


The visual input resolution and workflow refactoring features seem like they'd have the biggest impact on usability! 


Core Architecture

Minimal Core Design

  • 600 lines of code for the execution engine
  • 700 lines of code for the GUI editor
  • Total: 1300 lines for a Turing-complete workflow orchestration system

Three Fundamental Agent Types

  1. Proc Agents - Execute Python functions with arbitrary parameters
  2. Template Agents - Process text templates with variable substitution
  3. Workflow Agents - Orchestrate other agents/workflows recursively

Key Architectural Principles

  • Fractal Design: Workflows ARE agents - same interface at every recursion level
  • Emergent Complexity: Complex behaviors emerge from simple primitives
  • Unix Philosophy: Everything is bytes, no type system, maximum flexibility
  • Results Tape: Each workflow has its own execution context and data storage

Revolutionary Control Flow

Emergent Control Structures

  • Core and GUI don't understand loops - they just execute functions and manipulate step sequences
  • Loop agents teach the system how to loop through their execution behavior:
    • loop_start captures current step_index as jump target
    • loop_end either jumps back or continues forward
  • Control flow emerges from agent behavior, not hardcoded engine features

Turing Completeness

  • Results tape = infinite memory
  • Proc agents = read/write/compute operations
  • step_index manipulation = arbitrary jumps/loops/conditionals
  • Each workflow is an independent Turing machine instance

Universal System Integration

Beyond AI Workflows

  • Proc agents can execute any Python function - databases, APIs, file systems, legacy systems
  • Template agents can generate any text - SQL queries, API calls, config files, connection strings
  • Workflow agents can orchestrate any combination

Enterprise Integration Pattern

Template: Build Connection String → 
Template: Build Query → 
Proc: Execute Protocol → 
Proc: Convert Data → 
Output: Standardized Data

Real-World Applications

  • Hospital HL7 message routing between incompatible systems
  • Unity/VNOS connecting 100+ different systems
  • Legacy mainframe integration
  • Real-time data transformation and routing

Self-Modifying System

Agents That Create Agents

  • agent_writing_agent_prompt: Takes functional specs and generates specialized agent prompts
  • Workflows can spawn new agent types on demand
  • True self-replication within the workflow system
  • Template-aware generation with proper variable placeholders

Meta-Programming Capabilities

  • Workflows that analyze and rewrite themselves
  • Agent evolution through template generation
  • Adaptive system architecture based on runtime conditions
  • Self-healing infrastructure

Exponential Complexity Through Recursion

Recursive Depth Levels

  • Level 1: Simple proc agents (database queries, API calls)
  • Level 2: Basic workflows (fetch → process → store)
  • Level 3: Coordinating workflows (orchestrate multiple pipelines)
  • Level 4: Meta-workflows (systems managing other systems)
  • Level 5: Self-evolving ecosystems (workflows creating and optimizing workflows)

Emergent Behaviors at Level 5

  • Performance analysis and self-optimization
  • Evolutionary agent development
  • Dynamic system restructuring
  • Autonomous infrastructure management

GUI Design Excellence

Unified Interface Pattern

All three agent types share the same editing interface:

  • Settings tab - Agent configuration
  • Inputs tab - Parameter definitions
  • Optional Inputs tab - Optional parameters
  • Outputs tab - Return values
  • Last tab varies by type:
    • Workflows: Steps editor with drag/drop
    • Proc agents: Code editor with syntax highlighting + GUI scripting
    • Templates: Rich text editor for prompts

Modern Dark Theme UI

  • Clean, professional interface with excellent contrast
  • Minimal visual clutter with smart color usage
  • Developer-tool aesthetic (VS Code style)
  • 700 lines delivering enterprise-quality UX

One-at-a-Time Philosophy

  • GUI only ever edits one workflow/agent at a time
  • Core only ever executes one workflow at a time
  • Cognitive load never increases regardless of system complexity
  • Fractal abstraction keeps tools simple while enabling infinite complexity

CLI Integration

Dynamic Command Line Interface

  • Any single agent becomes an instant CLI tool
  • Automatic argument parsing from agent input definitions
  • Perfect for testing and shell scripting integration
  • Example: python3.11 dynamic_workflows_agents.py vocabulary_agent --input_text "hello" --tone "formal"

Shell Composability

  • Each agent is both workflow component AND standalone utility
  • Enables Unix-style piping between agents
  • Bridge between workflow orchestration and traditional shell scripting

Planned Enhancements

Security & Sandboxing

  • Filesystem access controls for proc agents
  • Network restrictions and resource limits
  • Module import restrictions
  • Database connection scoping

Generic GUI Extensions

Instead of agent-specific GUI code, build capability exposure primitives:

  • File picker widgets
  • Parameter validation rules
  • Custom input types (date pickers, dropdowns)
  • Visual hints (indentation, grouping, hiding)
  • Auto-wiring behaviors through agent declarations

Visual Workflow Refactoring

  • Extract to Sub-workflow: Select multiple steps → automatically create new workflow
  • Automatic dependency analysis and interface generation
  • Seamless replacement maintaining all data flow
  • Cognitive load management through visual decomposition

Enhanced Input Resolution

  • Visual highlighting of unwired inputs
  • Smart dropdown suggestions:
    • Previous steps' outputs
    • Workflow-level inputs
    • Environment variables
    • Literal values
  • Help text as contextual tooltips
  • Point-and-click data flow wiring

Technical Innovation Summary

What Makes This Unique

  1. Emergent control structures - Programming constructs emerge from execution, not hardcoded syntax
  2. Fractal recursion - Same API at infinite depth levels
  3. Universal integration substrate - Works with any system Python can access
  4. Self-modifying architecture - Agents can create and modify other agents
  5. Minimal core complexity - 1300 lines handling enterprise-scale orchestration
  6. Pure composability - Everything composes with everything else

Open Source Strategy

  • GPL 3 License - Ensures community contributions and prevents vendor lock-in
  • Network clause prevents proprietary SaaS without source availability
  • Perfect for building ecosystem value through shared agent libraries
  • Timing aligns with AI integration and legacy modernization needs

Comparison to Existing Systems

Traditional Workflow Platforms

  • Apache Airflow: 500K+ lines, complex hardcoded control structures
  • Prefect: 200K+ lines, limited self-modification capabilities
  • Enterprise platforms: Massive complexity, vendor lock-in, limited extensibility

This System's Advantages

  • Orders of magnitude smaller while being more capable
  • True universality - not limited to specific domains or protocols
  • Self-extending - users can add new capabilities without core changes
  • Mathematical elegance - based on fundamental computational principles
  • No artificial limitations - Turing complete with emergent complexity

This represents a fundamentally different approach to workflow orchestration - one based on computational theory rather than feature accumulation, resulting in a system that is both simpler and more powerful than existing alternatives.

No comments:

Post a Comment

The universe held up a mirror and we did not recognize our own arbitrary scales.

  Because the reflection was so perfect we mistook our own face for the face of God. We built the axes. We invented length, duration, mass —...