Overview
Anar Flow is a workflow automation platform that lets government organizations define, execute, and monitor AI-powered workflows. From citizen inquiry routing to permit application processing, Flow turns multi-step government processes into repeatable, auditable automations.
Every workflow is a directed graph of steps -- LLM calls, API integrations, conditionals, loops, transforms, and human approval gates. Steps execute sequentially or in parallel, with a shared execution context that carries variables and state between them.
Key Capabilities
Visual Workflow Builder
The drag-and-drop builder lets operators define workflows without writing code. Each step is configured with its type, inputs, outputs, and connections to downstream steps. The builder renders real-time previews of workflow topology and validates step configurations before saving.
AI-Powered Steps
LLM call steps invoke sovereign AI models (via Groq or Azure) with templated prompts. Variables from previous steps are injected automatically using {{variable}} syntax, enabling dynamic prompt construction based on runtime data.
9 Step Types
Flow supports nine step types for comprehensive workflow logic: llm_call, conditional, loop, transform, api_call, human_approval, parallel, guard_check, and notification. The guard_check step integrates with Anar Guard for inline content safety scanning within workflow pipelines.
Workflow Detail View
A dedicated workflow detail page shows the full step graph, execution history, and per-run timing data. The detail view provides visual step-by-step execution tracking with input/output inspection for debugging.
Webhook Testing
Test webhook triggers directly from the dashboard with custom payloads. The webhook tester validates connectivity, shows response details, and logs test executions for debugging integration issues.
Human-in-the-Loop
Human approval steps pause workflow execution and notify designated reviewers. The workflow resumes only after explicit approval, creating auditable decision points for sensitive government processes.
Pre-Built Government Templates
Flow ships with three government-specific templates:
- Citizen Inquiry Processing -- Classify, route, and respond to citizen requests across departments
- Document Review & Approval -- Extract metadata, validate content, and manage approval chains
- Permit Application Processing -- End-to-end permit workflows with eligibility checks and multi-stage approvals
Architecture
Flow follows a two-tier architecture with a FastAPI backend on port 8009 and a Next.js dashboard on port 3009.
The backend contains the workflow engine (step runner, branching logic), execution context (variable resolution, state management), and step handlers (LLM, API, conditional, loop, transform, human approval). Workflows and execution history are persisted in the database.
Step Limits
Workflows support up to 50 steps by default. Each step has a configurable timeout (default 30 seconds) to prevent runaway executions.
Quick Start
cd flow/backend
uv sync
uv run uvicorn anar_flow.main:app --reload --port 8009
Create and execute a workflow:
curl -X POST http://localhost:8009/api/v1/flows/create \
-H "Content-Type: application/json" \
-d '{
"name": "Inquiry Classifier",
"trigger": "api",
"steps": [
{
"id": "classify",
"name": "Classify Inquiry",
"type": "llm_call",
"config": {
"prompt": "Classify this inquiry: {{input.message}}",
"model": "llama-3.3-70b-versatile"
}
}
]
}'
Dashboard
The Flow dashboard provides five views:
- Overview -- Workflow count, active runs, and success rate metrics
- Workflows -- Browse, search, and manage all workflow definitions
- Builder -- Visual drag-and-drop workflow builder with step configuration panels
- Runs -- Execution history with step-by-step timing and output data
- Templates -- Pre-built government workflow templates ready for deployment
Observability
Flow is instrumented with OpenTelemetry via anar_shared.setup_otel(). When OTEL_EXPORTER_OTLP_ENDPOINT is set, traces, logs, and metrics are exported to the OTel Collector.
MCP Server
Flow exposes a Model Context Protocol server at /mcp via FastApiMCP, enabling AI assistants to create workflows, trigger executions, and query run history programmatically.
Gateway Integration
When GATEWAY_URL is set, Flow routes LLM calls in AI-powered steps through Anar Gateway for unified cost tracking and safety scanning.
Test Suite
251 tests cover workflow CRUD, step execution (9 step types including guard_check), triggers, branching, loops, parallel steps, workflow lifecycle management, webhook testing, and templates.
cd flow/backend && uv run pytest
Next Steps
- Workflow Builder -- Visual workflow definition and step configuration
- Step Types -- LLM, conditional, loop, transform, API, and human approval steps
- Triggers -- Webhook, API, scheduled, and manual triggers
- API Reference -- Full endpoint documentation