Building Multi-Agent Workflows with Dify: Orchestrating Industrial AI
March 02, 2026Low-Code Agentic Workflows for Industrial PdM
Today, I'm sharing my experience developing agentic workflows in Dify - a powerful no-code tool for creating specialized AI agents. I will build a multi-agent linear workflow designed for Predictive Maintenance (PdM), with a set of specialized LLM blocks playing the roles of:
- Manager & Functional Analyst
- Data & System Architects
- Software Architect & QA Lead
- Backend & Frontend Developers
- QA Tester, Code Reviewer, and Code Fixer
I'm hiring this "AI team" to develop a real-world predictive maintenance application from scratch. I've intentionally chosen a linear workflow with no feedback loops between specialist LLMs to stress-test the zero-shot quality of the generated application. By having this structured sequence, I'm counting on my multi-disciplinary team of specialized LLMs to produce sharp, production-ready outputs. Here is the architecture of the workflow:
Click here for the Defy-based snapshot version of this workflow.
The Manager will translate the user prompt into a set of instructions for the downstream LLMs, which'll run in parallel. Here is an excerpt of the user prompt (click the link here for the full version):
I want to build a real-time predictive maintenance application from scratch to monitor industrial assets. The system must support autonomous data generation, real-time health scoring, and automated failure detection.
The manager's prompt:
You are the Lead Project Manager for a mission-critical industrial software project. Your objective is to orchestrate the end-to-end development of a Predictive Maintenance System. You are responsible for interpreting high-level blueprints, identifying technical gaps, and delegating precise, actionable instructions to your specialized engineering team.
<...>
Team Instructions:
- Instructions for Functional Analyst: Define UI/UX tasks.
- Instructions for System Architect: Define backend tasks, including the mandatory
/api/v1prefix and delta-loading for trends.- Instructions for Data Architect: Define database tasks for a 3-minute trend window with 1s aggregation support.
- Instructions for QA Lead: Define validation for high-frequency UI stability and alert accuracy.
The team of specialists will then translate the high-level instructions into actionable tasks. Next, the System Architect aggregates and synthesizes the specialists' output into a cohesive implementation plan, which serves as the input to developer LLMs to code the application. The output from the developers is then sent to the MPC tool, which writes the code to a file system.
In addition to the file writing tool, the MPC includes a couple of tools that invoke subagents - the Code Reviewer (prompt) and the Code Fixer (prompt). Why did I include these? - Initially I hadn't planned on creating them but eventually I introduced them because, without them, the quality of the generated code was suboptimal. I realized I needed additional agents to review the work, fix inconsistencies, and harmonize the source code.
At the end of the workflow, the final LLM block updates the README.md with instructions on how to get started with the application/project.
Lessons in Multi-Agent Orchestration
Building agentic workflows is essentially building a "harness" around LLMs. I had to iterate several times on my prompts just to get decent outputs for each block in the Dify workflow.
Initially, I wanted to use local 3B GGUF models for most blocks, reserving Gemini 1.5 Pro or Gemini 2.0 for the Manager and System Architect roles. However, the downstream "dev team" consistently struggled with implementation details. I eventually switched to using non-local Gemini models across the board for higher reliability.
The lack of feedback loops between the dev team and the Code Reviewer was a major challenge. It proved naïve to think a strictly linear workflow would work for complex code generation. To solve this, I integrated a gemini-cli invoked in "YOLO mode" into the MCP server, allowing the Code Reviewer and Code Fixer to autonomously refine the implementation.
Industrial PdM Application Results
The final output is a functional dashboard: https://ideas.samarkanov.info/predictive-maintenance-dify/. While I removed the heavy backend components for the demo version, it highlights the UI/UX generation capabilities of our multi-agent team.
Besides the main app, the OpenAPI specifications were generated and documented, providing a ready-to-use API layer for the industrial monitoring system.
I spent around 3 Euros on Gemini API calls in total.
Project Code & Prompts
- Agent Prompts: GitHub - PdM Prompts
- Generated Source Code: GitHub - Predictive Maintenance App