Skip to content

Rawkeep/workflow-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WorkflowEngine — Universal Autonomous Workflow System

Learn. Suggest. Automate. A self-learning workflow engine that observes your work, recognizes patterns, and progressively automates routine tasks — starting with end-to-end global export operations.

Architecture

┌──────────────────────────────────────────────────────┐
│            UNIVERSAL WORKFLOW ENGINE                  │
│  (Pattern Learning · Intent Routing · Autonomy)      │
├──────────────────────────────────────────────────────┤
│              EXPORT DOMAIN LAYER                     │
│  (Orders · Documents · Compliance · Incoterms)       │
├──────────────────────────────────────────────────────┤
│             COUNTRY RULE PLUGINS                     │
│  (54 Africa + EU + Asia + Americas)                  │
└──────────────────────────────────────────────────────┘

Maturity Model

Level Mode Description
1 Observer Logs every action, builds event history
2 Advisor Detects patterns, suggests next steps
3 Semi-Auto Prepares & executes with approval
4 Autonomous Runs routine workflows, humans handle exceptions

Quick Start

# Clone & setup
git clone https://github.com/your-org/workflow-engine.git
cd workflow-engine
chmod +x scripts/setup.sh
./scripts/setup.sh

# Run
python -m api.main

Project Structure

workflow-engine/
├── core/                    # Universal workflow engine
│   ├── engine.py            # Main orchestrator
│   ├── router.py            # Intent classification & routing
│   ├── models.py            # Base data models
│   ├── observer.py          # Action logging & event capture
│   ├── autonomy.py          # Autonomy level management
│   └── scheduler.py         # Step scheduling & dependency resolution
├── domain/
│   └── export/              # Export-specific domain logic
│       ├── models.py        # ExportOrder, Document, Shipment
│       ├── workflows.py     # Standard export workflow templates
│       ├── documents.py     # Document generation engine
│       ├── compliance.py    # Sanctions, restrictions, validations
│       ├── incoterms.py     # Incoterm rules & obligations
│       ├── dangerous_goods.py # IATA DGR / IMO IMDG logic
│       └── transport.py     # Sea/Air/Road transport logic
├── plugins/
│   └── countries/           # Country-specific rule plugins
│       ├── base.py          # CountryPlugin base class
│       ├── registry.py      # Plugin loader & registry
│       ├── ng.py            # Nigeria
│       ├── cm.py            # Cameroon
│       ├── eg.py            # Egypt
│       ├── gh.py            # Ghana
│       ├── ke.py            # Kenya
│       ├── za.py            # South Africa
│       ├── tg.py            # Togo
│       ├── sn.py            # Senegal
│       ├── ci.py            # Côte d'Ivoire
│       ├── tz.py            # Tanzania
│       ├── ma.py            # Morocco
│       ├── dz.py            # Algeria
│       ├── et.py            # Ethiopia
│       ├── de_export.py     # Germany (export side)
│       └── generic.py       # Fallback for uncovered countries
├── learning/                # ML & pattern recognition
│   ├── pattern_detector.py  # Sequence mining & pattern extraction
│   ├── workflow_learner.py  # Learns from completed workflows
│   ├── feedback_loop.py     # Approval/rejection tracking
│   └── predictor.py         # Next-step prediction
├── storage/                 # Persistence layer
│   ├── event_store.py       # Event sourcing
│   ├── pattern_store.py     # Learned patterns
│   └── vector_store.py      # ChromaDB integration
├── api/                     # FastAPI REST interface
│   ├── main.py              # App entry point
│   ├── routes/
│   │   ├── orders.py        # Export order endpoints
│   │   ├── workflows.py     # Workflow management
│   │   ├── plugins.py       # Country plugin info
│   │   ├── learning.py      # Learning & pattern endpoints
│   │   └── dashboard.py     # Dashboard data endpoints
│   └── middleware.py        # Auth, logging, CORS
├── config/
│   ├── settings.py          # Global settings
│   └── constants.py         # Enums, static data
├── scripts/
│   ├── setup.sh             # One-click setup
│   └── seed_data.py         # Seed sample data
├── tests/                   # Test suite
│   ├── test_engine.py
│   ├── test_plugins.py
│   └── test_workflows.py
└── requirements.txt

Country Coverage

Africa (54 countries)

Full plugin support with ECTN/BESC, SONCAP, PVoC, CargoX eBL, and country-specific compliance matrices.

Europe (Export Side)

Germany (ATLAS/GTS), with extensible plugins for other EU origins.

Worldwide

Generic plugin handles basic export requirements. Add specific plugins as needed.

Key Concepts

NEVER_AUTO Actions

These always require human approval:

  • Financial transactions (bank documents, LC)
  • Customs submissions (ATLAS, destination customs)
  • Sanctions-related decisions
  • Payment releases

Country Plugins

Each country is a single Python file implementing CountryPlugin. Adding a new country = adding one file. No engine changes needed.

Workflow Learning

The system logs every action sequence from completed exports. After observing enough repetitions (configurable, default: 5), it builds predictive models for similar future orders.

License

MIT

About

Workflow Engine — Intelligent Task Orchestration & Automation Framework with Plugin System, Learning Module & REST API (Python)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors