CLI Commands

Hanflow ships with a full command-line interface for workflow authoring, run management, HITL approval, and inspection.

pip install hanflow          # or: uv add hanflow
hanflow --help               # list all commands

Authoring

CommandDescription
hanflow new --name wf --mode staticScaffold a workflow from a template (static, dynamic, hybrid)
hanflow validate workflow.yamlValidate a workflow YAML against the DSL schema
hanflow compile workflow.yamlCompile to a LangGraph graph (dry-run; reports entry and exit nodes)

Running

CommandDescription
hanflow run workflow.yamlRun a workflow locally (uses FakeProvider by default)
hanflow serve --host 0.0.0.0 --port 8000Start the HTTP API + Web Studio backend

Server-dependent commands below require hanflow serve to be running. Set HANFLOW_BASE_URL to point to the server (default: http://localhost:8000).

Run Management

CommandDescription
hanflow runsList recent runs
hanflow status <run_id>Show run status and result
hanflow cancel <run_id>Cancel a run
hanflow logs <run_id>Poll run status until terminal (succeeded, failed, or cancelled)
hanflow trace <run_id>Render a run trace (note: trace data is limited until LocalTraceProvider is wired)
hanflow artifacts <run_id>List run artifacts

HITL Approval

CommandDescription
hanflow resume <run_id>Resume a paused run (alias for approve)
hanflow approve <run_id>Approve a HITL gate
hanflow edit <run_id> --value <new_value>Edit a HITL gate (requires --value)
hanflow reject <run_id> --reason <text>Reject a HITL gate (requires --reason)
hanflow reroute <run_id> --target <node_id>Reroute a HITL gate (requires --target)

All HITL commands accept --by <user> to record the decision maker (default: cli).

Local Inspection

CommandDescription
hanflow toolsList available MCP tools
hanflow tools --server <name>List tools from a specific MCP server
hanflow configShow resolved configuration as JSON
hanflow doctorHealth check: config valid, backends reachable
hanflow index <store> <path>Index documents into a retrieval store

Not Yet Available

The following commands exist but their backend is not yet implemented. They print a clear "not yet supported" message:

CommandStatus
hanflow metrics <run_id>Metrics aggregation not wired (RunResult.usage not populated)
hanflow search <query>Retrieval not configured; use hanflow index first
hanflow evalEval framework not yet implemented
hanflow datasetsEval framework not yet implemented
hanflow workerMulti-worker mode not yet available; use hanflow serve