Skip to content

lpalbou/AbstractFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AbstractFlow

Diagram-Based AI Workflow Generation

WIP - Core workflow engine and visual editor are implemented and ready for use!

AbstractFlow is an innovative Python library that enables visual, diagram-based creation and execution of AI workflows. Built on top of AbstractCore, it provides an intuitive interface for designing complex AI pipelines through interactive diagrams.

Monorepo note (Abstract Framework)

This repository is the Abstract Framework monorepo. The implementation in abstractflow/abstractflow/* (Flow/FlowRunner/compiler) and abstractflow/abstractflow/visual/* (VisualFlow models + portable executor) is aligned with docs/architecture.md.

Some parts of this README (and abstractflow/pyproject.toml / abstractflow/CHANGELOG.md) were originally written for a standalone placeholder package and may be out of sync with the monorepo implementation. See docs/architecture.md and planned backlog docs/backlog/planned/093-framework-packaging-alignment-flow-runtime.md.

🎯 Vision

AbstractFlow aims to democratize AI workflow creation by providing:

  • Visual Workflow Design: Create AI workflows using intuitive drag-and-drop diagrams
  • Multi-Provider Support: Leverage any LLM provider through AbstractCore's unified interface
  • Real-time Execution: Watch your workflows execute in real-time with live feedback
  • Collaborative Development: Share and collaborate on workflow designs
  • Production Ready: Deploy workflows to production with built-in monitoring and scaling

πŸš€ Planned Features

Core Capabilities

  • Diagram Editor: Web-based visual editor for workflow creation
  • Node Library: Pre-built nodes for common AI operations (text generation, analysis, transformation)
  • Custom Nodes: Create custom nodes with your own logic and AI models
  • Flow Control: Conditional branching, loops, and parallel execution
  • Data Transformation: Built-in data processing and transformation capabilities

AI Integration

  • Universal LLM Support: Works with OpenAI, Anthropic, Ollama, and all AbstractCore providers
  • Tool Calling: Seamless integration with external APIs and services
  • Structured Output: Type-safe data flow between workflow nodes
  • Streaming Support: Real-time processing for interactive applications

Deployment & Monitoring

  • Cloud Deployment: One-click deployment to major cloud platforms
  • Monitoring Dashboard: Real-time workflow execution monitoring
  • Version Control: Git-based workflow versioning and collaboration
  • API Generation: Automatic REST API generation from workflows

πŸ—οΈ Architecture

AbstractFlow is built on a robust foundation:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Diagram UI    β”‚    β”‚  Workflow Engine β”‚    β”‚   AbstractCore  β”‚
β”‚                 │────│                 │────│                 β”‚
β”‚ Visual Editor   β”‚    β”‚ Execution Logic β”‚    β”‚ LLM Providers   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • Frontend: React-based diagram editor with real-time collaboration
  • Backend: Python workflow execution engine with FastAPI
  • AI Layer: AbstractCore for unified LLM provider access
  • Storage: Workflow definitions, execution history, and metadata

🎨 Use Cases

Business Process Automation

  • Customer support ticket routing and response generation
  • Document analysis and summarization pipelines
  • Content creation and review workflows

Data Processing

  • Multi-step data analysis with AI insights
  • Automated report generation from raw data
  • Real-time data enrichment and validation

Creative Workflows

  • Multi-stage content creation (research β†’ draft β†’ review β†’ publish)
  • Interactive storytelling and narrative generation
  • Collaborative writing and editing processes

Research & Development

  • Hypothesis generation and testing workflows
  • Literature review and synthesis automation
  • Experimental design and analysis pipelines

πŸ› οΈ Technology Stack

  • Core: Python 3.8+ with AsyncIO support
  • AI Integration: AbstractCore for LLM provider abstraction
  • Web Framework: FastAPI for high-performance API server
  • Frontend: React with TypeScript for the diagram editor
  • Database: PostgreSQL for workflow storage, Redis for caching
  • Deployment: Docker containers with Kubernetes support

πŸ“¦ Installation

# Clone the repository
git clone https://github.com/lpalbou/AbstractFlow.git
cd AbstractFlow

# Install core dependencies
pip install -e .

# Or install with web editor dependencies
pip install -e .[server]

# Development installation (includes tests)
pip install -e .[dev]

Dependencies

AbstractFlow requires:

For the visual editor:

  • Node.js 18+ (for frontend)
  • FastAPI, uvicorn, websockets (for backend)

πŸš€ Quick Start

Programmatic API

from abstractflow import Flow, FlowRunner

# Create a flow
flow = Flow("my-workflow")

# Add function nodes
def double(x):
    return x * 2

def add_ten(x):
    return x + 10

flow.add_node("double", double, input_key="value", output_key="doubled")
flow.add_node("add_ten", add_ten, input_key="doubled", output_key="result")

# Connect nodes
flow.add_edge("double", "add_ten")
flow.set_entry("double")

# Execute the flow
runner = FlowRunner(flow)
result = runner.run({"value": 5})
print(result)  # {"value": 5, "doubled": 10, "result": 20}

With Agents

from abstractflow import Flow, FlowRunner
from abstractagent import create_react_agent

# Create an agent
planner = create_react_agent(provider="ollama", model="qwen3:4b-instruct-2507-q4_K_M")

# Create flow with agent node
flow = Flow("agent-workflow")
flow.add_node("plan", planner, input_key="task", output_key="plan")
flow.set_entry("plan")

# Run
runner = FlowRunner(flow)
result = runner.run({"task": "Plan a weekend trip to Paris"})
print(result["plan"])

Nested Flows (Subflows)

# Create a subflow
inner_flow = Flow("processing")
inner_flow.add_node("step1", lambda x: x.upper())
inner_flow.add_node("step2", lambda x: f"[{x}]")
inner_flow.add_edge("step1", "step2")
inner_flow.set_entry("step1")

# Use subflow in parent flow
outer_flow = Flow("main")
outer_flow.add_node("preprocess", lambda x: x.strip())
outer_flow.add_node("process", inner_flow)  # Subflow as node
outer_flow.add_node("postprocess", lambda x: x + "!")
outer_flow.add_edge("preprocess", "process")
outer_flow.add_edge("process", "postprocess")
outer_flow.set_entry("preprocess")

runner = FlowRunner(outer_flow)
result = runner.run({"input": "  hello  "})

πŸ–₯️ Visual Workflow Editor

AbstractFlow includes a state-of-the-art web-based visual editor inspired by Unreal Engine Blueprints:

Features

  • Blueprint-Style Nodes: Drag-and-drop nodes with typed, colored pins
  • Real-time Execution: Watch workflows execute with live node highlighting via WebSocket
  • Monaco Code Editor: Write custom Python code directly in nodes
  • Type-Safe Connections: Pin type validation prevents incompatible connections
  • Export/Import: Save and load workflows as JSON

Blueprint-Style Pin Types

Type Color Shape Description
Execution White #FFFFFF β–· Triangle Flow control
String Magenta #FF00FF β—‹ Circle Text data
Number Green #00FF00 β—‹ Circle Integer/Float
Boolean Red #FF0000 β—‡ Diamond True/False
Object Cyan #00FFFF β—‹ Circle JSON objects
Array Orange #FF8800 β–‘ Square Collections
Agent Blue #4488FF ⬑ Hexagon Agent reference
Any Gray #888888 β—‹ Circle Accepts any type

Built-in Node Categories

  • Core: Agent, Subflow, Python Code
  • Math: Add, Subtract, Multiply, Divide, Modulo, Power, Abs, Round, Min, Max
  • String: Concat, Split, Join, Format, Uppercase, Lowercase, Trim, Substring, Length, Replace
  • Control: If/Else, Compare, NOT, AND, OR
  • Data: Get Property, Set Property, Merge Objects

Running the Visual Editor

# 1. Create virtual environment and install dependencies
cd abstractflow
python3 -m venv .venv
source .venv/bin/activate
pip install -e .  # Install abstractflow
pip install -r web/requirements.txt  # Install FastAPI, uvicorn, websockets

# 2. Start backend server (from abstractflow root)
PYTHONPATH=web:../abstractruntime/src:../abstractcore uvicorn backend.main:app --port 8080 --reload

# 3. In a new terminal, start frontend dev server
cd abstractflow/web/frontend
npm install
npm run dev

Then open http://localhost:3000 in your browser.

Production mode (serve frontend from backend):

# Build frontend
cd web/frontend && npm run build && cd ../..

# Run backend only (serves frontend from dist/)
PYTHONPATH=web:../abstractruntime/src:../abstractcore uvicorn backend.main:app --port 8080

# Open http://localhost:8080

Project Structure

web/
β”œβ”€β”€ backend/                    # FastAPI backend
β”‚   β”œβ”€β”€ main.py                 # App entry with CORS, static files
β”‚   β”œβ”€β”€ models.py               # Pydantic models (VisualNode, VisualEdge, VisualFlow)
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ flows.py            # Flow CRUD endpoints
β”‚   β”‚   └── ws.py               # WebSocket for real-time execution
β”‚   └── services/
β”‚       β”œβ”€β”€ executor.py         # VisualFlow β†’ AbstractFlow conversion
β”‚       β”œβ”€β”€ builtins.py         # 26 built-in function handlers
β”‚       └── code_executor.py    # Sandboxed Python execution
β”œβ”€β”€ frontend/                   # React + TypeScript frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ Canvas.tsx      # React Flow canvas
β”‚   β”‚   β”‚   β”œβ”€β”€ NodePalette.tsx # Categorized node picker
β”‚   β”‚   β”‚   β”œβ”€β”€ PropertiesPanel.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Toolbar.tsx     # Run/Save/Export/Import
β”‚   β”‚   β”‚   └── nodes/
β”‚   β”‚   β”‚       β”œβ”€β”€ BaseNode.tsx    # Blueprint-style node
β”‚   β”‚   β”‚       └── CodeNode.tsx    # Monaco editor node
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”‚   β”œβ”€β”€ useFlow.ts      # Zustand state management
β”‚   β”‚   β”‚   └── useWebSocket.ts # Real-time updates
β”‚   β”‚   β”œβ”€β”€ types/
β”‚   β”‚   β”‚   β”œβ”€β”€ flow.ts         # TypeScript types, PIN_COLORS
β”‚   β”‚   β”‚   └── nodes.ts        # Node templates
β”‚   β”‚   └── styles/             # Dark theme CSS
β”‚   └── package.json
└── requirements.txt            # Backend Python dependencies

🎯 Roadmap

Phase 1: Foundation βœ… Complete

  • Core workflow engine (Flow, FlowNode, FlowEdge)
  • Basic node types (Agent, Function, Subflow)
  • Flow compilation to WorkflowSpec
  • FlowRunner execution via Runtime
  • State passing between nodes with dot notation

Phase 2: Visual Editor βœ… Complete

  • Web-based diagram editor with React Flow
  • Blueprint-style pins with colors and shapes
  • 26 built-in function nodes (math, string, control, data)
  • Custom Python code nodes with Monaco editor
  • Export/Import JSON functionality
  • Real-time execution updates via WebSocket

Phase 3: Advanced Features (Planned)

  • Custom node development SDK
  • Advanced flow control (loops, parallel execution)
  • Monitoring and analytics dashboard
  • Cloud deployment integration

Phase 4: Enterprise (Planned)

  • Enterprise security features
  • Advanced monitoring and alerting
  • Multi-tenant support
  • Professional services and support

🀝 Contributing

We welcome contributions from the community! Once development begins, you'll be able to:

  • Report bugs and request features
  • Submit pull requests for improvements
  • Create and share workflow templates
  • Contribute to documentation

πŸ“„ License

AbstractFlow will be released under the MIT License, ensuring it remains free and open-source for all users.

πŸ”— Related Projects

πŸ“ž Contact

For early access, partnerships, or questions about AbstractFlow:


AbstractFlow - Visualize, Create, Execute. The future of AI workflow development is here.

Built on top of AbstractCore

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published