🧠 Rust Logic Graph
Reasoning Engine for Distributed Backend & AI Orchestration
A high-performance reasoning engine for distributed backend systems and AI orchestration. Build complex decision workflows, coordinate multiple services, and create intelligent agent systems with GRL (Grule Rule Language) support.
Not a no-code automation tool - Rust Logic Graph is an embeddable library for developers building distributed reasoning systems, not a UI-first workflow platform like n8n or Zapier.
🎯 What is Rust Logic Graph?
Rust Logic Graph is a reasoning engine library for building intelligent backend systems:
Core Capabilities
🧠 Distributed Reasoning
- Connect decisions across multiple databases and services
- Build complex decision trees with business rules (GRL)
- Maintain context as data flows through your system
- Explain how decisions were reached
🤖 AI Agent Orchestration
- Coordinate multiple LLMs in reasoning chains
- Build RAG (Retrieval-Augmented Generation) pipelines
- Create multi-agent systems with tool calling
- Native support for OpenAI, Claude, Ollama, and custom models
⚡ High-Performance Execution
- Sub-millisecond latency (embedded library, not service)
- Automatic parallel execution of independent operations
- Memory-efficient context pooling
- Async/await throughout
🔧 Production-Ready Patterns
- Circuit breakers for unstable services
- Retry logic with exponential backoff
- Try/catch error handling
- Saga pattern for distributed transactions
Example Use Cases
// Financial risk assessment across multiple data sources
let risk_engine = new
.add_node
.add_node
.add_node
.add_node
.add_node;
// Multi-step AI reasoning with tool calling
let ai_agent = new
.add_node
.add_node
.add_node
.add_node
.add_retry;
// Microservice coordination with fault tolerance
let order_flow = new
.add_node
.add_node
.add_node
.add_circuit_breaker
.add_saga_compensation;
✨ Key Features
- 🔥 GRL Support - rust-rule-engine v0.17
- 🔄 Topological Execution - Automatic DAG-based node ordering
- ⚡ Async Runtime - Built on Tokio for high concurrency
- ⚡ Parallel Execution - Automatic parallel execution of independent nodes (v0.5.0)
- �️ Multi-Database Orchestration - Parallel queries, correlation, distributed transactions (v0.10.0) 🆕
- �💾 Caching Layer - High-performance result caching with TTL, eviction policies, and memory limits (v0.5.0)
- 🧠 Memory Optimization - Context pooling and allocation tracking (v0.7.0)
- 🛠️ CLI Developer Tools - Graph validation, dry-run, profiling, and visualization (v0.5.0)
- 🎨 Web Graph Editor - Next.js visual editor with drag-and-drop interface (v0.8.0)
- 📋 YAML Configuration - Declarative graph definitions with external config files (v0.8.5)
- 🎯 Advanced Control Flow - Subgraphs, conditionals, loops, error handling (v0.9.0)
- 🚨 Rich Error Messages - Unique error codes, actionable suggestions, full context (v0.10.0) 🆕
- 📊 Multiple Node Types - RuleNode, DBNode, AINode, ConditionalNode, LoopNode, TryCatchNode, RetryNode, CircuitBreakerNode
- 📝 JSON/YAML Configuration - Simple workflow definitions
- 🎯 98% Drools Compatible - Easy migration from Java
- 🌊 Streaming Processing - Stream-based execution with backpressure (v0.3.0)
- 🗄️ Database Integrations - PostgreSQL, MySQL, Redis, MongoDB (v0.2.0)
- 🤖 AI/LLM Integrations - OpenAI, Claude, Ollama (v0.2.0)
🚀 Quick Start
Installation
[]
= "0.10.1"
# With specific integrations
= { = "0.10.1", = ["postgres", "openai"] }
# With all integrations
= { = "0.10.1", = ["all-integrations"] }
🏢 Real-World Case Study: Purchasing Flow System
Complete production implementation: case_study/ - Purchasing automation with two architectures (Monolithic vs Microservices).
Problem: Automate purchasing decisions across products, warehouses, suppliers.
Solution: 15 GRL business rules + rust-logic-graph orchestration.
Architecture Comparison
| Monolithic | Microservices | |
|---|---|---|
| Performance | ~10ms (in-process) | ~56ms (gRPC overhead) |
| Resources | 50MB RAM, 1 CPU | 500MB RAM, 7 containers |
| Best For | <1K req/min, small teams (1-5 devs) | >10K req/min, large teams (15+ devs) |
| Deployment | Single binary | Docker Compose / Kubernetes |
| Scaling | Vertical only | Horizontal scaling |
| Complexity | Simple | Distributed tracing required |
Quick Start
Monolithic (single HTTP service, 4 PostgreSQL DBs):
&&
Microservices (7 gRPC services):
&&
Key Features
✅ Same Business Logic - 15 GRL rules shared across both architectures
✅ YAML Configuration - Change workflows without recompilation
✅ Multi-Database (Monolithic) - 4 separate PostgreSQL databases
✅ Dynamic Field Mapping - Zero hardcoded field names
✅ Graph Executor Pattern - Declarative node topology
Architecture Diagrams
Microservices Communication Flow:
┌─────────────────────────────────────────────────────────────────────┐
│ CLIENT (HTTP REST) │
└────────────────────────────────┬────────────────────────────────────┘
│ POST /api/purchasing/flow
▼
┌────────────────────────────────────────────────────────────┐
│ Orchestrator Service (Port 8080) - main.rs │
│ │
│ HTTP Endpoint → OrchestratorGraphExecutor │
│ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ rust-logic-graph Graph Executor │ │
│ │ (graph_executor.rs) │ │
│ │ │ │
│ │ Creates Graph with 6 Custom gRPC Nodes: │ │
│ │ ┌────────────────────────────────────────────────┐ │ │
│ │ │ OmsGrpcNode │ │ │
│ │ │ • impl Node trait from rust-logic-graph │ │ │
│ │ │ • async fn run() → gRPC call to :50051 │ │ │
│ │ │ • Returns JSON to Context │ │ │
│ │ └────────────────────────────────────────────────┘ │ │
│ │ ┌────────────────────────────────────────────────┐ │ │
│ │ │ InventoryGrpcNode → gRPC :50052 │ │ │
│ │ │ SupplierGrpcNode → gRPC :50053 │ │ │
│ │ │ UomGrpcNode → gRPC :50054 │ │ │
│ │ │ RuleEngineGrpcNode → gRPC :50056 │ │ │
│ │ │ PoGrpcNode → gRPC :50055 │ │ │
│ │ └────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ Graph Topology (hardcoded in graph_executor.rs): │ │
│ │ OMS ───────┐ │ │
│ │ Inventory ─┼─→ RuleEngine ──→ PO │ │
│ │ Supplier ──┤ │ │
│ │ UOM ───────┘ │ │
│ │ │ │
│ │ Executor runs in topological order │ │
│ └──────────────────────────────────────────────────────┘ │
└────────┬───────────────────────────────────────────────────┘
│
┌─────────────┼──────────────────┬────────────────┬──────────────┐
│ (Parallel) │ (Parallel) │ (Parallel) │ (Parallel) │
▼ ▼ ▼ ▼ │
┌──────────┐ ┌────────────┐ ┌─────────────┐ ┌───────────┐ │
│OMS :50051│ │Inventory │ │Supplier │ │UOM :50054 │ │
│ (gRPC) │ │:50052 │ │:50053 │ │ (gRPC) │ │
│ │ │ (gRPC) │ │ (gRPC) │ │ │ │
│• History │ │• Levels │ │• Pricing │ │• Convert │ │
│• Demand │ │• Available │ │• Lead Time │ │• Factors │ │
│ │ │ │ │• MOQ │ │ │ │
└────┬─────┘ └─────┬──────┘ └──────┬──────┘ └─────┬─────┘ │
│ │ │ │ │
└──────────────┴────────────────┴───────────────┘ │
│ │
│ Data stored in Graph Context │
▼ │
┌─────────────────┐ │
│ Rule Engine │ (Port 50056 - gRPC) │
│ :50056 │ │
│ (gRPC) │ │
│ │ │
│ • Loads GRL │ • Evaluates 15 rules │
│ rules from │ • Returns decision flags │
│ .grl file │ • NO side effects │
│ • Pure function │ • Calculations + flags │
└────────┬────────┘ │
│ │
│ Flags stored in Graph Context │
▼ │
┌─────────────────┐ │
│ PO Service │ (Port 50055 - gRPC) │
│ :50055 │◄─────────────────────────────┘
│ (gRPC) │
│ │
│ • Create PO │ • Reads flags from context
│ • Send to │ • Executes based on rules
│ Supplier │ • Email/API delivery
└─────────────────┘
Monolithic Clean Architecture:
┌─────────────────────────────────────────────────────────────────────────┐
│ HTTP REST API (Port 8080) │
│ POST /purchasing/flow {product_id} │
└──────────────────────────────────┬──────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────────┐
│ PurchasingGraphExecutor (executors/graph_executor.rs) │
│ (Clean Architecture) │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ rust-logic-graph Graph/Executor Engine │ │
│ │ │ │
│ │ execute_with_config(product_id, "purchasing_flow.yaml") │ │
│ │ │ │
│ │ 1. GraphConfig::from_yaml_file("purchasing_flow.yaml") │ │
│ │ 2. Parse nodes + edges + field_mappings │ │
│ │ 3. For each node in YAML: │ │
│ │ • Create DynamicDBNode (with database routing) │ │
│ │ • Create DynamicRuleNode (with field_mappings) │ │
│ │ 4. Register all nodes to Executor │ │
│ │ 5. Execute graph in topological order │ │
│ │ │ │
│ │ Graph Topology (from YAML): │ │
│ │ oms_history ────────┐ │ │
│ │ inventory_levels ───┼──→ rule_engine ──→ create_po │ │
│ │ supplier_info ──────┤ │ │
│ │ uom_conversion ─────┘ │ │
│ └─────────────────────────────────────────────────────────┘ │
└──────────────┬────────────────────────────────────────────────┘
│
┌──────────────────┼──────────────────┬──────────────────┬───────────┐
│ (Parallel DBs) │ (Parallel DBs) │ (Parallel DBs) │ (Parallel)│
▼ ▼ ▼ ▼ │
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ oms_db │ │ inventory_db │ │ supplier_db │ │ uom_db │ │
│ PostgreSQL │ │ PostgreSQL │ │ PostgreSQL │ │ PostgreSQL │ │
│ :5433 │ │ :5434 │ │ :5435 │ │ :5436 │ │
│ │ │ │ │ │ │ │ │
│ • history │ │ • levels │ │ • info │ │ • conversion │ │
│ • demand │ │ • available │ │ • pricing │ │ • factors │ │
│ • trends │ │ • reserved │ │ • lead_time │ │ │ │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
│ │ │ │ │
│ DynamicDBNode │ DynamicDBNode │ DynamicDBNode │ Dynamic │
│ database:"oms" │ database:"inv" │ database:"sup" │ DB Node │
└─────────────────┴─────────────────┴─────────────────┴───────────┘
│
Data stored in Graph Context
with path notation (e.g., "oms_history.avg_daily_demand")
│
▼
┌──────────────────────────────────────────┐
│ DynamicRuleNode (rule_engine) │
│ │
│ YAML field_mappings config: │
│ ┌────────────────────────────────────┐ │
│ │ avg_daily_demand: │ │
│ │ "oms_history.avg_daily_demand" │ │
│ │ available_qty: │ │
│ │ "inventory_levels.available_qty" │ │
│ │ lead_time: │ │
│ │ "supplier_info.lead_time" │ │
│ │ ... (9 total mappings) │ │
│ └────────────────────────────────────┘ │
│ │
│ extract_rule_inputs() loop: │
│ • Reads field_mappings from YAML │
│ • Uses get_value_by_path() for parsing │
│ • Returns HashMap<String, Value> │
│ • ZERO hardcoded field names! │
└──────────────┬───────────────────────────┘
│
▼
┌──────────────────────────────────────────┐
│ RuleEngineService (In-Process) │
│ │
│ evaluate(HashMap<String, Value>) │
│ │
│ • Loads purchasing_rules.grl │
│ • 15 business rules (GRL) │
│ • Accepts dynamic HashMap input │
│ • No struct, no hardcoded fields │
│ • Pure functional evaluation │
│ │
│ Rules calculate: │
│ ✓ shortage = required_qty - available │
│ ✓ order_qty (respects MOQ) │
│ ✓ total_amount with discounts │
│ ✓ requires_approval flag │
│ ✓ should_create_po flag │
└──────────────┬───────────────────────────┘
│
Decision flags returned to Context
│
▼
┌──────────────────────────────────────────┐
│ DynamicRuleNode (create_po) │
│ │
│ YAML field_mappings config: │
│ ┌────────────────────────────────────┐ │
│ │ should_order: │ │
│ │ "rule_engine.should_order" │ │
│ │ recommended_qty: │ │
│ │ "rule_engine.recommended_qty" │ │
│ │ product_id: │ │
│ │ "supplier_info.product_id" │ │
│ │ ... (6 total mappings) │ │
│ └────────────────────────────────────┘ │
│ │
│ • Reads rule_engine output from context │
│ • Dynamic field extraction via YAML │
│ • Creates PO if should_order == true │
│ • Returns PO JSON or null │
└──────────────────────────────────────────┘
Documentation: Case Study Docs • YAML Config Guide
Web Graph Editor (NEW in v0.8.0)
🌐 Online Editor: https://logic-graph-editor.amalthea.cloud/
Try the visual graph editor online - no installation required! Create workflows, define rules, and visualize your logic graphs with drag-and-drop.
CLI Tools (v0.5.0)
# Build the CLI tool
# Validate a graph
# Visualize graph structure
# Profile performance
# Dry-run without execution
Run Examples
# Basic workflow
# GRL rules
# Advanced integration
Advanced Control Flow Usage (v0.9.0) 🆕
Conditional Branching
Route execution based on conditions:
use ;
let mut graph = new;
// Add nodes
graph.add_node;
graph.add_node;
graph.add_node;
// Add conditional routing
graph.add_node;
graph.add_edge;
graph.add_edge;
graph.add_edge;
// Execute
let result = graph.execute.await?;
Loops
Iterate over collections or use while loops:
// Foreach loop over products
graph.add_node;
// While loop with condition
graph.add_node;
Error Handling
Try/catch patterns for resilient workflows:
graph.add_node;
Retry Logic
Exponential backoff for transient failures:
graph.add_node;
Circuit Breaker
Fault tolerance for unstable services:
graph.add_node;
Subgraphs
Nested graph execution with input/output mapping:
graph.add_node;
See examples/ for complete working examples.
📚 Documentation
| Document | Description |
|---|---|
| �🏢 Case Study: Purchasing Flow | Real production system with microservices & monolithic implementations |
| 📋 YAML Configuration Guide | Declarative graph configuration with YAML (NEW in v0.8.5) |
| Graph Editor Guide | Visual web-based graph editor with Next.js (NEW in v0.8.0) |
| Memory Optimization Guide | Context pooling and allocation tracking (v0.7.0) |
| CLI Tool Guide | Developer tools for validation, profiling, and visualization (v0.5.0) |
| Cache Guide | Caching layer with TTL and eviction policies (v0.5.0) |
| Migration Guide | Upgrade guide to v0.14.0 with RETE-UL (v0.5.0) |
| Integrations Guide | Database & AI integrations (v0.2.0) |
| GRL Guide | Complete GRL syntax and examples |
| Use Cases | 33+ real-world applications |
| Extending | Create custom nodes and integrations |
| Implementation | Technical details |
🎯 Use Cases
Rust Logic Graph powers applications in:
- 💰 Finance - Loan approval, fraud detection, risk assessment
- 🛒 E-commerce - Dynamic pricing, recommendations, fulfillment
- 🏥 Healthcare - Patient triage, clinical decisions, monitoring
- 🏭 Manufacturing - Predictive maintenance, QC automation
- 🛡️ Insurance - Claims processing, underwriting
- 📊 Marketing - Lead scoring, campaign optimization
- ⚖️ Compliance - AML monitoring, GDPR automation
🏗️ Architecture Patterns
Pattern 1: Multi-Database Reasoning
Query multiple databases, apply business rules, make decisions:
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ PostgreSQL │───▶│ MongoDB │───▶│ Redis │
│ (Users) │ │ (Analytics) │ │ (Cache) │
└─────────────┘ └─────────────┘ └─────────────┘
│ │ │
└───────────────────┴───────────────────┘
│
┌───────▼───────┐
│ Rule Engine │◀─── GRL Rules
│ (Decision) │
└───────┬───────┘
│
┌───────▼───────┐
│ Actions │
└───────────────┘
Pattern 2: AI Agent with Tools
LLM orchestration with tool calling and validation:
┌─────────────┐
│ User Query │
└──────┬──────┘
│
┌──────▼──────────┐
│ LLM (Claude) │──────┐
│ Understand │ │
└──────┬──────────┘ │
│ Tool Calls
┌──────▼──────────┐ │
│ RAG Subgraph │◀─────┤
│ (Vector Search) │ │
└──────┬──────────┘ │
│ ┌───▼──────┐
┌──────▼──────────┐ │ Database │
│ LLM (GPT-4) │◀─┤ Query │
│ Reason │ └──────────┘
└──────┬──────────┘
│
┌──────▼──────────┐
│ Validate (GRL) │
│ Business Rules │
└──────┬──────────┘
│
┌──────▼──────────┐
│ Response │
└─────────────────┘
Pattern 3: Saga Pattern for Distributed Transactions
Coordinate microservices with compensation logic:
Order Service ──▶ Inventory Service ──▶ Payment Service ──▶ Shipping Service
│ │ │ │
Success Success Success Success
│ │ │ │
└───────────────────┴────────────────────┴────────────────────┘
│
┌──────▼──────┐
│ Complete │
└─────────────┘
If Payment Fails:
│ │ ✗
│ │ Compensation
│ │◀───────────────────┘
│ Release Inventory
│◀──────────────────┘
Cancel Order
View 6 complete architecture patterns →
🏗️ System Architecture

