Workflow

A Workflow is a visual directed graph: each node does one job (model, retrieve, branch, code), and edges fix the order. Use it when the steps are stable, testable, and must not be rewritten by the model. Official Chatflow uses the same nodes, but runs the graph once per user turn, with conversation variables and streaming answers.

Compare LangGraph workflows: there you write StateGraph nodes; here you wire a canvas. Same mental model—a graph is more predictable than a free agent.

flowchart LR
  S[Start / User Input] --> K[Knowledge Retrieval]
  K --> L[LLM]
  L --> O[Output / Answer]

Workflow vs Agent

Prefer Workflow / ChatflowPrefer Agent
Classify, then a fixed deskYou cannot know how many tool calls
Compliance: every step auditableExploratory work, changing toolsets
Batch, cron, webhookOpen-ended multi-turn chat
Same path must reproduceYou accept planning variance

A hybrid also works: keep the big graph as a Workflow and drop in an Agent node for “this step may use tools.” New projects are steered toward Workflow / Chatflow; Chatbot / Agent basic apps are thinner shells.


Head and tail

WorkflowChatflow
StartUser Input (human/API) or a Trigger (schedule, webhook, integration)User Input only (one chat turn)
EndOutput (optional fields back to the caller)Answer (the chat reply; usually required)

Fields on User Input become variables later nodes can reference (often inserted with /). The system also injects sys.user_id, sys.app_id, sys.workflow_run_id, and—on Chatflow—sys.conversation_id, sys.dialogue_count.


Nodes worth learning first

NodeJob
LLMCall a configured language model; optional memory on Chatflow
Knowledge RetrievalSearch a dataset; pass hits downstream as context
Question ClassifierBucket the input so different edges fire
If-ElseDeterministic branch on a variable
AgentA short autonomous tool loop inside the graph
CodeSmall Python / JS transforms
HTTP RequestCall an external API
TemplateJinja2 text assembly
Iteration / LoopArrays or repeated steps
Parameter ExtractorStructured fields from natural language
ToolInstalled tool plugins

You will also see document extractors, list ops, variable assign/aggregate, and human-input pauses. Wire Input → LLM → Output first, then add retrieval and classification. Do not start with thirty nodes.

Debug with single-node runs, the variable inspector, and run history (labels follow your Studio build). Failures are usually a bad key, an empty dataset, or a variable that never reached the next node.


A graph you can explain: classify, then answer

Goal: bucket the question as faq vs other. FAQ goes through knowledge + LLM; other gets a polite refusal LLM.

  1. Start / User Input: field query (or the default user-message variable)
  2. Question Classifier: classes faq, other
  3. faq edge → Knowledge Retrieval (query = user text) → LLM (answer only from hits)
  4. other edge → LLM (this assistant only covers the knowledge base)
  5. Merge into Output / Answer

That is easier to test than “one agent decides”: prepare ten faq and ten other lines and watch the classifier. Full walkthrough: Practical Examples.


Relation to Chatbot

A Chatbot is linear: prompt plus optional knowledge. The moment you need explicit branches, loops, HTTP, or a human gate, move to Chatflow / Workflow instead of a novel-length prompt. Export DSL (YAML) to move apps between instances; keep secrets in environment variables so the file cannot leak them.


Next steps

评论