Back to case study
Workflow replay sandbox

Dify Long-Form Content Agent

A Dify advanced-chat workflow that breaks long-form writing into a controllable iterative loop: outline → section-by-section expansion → style-checker tool.

A guided replay of the real Dify advanced-chat graph: a start node reads the word budget, then a loop runs expand → count chars → check budget until the budget is met, followed by a style-checker tool.

DifyDeepSeekWorkflowIteration
Dify Long-Form Content Agent

Why this local version exists

This replays the graph from the real workflow YAML (循环扩充文本.yml + Tool-StyleChecker.yml) on a sample story topic. It calls no live Dify/DeepSeek — the loop logic, char counting, and exit condition are the real node behavior.

Interactive Preview

Run the long-form iteration workflow

Replays the Dify advanced-chat graph on a sample topic: a start node reads the budget → the loop runs "expand → count chars → check budget" repeatedly → after exit it runs a style-checker tool.

Start-node inputs

zhuti· A short story about a late-night convenience store

beijing· Warm, healing tone; third-person narration; open ending

zishu (budget) = 1200

文章扩充节点 (LLM · deepseek-chat)

Expands the next beat from 主题 + 背景 + conversation.history, told to keep narrative momentum.

节点统计 (code · python3)

def main(arg1): return {"result": len(arg1)} — counts len(history).

条件分支 (if-else)

len(history) ≥ zishu ? met → loop-end; otherwise back to the expand node.

Activity log

Run the workflow to watch the loop expand and check the word budget each pass.

Draft by beat & conversation.history

0/1200

word-budget progress

0%

Each loop iteration appends a beat here and into conversation.history.

What to try

Run the workflow and watch each loop iteration append a beat and accumulate the char count.

Notice the if-else exit: the loop ends only once len(history) ≥ the word budget.

Read the StyleChecker JSON verdict — style match plus concrete revision notes.

What this demo proves

You can design a stateful Dify loop with typed conversation variables, code nodes, and an if-else exit — not a single mega-prompt.

You separate in-progress state (conversation.history) from model calls, so failures are recoverable per iteration.

You know when low-code orchestration beats writing a long agent loop in code.

Real workflow

3 YAML files: 长文本扩展 + 循环扩充文本 + Tool-StyleChecker

Loop control

Dify loop node · conversation vars zishu/tetx_new/history · if-else ≥ budget

Best signal

Stateful low-code orchestration with per-step model choice