Workflow:Infiniflow Ragflow Agent Workflow Building
| Knowledge Sources | |
|---|---|
| Domains | RAG, Agentic_AI, Workflow_Orchestration, LLMs |
| Last Updated | 2026-02-12 06:00 GMT |
Overview
End-to-end process for building, configuring, and executing agentic AI workflows using RAGFlow's visual canvas editor, which orchestrates multi-step pipelines combining LLM calls, knowledge retrieval, branching logic, external tools, and code execution.
Description
This workflow covers the creation and execution of agent workflows (canvases) in RAGFlow. The agent system provides a visual graph-based editor where users design multi-step AI pipelines by connecting operator nodes. Available operators include Begin (user input), Retrieval (knowledge base search), Generate (LLM response), Categorize (intent classification), Switch (conditional branching), Iteration (loops), Message (static responses), Rewrite (query rewriting), and various external tool integrations (Tavily search, Wikipedia, code execution via sandbox, MCP tools). The workflow DSL is stored as JSON and executed by the Graph/Canvas engine which traverses the directed graph, executing components in sequence with support for streaming output, error handling, concurrency control, and task cancellation. Agents support templates for common patterns and can be shared, embedded, or accessed via API.
Usage
Execute this workflow when you need to build an AI application that goes beyond simple question-answering, requiring multi-step reasoning, conditional logic, external tool usage, or custom processing pipelines. Use it for complex scenarios such as multi-turn customer support bots, research assistants that search multiple sources, automated data extraction workflows, or any task requiring orchestrated AI capabilities.
Execution Steps
Step 1: Create Agent
Create a new agent from scratch or select from pre-built templates. RAGFlow provides templates for common agent patterns. The agent is created with a name and optional description, which generates a new canvas (UserCanvas) record. Users can also import agent configurations from JSON files or duplicate existing agents.
Key considerations:
- Templates provide pre-configured graph structures for common use cases
- Agents can be categorized as either Agent type (conversational) or Flow type (data pipeline)
- Each agent has its own canvas with independent configuration
- Agents can be imported/exported as JSON for sharing and backup
Step 2: Design the Graph
Use the visual canvas editor to build the agent's execution graph by adding and connecting operator nodes. The editor supports drag-and-drop node placement, edge connections between node ports, and visual configuration of each node's parameters. The graph defines the execution flow from the Begin node (user input entry point) through processing nodes to terminal nodes.
Available operator types:
- Begin: Entry point that captures user input, file uploads, and configures initial parameters
- Retrieval: Searches knowledge bases using the RAG pipeline
- Generate: Calls an LLM to produce text responses
- Categorize: Classifies input into predefined categories for branching
- Switch: Conditional branching based on variable conditions
- Message: Returns static or template-based text messages
- Rewrite: Uses an LLM to reformulate queries for better retrieval
- Iteration: Loops over a set of items executing a sub-graph for each
- Code Executor: Runs Python or JavaScript code in a sandboxed environment
- Tool nodes: External integrations (Tavily, Wikipedia, DuckDuckGo, SQL, etc.)
- MCP Tools: Model Context Protocol tool connections
Step 3: Configure Operator Parameters
Configure each operator node with its specific parameters. For Retrieval nodes, select knowledge bases and set similarity thresholds. For Generate nodes, choose the LLM model, set temperature and prompt templates with variable references. For Categorize nodes, define categories and their routing. Variables between nodes are referenced using the template syntax.
Key considerations:
- Variables flow between connected nodes using template references
- The Generate node prompt can reference output from upstream Retrieval nodes
- Retrieval nodes can query multiple knowledge bases simultaneously
- Categorize and Switch nodes enable branching logic for different user intents
- The Begin node can be configured to accept file uploads in addition to text
Step 4: Test the Agent
Use the built-in test runner to execute the agent with sample inputs. The test interface shows real-time execution progress, node-by-node output, and streaming LLM responses. Execution logs track timing, progress, and error information for each component. Debug mode provides detailed tracing of the graph traversal path.
What happens:
- The canvas DSL is validated and the graph is instantiated
- Execution begins at the Begin node and follows the graph edges
- Each node executes in sequence, with outputs flowing to downstream nodes
- Streaming responses are emitted as SSE events for real-time display
- Execution logs are stored in Redis for the test session
Once tested, the agent can be deployed for use. Agents can be accessed directly through the RAGFlow UI, embedded in external websites using an iframe code snippet, shared with team members, or accessed programmatically via the API. The agent supports persistent conversations with message history, and can optionally use memory stores for cross-conversation context retention.
Key considerations:
- Agents support embedding via iframe with customizable appearance
- API access enables integration with external applications
- Memory stores allow agents to remember information across conversations
- Conversation history is maintained per session
- Agents can be published with team-level or personal permissions