Web UI Editor

September 3, 2026 · View on GitHub

aflare includes a built-in web-based workflow editor with visualization capabilities.

Quick Start

Start the Web UI

# Start on default port (8081)
aflare webui

# Start on custom port
aflare webui --port 8080

# Start with custom host (accessible from network)
aflare webui --host 0.0.0.0 --port 8081

# Start with specific workflows directory
aflare webui --workflows-dir ./workflows

Access the UI

Open your browser and navigate to:

http://localhost:8081

Features

Workflow Management

  • Create: Create new workflows from scratch
  • Load: Load existing workflows from the file system
  • Save: Save workflows to YAML files
  • Delete: Delete workflows (with confirmation)

Visual Workflow Editor

  • YAML Editor: Syntax-highlighted YAML editor
  • Real-time Validation: Validate workflows as you edit
  • Visual Preview: Preview workflow diagrams in multiple formats

Visualization Formats

FormatDescription
MermaidInteractive flowchart diagrams
JSONStructured data for custom rendering
DOTGraphviz DOT format
ASCIIText-based diagram for terminal

UI Layout

┌─────────────────────────────────────────────────────────────┐
│  Sidebar                    Main Area                      │
│  ┌─────────────────┐  ┌─────────────────────────────────┐  │
│  │ Aflare          │  │ Toolbar (format, validate, save)│  │
│  ├─────────────────┤  ├─────────────────────────────────┤  │
│  │ Workflow List   │  │ Tabs (Editor / Preview)         │  │
│  │ - workflow1     │  │                                 │  │
│  │ - workflow2     │  │ Editor:                         │  │
│  │ - workflow3     │  │   [YAML text area]              │  │
│  ├─────────────────┤  │                                 │  │
│  │ + New Workflow  │  │ Preview:                        │  │
│  └─────────────────┘  │   [Mermaid/JSON/DOT/ASCII]      │  │
│                       ├─────────────────────────────────┤  │
│                       │ Status Bar (validation, steps)  │  │
│                       └─────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────┘

API Endpoints

The Web UI exposes REST API endpoints for programmatic access:

EndpointMethodDescription
/api/workflowsGETList all workflows
/api/workflowGETGet workflow by name
/api/workflowPOSTSave workflow
/api/workflowDELETEDelete workflow
/api/validatePOSTValidate workflow YAML
/api/visualizePOSTGenerate visualization

Example: Validate Workflow

curl -X POST http://localhost:8081/api/validate \
  -H "Content-Type: application/json" \
  -d '{"workflow": "name: test\nsteps:\n  - node: agent\n    params:\n      model: gpt-4o"}'

Example: Generate Mermaid Diagram

curl -X POST "http://localhost:8081/api/visualize?format=mermaid" \
  -H "Content-Type: application/json" \
  -d '{"workflow": "name: test\nsteps:\n  - node: agent\n    params:\n      model: gpt-4o"}'

Configuration

CLI Options

OptionDefaultDescription
--host127.0.0.1Host address to bind
--port8081Port to listen on
--workflows-dirCurrent directoryDirectory to load/save workflows

Environment Variables

VariableDescription
AFLARE_WEBUI_HOSTDefault host
AFLARE_WEBUI_PORTDefault port
AFLARE_WORKFLOWS_DIRDefault workflows directory
AFLARE_METRICSSet to 1 to enable the Prometheus /metrics endpoint (disabled by default)
AFLARE_PPROFSet to 1 to enable the /debug/pprof/ profiling endpoints (disabled by default)

Prometheus Metrics

The Web UI server can expose a Prometheus /metrics endpoint that scrapes aflare's internal statistics (node/workflow execution, security blocks, LLM calls, cache hits). The endpoint is disabled by default for security: it is unauthenticated (Prometheus scrapers usually carry no auth token) and exposes runtime statistics, so it should only be enabled on a trusted network or behind a reverse proxy.

Enabling the endpoint

Set AFLARE_METRICS=1 before starting the server:

AFLARE_METRICS=1 aflare webui --host 0.0.0.0 --port 8081

The endpoint is then available at http://localhost:8081/metrics. It is rate-limited (token bucket, ~5 req/s) to protect against scraper floods and is not behind the X-Auth-Token middleware, matching the Prometheus scrape convention.

Prometheus scrape config

scrape_configs:
  - job_name: "aflare"
    static_configs:
      - targets: ["localhost:8081"]
    metrics_path: /metrics

Exposed metrics

