Composition · Visual Authoring

AbstractFlow

Diagram-based, durable AI workflows for Python. A visual editor inspired by UE4 Blueprints with drag-and-drop nodes, portable .flow bundles, recursive subflows, and multi-agent orchestration. Gateway-first architecture.

# Launch the visual editor (no repo clone needed)
pip install "abstractgateway[http]" abstractflow
export ABSTRACTGATEWAY_AUTH_TOKEN=dev-token
abstractgateway serve --port 8080

# In a second terminal
npx @abstractframework/flow --gateway-url http://127.0.0.1:8080

What is AbstractFlow?

AbstractFlow is a workflow authoring and orchestration layer for the AbstractFramework ecosystem. It provides a small programmatic API, a portable VisualFlow JSON format, and a Gateway-first visual editor with React frontend.

Visual Editor

A browser-based editor inspired by UE4 Blueprints. Drag nodes from the palette, wire connections, configure providers and models per node. Gateway-first: the editor talks to AbstractGateway for everything.

Portable Workflows

Workflows are defined as JSON documents following the VisualFlow schema (Pydantic models). Package as .flow bundles and deploy anywhere. Host-independent execution.

Programmatic API

Flow and FlowRunner provide a pure Python API for building and running workflows. Create nodes with lambdas, wire edges, and execute with durable stores.

How It Fits Together

# Architecture
#
# Visual Editor UI ──/api/gateway/*──▸ AbstractGateway
#   (React)                              ├─ discovery, runs, ledger
#                                        ├─ artifacts, media, bundles
#                                        └─▸ AbstractRuntime ──▸ AbstractCore
#
# Any host process (CLI / server / notebook)
#   └─ create_visual_runner / execute_visual_flow
#        └─ optional local Runtime compatibility

Visual Workflow Capabilities

A rich node palette for building complex AI pipelines visually, with full durable execution support.

Node Types

LLM Call, Agent, Tool Call, Code, Conditional, Loop, Subflow, On Flow Start/End, Emit Event, and media nodes (Generate Image, Generate Video, Generate Voice, Generate Music, Transcribe Audio).

Multi-Agent Orchestration

Agent nodes with configurable provider, model, tools, and max iterations. Build self-correcting loops with intent analyzers, executors, and reviewers. Each agent can use a different model.

Recursive Subflows

Compose complex pipelines from reusable sub-workflows. Each subflow runs as a durable child run with its own ledger. Subflow nodes can reference any flow in the registry.

Code Nodes

Execute Python code within flows using RestrictedPython sandboxing. Transform data, validate outputs, and implement custom logic directly in the visual editor.

Workflow Bundles

Package flows + subflows into portable .flow zip archives. Bundle, inspect, unpack via CLI. Deploy to any gateway with version management and metadata.

Media Generation Nodes

Generate images, edit images, create videos, synthesize voice, and compose music directly in workflows. Media nodes use Gateway catalog discovery with auto or explicit provider selection.

Interface Contracts

Flows can declare interface markers like abstractcode.agent.v1 for host-specific IO contracts. Validation and scaffolding ensures flows meet contract requirements.

Durable Waiting

Flows can block on external input (ask_user, wait_event, wait_until). Waiting runs are persisted and resume exactly where they left off when input arrives.

Run Modal & Artifacts

The visual editor renders runs with step-by-step traces, media artifact previews (image, video, audio players), progress events for long media jobs, and raw JSON inspection.

Two Ways to Use AbstractFlow

Use the visual editor for diagram-based authoring, or the Python API for programmatic workflow construction.

Visual Editor (Gateway-First)

# Terminal 1: Start the gateway
pip install "abstractgateway[http]" abstractflow
export ABSTRACTGATEWAY_AUTH_TOKEN=dev-token
abstractgateway serve --port 8080

# Terminal 2: Launch the editor UI
export ABSTRACTGATEWAY_AUTH_TOKEN=dev-token
npx @abstractframework/flow --gateway-url http://127.0.0.1:8080