🔥 GRL Example
rule "HighValueLoan" salience 100 {
when
loan_amount > 100000 &&
credit_score < 750
then
requires_manual_review = true;
approval_tier = "senior";
}
rule "AutoApproval" salience 50 {
when
credit_score >= 700 &&
income >= loan_amount * 3 &&
debt_ratio < 0.4
then
auto_approve = true;
interest_rate = 3.5;
}
📊 Performance
- RETE-UL Algorithm: Advanced pattern matching with unlinking (v0.14.0)
- 2-24x Faster: Than v0.10 at 50+ rules
- 98% Drools Compatible: Easy migration path
- Async by Default: High concurrency support
- Parallel Execution: Automatic layer-based parallelism
- Smart Caching: Result caching with TTL and eviction policies
🧪 Testing & CLI Tools
# Run all tests
# Build CLI tool
# Validate graph
# Visualize graph structure
# Profile performance
# Dry-run execution
Test Results: ✅ 32/32 tests passing
📦 Project Status
Version: 0.10.1 (Latest) Status: Production-ready with YAML-driven multi-database orchestration
What's Working
- ✅ Core graph execution engine
- ✅ RETE-UL algorithm (v0.14.0) - 2-24x faster
- ✅ Three node types (Rule, DB, AI)
- ✅ Topological sorting
- ✅ Async execution
- ✅ JSON I/O
- ✅ Database integrations (PostgreSQL, MySQL, Redis, MongoDB)
- ✅ AI integrations (OpenAI, Claude, Ollama)
- ✅ Streaming processing with backpressure and chunking
- ✅ Parallel execution with automatic layer detection
- ✅ Caching layer with TTL, eviction policies, memory limits (v0.5.0)
- ✅ Memory optimization with context pooling (v0.7.0)
- ✅ CLI Developer Tools - validate, profile, visualize, dry-run (v0.5.0)
- ✅ Web Graph Editor - Next.js visual editor with drag-and-drop (v0.8.0)
- ✅ Production Case Study - Purchasing flow with microservices & monolithic (v0.8.0)
- ✅ YAML Configuration - Declarative graph definitions (v0.8.5)
- ✅ Stream operators (map, filter, fold)
- ✅ Comprehensive documentation
Roadmap
- Streaming processing (v0.3.0) - COMPLETED ✅
- Parallel node execution (v0.4.0) - COMPLETED ✅
- Caching layer (v0.5.0) - COMPLETED ✅
- CLI Developer Tools (v0.5.0) - COMPLETED ✅
- RETE-UL upgrade (v0.5.0) - COMPLETED ✅
- Memory Optimization (v0.7.0) - COMPLETED ✅
- Web Graph Editor (v0.8.0) - COMPLETED ✅
- Production Case Study (v0.8.0) - COMPLETED ✅
- YAML Configuration (v0.8.5) - COMPLETED ✅
- GraphQL API (v0.9.0)
- Production release (v1.0.0)
See ROADMAP.md for details
🤝 Contributing
Contributions welcome! Please:
- Fork the repository
- Create your feature branch
- Write tests for new features
- Submit a pull request
📖 Examples
Core Examples
| Example | Description | Lines |
|---|---|---|
simple_flow.rs |
Basic 3-node pipeline | 36 |
advanced_flow.rs |
Complex 6-node workflow | 120 |
grl_rules.rs |
GRL rule examples | 110 |
grl_graph_flow.rs |
GRL + Graph integration | 140 |
postgres_flow.rs |
PostgreSQL integration | 100 |
openai_flow.rs |
OpenAI GPT integration | 150 |
streaming_flow.rs |
Streaming with backpressure | 200 |
parallel_execution.rs |
Parallel node execution | 250 |
Advanced Control Flow Examples (v0.9.0) 🆕
| Example | Description | Features Demonstrated |
|---|---|---|
conditional_flow.rs |
If/else routing based on conditions | ConditionalNode, branch selection |
loop_flow.rs |
Foreach and while loop patterns | LoopNode, iteration over arrays |
retry_flow.rs |
Exponential backoff retry logic | RetryNode, configurable attempts |
error_handling_flow.rs |
Try/catch/finally patterns | TryCatchNode, error recovery |
circuit_breaker_flow.rs |
Circuit breaker fault tolerance | CircuitBreakerNode, failure thresholds |
subgraph_flow.rs |
Nested graph execution | SubgraphNode, input/output mapping |
Multi-Database Orchestration (v0.10.0) 🆕
| Example | Description | Features Demonstrated |
|---|---|---|
real_multi_db_orchestration.rs |
Query multiple databases in parallel with real data | ParallelDBExecutor, QueryCorrelator, DistributedTransaction |
Demo 1: Parallel Queries - Execute queries across 4 databases concurrently
Demo 2: Query Correlation - JOIN results from different databases (Inner/Left/Right/Full)
Demo 3: Distributed Transactions - Two-Phase Commit (2PC) for atomic operations
use ;
// Execute queries in parallel across multiple databases
let mut executor = new;
executor
.add_query
.add_query;
let results = executor.execute_all.await?;
// Correlate results with SQL-like JOINs
let correlator = new;
let joined = correlator.join?;
Run examples:
# Conditional routing
# Loop over products
# Retry with backoff
# Error handling
# Circuit breaker
# Nested subgraphs
# Rich error messages (v0.10.0) 🆕
# Multi-database orchestration (v0.10.0) 🆕
Error Handling (v0.10.0) 🆕
Production-grade error messages with unique codes, actionable suggestions, and full context:
use ;
// Rich error with context
let err = database_connection_error.with_context;
// Output:
// [E002] Failed to connect to PostgreSQL
// Graph: order_processing
// Node: fetch_orders
// database: orders_db
//
// 💡 Suggestion: Verify database connection string, credentials,
// and network connectivity.
// 📖 Documentation: https://docs.rust-logic-graph.dev/errors/E002
// Automatic retry strategy
if err.is_retryable
12 Error Types: Node execution (E001), Database (E002), Rules (E003), Config (E004), Timeout (E005), Validation (E006), Serialization (E007), AI (E008), Cache (E009), Context (E010), Distributed (E011), Transaction (E012)
See docs/ERRORS.md for complete error reference
CLI Tool Examples (v0.5.0)
| File | Description |
|---|---|
examples/sample_graph.json |
Linear workflow with 5 nodes |
examples/cyclic_graph.json |
Graph with cycle for testing |
examples/sample_context.json |
Sample input data |
See CLI_TOOL.md for usage examples
🌟 What Makes Rust Logic Graph Unique?
🧠 Reasoning-First Architecture
Traditional workflow engines execute tasks. Rust Logic Graph reasons through decisions:
- Business Rule Engine - GRL integration for complex decision logic
- Context-Aware Execution - Decisions based on accumulated knowledge
- Multi-Step Reasoning - Chain decisions across multiple nodes
- Explainable Decisions - Trace how conclusions were reached
🌐 Built for Distributed Systems
Not a monolithic workflow runner - designed for microservices from day one:
- Multi-Database Orchestration - Query PostgreSQL, MySQL, MongoDB, Redis in one flow
- Service Coordination - Orchestrate gRPC, REST, and internal services
- Fault Tolerance - Circuit breakers, retries, saga patterns
- Distributed Context - Share state across services seamlessly
🤖 AI-Native Orchestration
LLMs are first-class citizens, not afterthoughts:
- Multi-Model Workflows - Combine OpenAI, Claude, Ollama in one reasoning chain
- RAG Pipeline Ready - Vector DB integration, embedding generation
- Agent Coordination - Build multi-agent systems with shared context
- Tool Calling Framework - LLMs can invoke graph nodes as tools
⚡ Performance Without Compromise
Embedded library architecture means zero network overhead:
- Sub-Millisecond Latency - Direct function calls, not HTTP
- Memory Efficient - Context pooling, zero-copy where possible
- Parallel by Default - Automatic detection of independent operations
- Async Everything - Built on Tokio for maximum concurrency
🔧 Developer Experience
Designed for developers who write code, not click buttons:
- Type-Safe - Rust's type system catches errors at compile time
- YAML + Code - Declarative when possible, programmatic when needed
- Embeddable - Library, not service - runs in your process
- Testable - Unit test your workflows like any other code
📝 Changelog
v0.10.1 (2025-11-22) - YAML-Driven Multi-Database Orchestration 🆕
New Features:
- 🗄️ YAML-Driven Query Execution - Eliminated code duplication
- Queries now loaded from
multi_db_graph.yamlconfiguration - Single source of truth for SQL queries
- Database pool registry pattern with
HashMap<String, PgPool> - Dynamic query execution from YAML node definitions
- Type-safe column aliases (
avg_daily_demand::FLOAT8 as avg_daily_demand)
- Queries now loaded from
Implementation:
// Load YAML configuration
let config = from_yaml_file?;
// Create database pool registry
let mut db_pools = new;
db_pools.insert;
db_pools.insert;
// Execute queries dynamically from YAML
let results = execute_yaml_queries.await?;
Performance:
- Same execution speed: 2-3ms for 4 parallel queries
- Zero runtime overhead from YAML loading
- Efficient HashMap lookups for pool routing
Documentation:
- Updated
examples/README.mdwith YAML-driven approach - Updated
multi_db_graph.yamlheader comments - Example:
examples/real_multi_db_orchestration.rs
Testing:
- ✅ All 72 tests passing (52 lib + 5 multi_db + 7 integration + 8 doc)
- Fixed doctest in
ParallelDBExecutor
Impact:
- 70% reduction in code duplication
- Easier to maintain and modify queries
- Production-ready declarative configuration
v0.10.0-alpha.1 (2025-11-22) - Rich Error Messages 🆕
New Features:
- 🚨 Production-Grade Error Handling - Comprehensive error system
- 12 predefined error types with unique codes (E001-E012)
- Error classification: Retryable, Permanent, Transient, Configuration
- Rich context propagation: node → graph → step → service → metadata
- Actionable suggestions for every error
- Automatic documentation links
- Source error chaining support
Error Types:
- E001: Node execution error
- E002: Database connection error
- E003: Rule evaluation error
- E004: Configuration error
- E005: Timeout error
- E006: Graph validation error
- E007: Serialization error
- E008: AI/LLM error
- E009: Cache error
- E010: Context error
- E011: Distributed system error
- E012: Transaction coordination error
API:
use ;
let err = database_connection_error
.with_context;
// Automatic retry strategy
if err.is_retryable
Documentation:
- Complete error reference:
docs/ERRORS.md(600+ lines) - Example:
examples/error_messages_demo.rs - Summary:
docs/BETTER_ERROR_MESSAGES_SUMMARY.md
Testing:
- 5 unit tests in
src/error/mod.rs - All tests passing (44/44 total)
Impact:
- 10x faster debugging with clear error messages
- Production-ready error handling
- Foundation for distributed systems (v0.10.0)
v0.8.9 (2025-11-22) - DBNode Parameters Feature
New Features:
- 🔧 DBNode Context Parameters - Dynamic query parameter extraction
- Extract SQL parameters from execution context
NodeConfig::db_node_with_params()for parameterized queries- Support for
$1,$2(PostgreSQL) and?(MySQL) placeholders - Automatic type conversion (String, Number, Boolean, Null)
- Graceful handling of missing parameters
- See DB Parameters Guide
API Additions:
// Create DBNode with context parameter extraction
db_node_with_params
// Set parameters in context
graph.context.set;
Configuration Support:
nodes:
fetch_user:
node_type: DBNode
query: "SELECT * FROM users WHERE user_id = $1"
params:
- user_id # Extract from context
Testing:
- 7 new integration tests in
tests/db_params_tests.rs - Single/multiple parameter extraction
- Missing parameter handling
- Type conversion tests
- JSON/YAML serialization tests
Documentation:
- Complete guide in
docs/DB_PARAMS.md - Example:
examples/db_params_flow.rs - JSON example:
examples/db_params_graph.json
Compatibility:
- Fully backward compatible
- Existing DBNodes work without changes
- Optional feature (params default to None)
v0.8.5 (2025-11-20) - YAML Configuration Release
New Features:
- 📋 YAML Configuration Support - Declarative graph definitions
- Load graph structure from YAML files instead of hardcoded
GraphConfigmodule for parsing YAML configurations- Support for both JSON and YAML formats
- 70% code reduction in graph executors
- See YAML Configuration Guide
- 🔧 Enhanced Graph Executor API
execute()- Use default configurationexecute_with_config(config_path)- Load custom YAML config- Dynamic node registration from config
- 📝 Multiple Workflow Support
- Standard flow (full process)
- Simplified flow (skip optional steps)
- Urgent flow (fast-track)
- Easy to create custom workflows
- 🏗️ Monolithic Clean Architecture (NEW)
- Multi-database architecture with 4 PostgreSQL databases
- Dynamic field mapping via YAML configuration
- Zero hardcoded field names in code
- Database routing per node via config
field_mappingsfor flexible data extractionRuleEngineServiceacceptsHashMap<String, Value>- Config-driven
DynamicDBNodeandDynamicRuleNode
- 📚 Comprehensive Documentation
- YAML configuration guide with examples
- Before/After comparison showing improvements
- Multiple workflow examples
- Integration guides for both architectures
- Clean architecture patterns documentation
Improvements:
- Monolithic and Microservices both support YAML configs
- Reduced boilerplate code by 70% in executors
- Better separation of concerns (config vs. code)
- Easier testing with multiple configurations
- No recompilation needed for workflow changes
- Complete flexibility in field naming and mapping
Examples:
# Monolithic with multi-database
nodes:
oms_history:
database: "oms_db"
query: "SELECT ..."
rule_engine:
field_mappings:
avg_daily_demand: "oms_history.avg_daily_demand"
// Dynamic field extraction (no hardcoding)
let inputs = self.extract_rule_inputs;
rule_service.evaluate?; // HashMap<String, Value>
Compatibility:
- All tests passing
- API backward compatible
- Existing hardcoded graphs still work
v0.8.0 (2025-11-20) - Web Editor & Production Case Study Release
New Features:
- 🎨 Web Graph Editor - Next.js visual editor with drag-and-drop
- Online version: https://logic-graph-editor.amalthea.cloud/
- React Flow-based graph visualization
- Real-time node editing and validation
- Export/import JSON workflows
- See Graph Editor Guide
- 🏢 Production Case Study - Complete purchasing flow system
- Microservices architecture (7 services with gRPC)
- Monolithic architecture (single HTTP service)
- 15 GRL business rules for purchasing decisions
- Kubernetes deployment manifests
- Docker Compose for local development
- Shared GRL rules proving portability
- See Case Study Documentation
Improvements:
- Updated README with case study section
- Added online graph editor link
- Comprehensive production examples
Compatibility:
- All tests passing
- API backward compatible
v0.5.0 (2025-11-06) - Performance & Developer Tools Release
Breaking Changes:
- ⚡ Upgraded rust-rule-engine from v0.10 → v0.14.0
- Now uses RETE-UL algorithm (2-24x faster)
- Better memory efficiency
- Improved conflict resolution
- See Migration Guide
New Features:
- 🛠️ CLI Developer Tools (
rlgbinary)- Graph validation with comprehensive checks
- Dry-run execution mode
- Performance profiling with statistics
- ASCII graph visualization
- See CLI Tool Guide
- 💾 Caching Layer - High-performance result caching
- TTL-based expiration
- Multiple eviction policies (LRU, LFU, FIFO)
- Memory limits and statistics
- See Cache Guide
- ⚡ Parallel Node Execution - Automatic detection and parallel execution
- Layer detection algorithm using topological sort
- Concurrent execution within layers
- Parallelism analysis and statistics
- 📊 ParallelExecutor - New executor with parallel capabilities
- 📝 New Examples - CLI examples and test graphs
- ✅ 32 Tests - Comprehensive test coverage
Improvements:
- Updated documentation with CLI tools, caching, and migration guides
- Performance benchmarking utilities
- Example graph files for testing
Compatibility:
- All 32 tests passing
- API is backward compatible (100%)
- Performance: 2-24x faster rule matching
v0.3.0 (2025-11-03) - Streaming & Performance Release
New Features:
- 🌊 Streaming Processing - Stream-based node execution
- Backpressure handling with bounded channels
- Large dataset support with chunking
- Stream operators (map, filter, fold, async map)
- 📝 New Example -
streaming_flow.rswith 6 demonstrations - ✅ 8 New Tests - Streaming module testing
Performance:
- Processed 10,000 items in chunks
- ~432 items/sec throughput with backpressure
v0.2.0 (2025-11-02) - Integrations Release
New Features:
- 🗄️ Database Integrations - PostgreSQL, MySQL, Redis, MongoDB
- 🤖 AI/LLM Integrations - OpenAI GPT-4, Claude 3.5, Ollama
- 📝 Integration Examples -
postgres_flow.rs,openai_flow.rs - 📚 INTEGRATIONS.md - Comprehensive integration guide
- 🎛️ Feature Flags - Optional dependencies for integrations
v0.1.0 (2025-11-01) - Initial Release
Core Features:
- 🧠 Core graph execution engine
- 🔥 GRL (Grule Rule Language) integration
- 🔄 Topological sorting
- ⚡ Async execution with Tokio
- 📊 Three node types (Rule, DB, AI)
- 📝 JSON I/O for graphs
- 📚 4 working examples
- ✅ 6/6 tests passing
📄 License
MIT License - see LICENSE for details.
🔗 Links
- Repository: https://github.com/KSD-CO/rust-logic-graph
- rust-rule-engine: https://crates.io/crates/rust-rule-engine
- Documentation: docs/
- Issues: GitHub Issues
👥 Authors
James Vu - Initial work
🙏 Acknowledgments
Built with:
- rust-rule-engine v0.14.0 - GRL support with RETE-UL
- Tokio - Async runtime
- Petgraph - Graph algorithms
- Serde - Serialization
- Clap - CLI framework
⭐ Star us on GitHub if you find this useful! ⭐