MetricTypeLabelsSource
aflare_node_executions_totalcounternode_name, statusRegistry.ExecuteWithStats + workflow executor (seq/DAG step completion)
aflare_node_execution_duration_secondshistogramnode_nameRegistry.ExecuteWithStats + workflow executor (seq/DAG step completion)
aflare_node_failures_totalcounternode_name, error_class (timeout/canceled/not_found/other)node execution failure path
aflare_runs_activegaugeworkflow executor (in-flight runs; idempotency cache hits are not counted)
aflare_queue_depthgaugedaemon task queue (pending, not yet picked up by a worker)
aflare_workflow_executions_totalcounterstatusworkflow executor
aflare_workflow_execution_duration_secondshistogramworkflow executor
aflare_agent_delegations_totalcounterdriver, agent, statusagentx delegation path (supervisor fan-out and single-step cli_agent/a2a_agent calls)
aflare_agent_delegation_duration_secondshistogramdriver, agentagentx delegation path (supervisor fan-out and single-step cli_agent/a2a_agent calls)
aflare_a2a_polls_totalcounteragent, statusA2A tasks/get polling loop (visibility into fixed-interval poll cost)
aflare_security_blocks_totalcounterblock_typeSecurityStats.RecordBlock
aflare_cache_hits_totalcounterCacheStats (pull via CollectSnapshot)
aflare_cache_misses_totalcounterCacheStats (pull via CollectSnapshot)
aflare_llm_calls_totalcounterprovider, model, statusworkflow LLM trace
aflare_llm_tokens_totalcounterprovider, model, typeworkflow LLM trace
aflare_llm_cost_usd_totalcounterprovider, modelworkflow LLM trace
aflare_node_callsgaugenode_nameRegistry stats snapshot
aflare_node_errorsgaugenode_nameRegistry stats snapshot
aflare_security_blocksgaugeblock_typeSecurityStats snapshot

Hot-path counters (node/workflow/security/LLM) are incremented inline at the execution sites. Cache counters and the snapshot gauges are pulled on each scrape from the existing internal stats accumulators via CollectSnapshot.

Note: Labelled counters only appear in the output once a label combination has been touched (e.g. aflare_node_executions_total shows up after the first node execution). Plain counters (cache hits/misses) are always emitted, even at zero.

Daemon ops endpoint (aflare agent)

The agent daemon exposes the same opt-in endpoints on a dedicated listener, off by default (local-first: the daemon opens no ports unless asked):

AFLARE_METRICS=1 AFLARE_PPROF=1 aflare agent --ops-port 9090
Flag / envDefaultMeaning
--ops-port <n>9090Port for the ops listener
AFLARE_OPS_ADDR127.0.0.1Bind address (e.g. 0.0.0.0 in a container)
AFLARE_METRICS=1offEnable GET /metrics
AFLARE_PPROF=1offEnable GET /debug/pprof/*

Unlike the WebUI endpoints there is no auth middleware and no rate limiter — the listener binds to localhost by default and is intended for trusted networks only; whoever enables it is responsible for access control.

Usage Tips

Keyboard Shortcuts

  • Ctrl+S: Save workflow (via Save button)
  • Ctrl+Enter: Validate workflow

Best Practices

  1. Validate First: Always validate your workflow before running
  2. Use Descriptive Names: Give workflows meaningful names
  3. Save Regularly: The UI doesn't auto-save
  4. Preview Diagrams: Use the preview to verify workflow structure
  5. Check Status Bar: The status bar shows validation results and step count

Security

  • The Web UI is intended for local development use
  • By default, it only binds to 127.0.0.1 (localhost)
  • For production, use a reverse proxy (nginx, Caddy) with TLS
  • No authentication is built-in; secure with firewall rules

Troubleshooting

UI Not Accessible

  1. Check if the server is running: aflare webui
  2. Verify the port: netstat -tlnp | grep 8081
  3. Check firewall rules
  4. Try accessing with --host 0.0.0.0

Workflows Not Loading

  1. Check the workflows directory
  2. Ensure files have .yaml or .yml extension
  3. Verify file permissions

Mermaid Preview Not Rendering

  1. Check browser console for errors
  2. Ensure internet connection (Mermaid CDN)
  3. Try refreshing the page

Systemd Service

For production deployments:

[Unit]
Description=aflare WebUI
After=network.target

[Service]
Type=simple
User=youruser
ExecStart=/usr/local/bin/aflare webui --host 0.0.0.0 --port 8081
Restart=on-failure

[Install]
WantedBy=multi-user.target