# Open http://localhost:3003
# Gateway capabilities: http://localhost:8080/api/gateway/discovery/capabilities

Programmatic API

from abstractflow import Flow, FlowRunner

flow = Flow("linear")
flow.add_node("double", lambda x: x * 2,
              input_key="value", output_key="doubled")
flow.add_node("add_ten", lambda x: x + 10,
              input_key="doubled", output_key="final")
flow.add_edge("double", "add_ten")
flow.set_entry("double")

result = FlowRunner(flow).run({"value": 5})
print(result)
# {"success": True, "result": 20}

Execute a VisualFlow JSON

import json
from abstractflow.visual import VisualFlow, execute_visual_flow

with open("my-flow.json", "r", encoding="utf-8") as f:
    vf = VisualFlow.model_validate(json.load(f))

result = execute_visual_flow(vf, {"prompt": "Hello"}, flows={vf.id: vf})
print(result)

CLI: Workflow Bundles

# Pack a bundle from a VisualFlow JSON
abstractflow bundle pack web/flows/ac-echo.json --out /tmp/ac-echo.flow

# Inspect bundle metadata
abstractflow bundle inspect /tmp/ac-echo.flow

# Unpack to a directory
abstractflow bundle unpack /tmp/ac-echo.flow --dir /tmp/ac-echo

Install Profiles

Base Package

pip install abstractflow

Gateway-first thin client. VisualFlow models, bundle helpers, CLI. Python 3.10+.

Apple Profile

pip install "abstractflow[apple]"

Full host profile with local execution, Agent nodes, MLX support, and all non-NVIDIA capabilities.

GPU Profile

pip install "abstractflow[gpu]"

Full GPU-capable host profile with vLLM, HuggingFace, Diffusers, and CUDA support.

Python API Surface

The public API is intentionally small. AbstractFlow delegates compilation and runtime execution to AbstractRuntime.

Programmatic Flows

from abstractflow import (
    Flow,          # Flow IR
    FlowNode,      # Node definition
    FlowEdge,      # Edge definition
    FlowRunner,    # Execution + output
    compile_flow, # Compiler shim
)

Visual Flows

from abstractflow.visual import (
    VisualFlow,          # Pydantic model
    VisualNode,          # Node schema
    VisualEdge,          # Edge schema
    NodeType,            # Node types enum
    PinType,             # Pin types enum
    execute_visual_flow, # Run + return
    create_visual_runner,# Advanced runner
)

Workflow Bundles

from abstractflow.workflow_bundle import (
    pack_workflow_bundle,
    inspect_workflow_bundle,
    unpack_workflow_bundle,
)

Interface Contracts

from abstractflow.visual.interfaces import (
    ABSTRACTCODE_AGENT_V1,
    validate_visual_flow_interface,
    apply_visual_flow_interface_scaffold,
)

Gateway Editor Contract

The React editor discovers capabilities from the gateway and uses them for node configuration, media catalog selection, and run execution.

# The editor reads capabilities from:
GET /api/gateway/discovery/capabilities

# Key contracts:
# capabilities.contracts.flow_editor       — VisualFlow CRUD/publish
# capabilities.contracts.common            — runs, ledger, artifacts
# assistant.media.generated_image          — image generation nodes
# assistant.media.edited_image             — image editing nodes
# assistant.media.generated_video          — video generation nodes
# assistant.media.generated_voice          — voice synthesis nodes
# assistant.media.generated_music          — music generation nodes
# common.readiness                         — surface readiness overlay

CLI Reference

# Bundle management
abstractflow bundle pack <root.json> --out <output.flow> [--flows-dir <dir>]
abstractflow bundle inspect <bundle.flow>
abstractflow bundle unpack <bundle.flow> --dir <output_dir>

# Start the editor backend (dev/compat)
abstractflow serve [--port 3003] [--gateway-url http://...]