Mastering Agentflow
Agentflow is the most powerful builder in CiniterFlow. If Assistants are like microwaves and Chatflows are like stoves, Agentflow is like a full professional kitchen β you can create anything.
What Makes Agentflow Special?β
Agentflow lets you build things that aren't possible with Assistants or Chatflows:
- Multiple AI agents working together (one researches, another writes, another reviews)
- Conditional branching ("if the customer asks about billing, go to the billing agent")
- Loops ("keep improving this answer until it's good enough")
- Human approval ("pause and wait for a human to approve before sending this email")
- Shared memory (agents can pass information to each other)
- Form inputs (collect structured data from users before starting)
The Building Blocks (Nodes)β
Agentflow has 14 types of nodes. Here's what each one does in plain English:
1. π’ Start Nodeβ
What it does: The starting point of every flow. Every Agentflow begins here.
Key settings:
- Chat Input: Users type messages freely (like a normal chatbot)
- Form Input: Users fill out a structured form (like a contact form)
- Flow State: Set up shared variables that all nodes can read and update
2. π§ LLM Nodeβ
What it does: Sends a request to an AI model and gets a response. Use this when you need the AI to think, analyze, summarize, or generate text.
Key settings:
- Model: Which AI to use
- Messages: Instructions for the AI (system prompt)
- JSON Structured Output: Force the AI to respond in a specific format (great for extracting data)
- Update Flow State: Save the AI's response to a shared variable
3. π€ Agent Nodeβ
What it does: An AI that can think AND take action. Unlike the LLM node (which just generates text), an Agent can use tools, search knowledge bases, and make decisions about what to do next.
Key settings:
- Tools: What actions the agent can take
- Knowledge: What documents the agent can search
- System Message: Instructions for the agent's behavior
4. π§ Tool Nodeβ
What it does: Runs a specific tool at a specific point in your workflow. Unlike the Agent (which decides when to use tools), the Tool node always runs the tool you specify.
Use when: You know exactly which tool needs to run and when.
5. π Retriever Nodeβ
What it does: Searches through your document stores and returns relevant information. It's like having a librarian who finds the right pages for you.
6. π HTTP Nodeβ
What it does: Makes web requests to external APIs. Use this to fetch data from or send data to other services.
7. π Condition Nodeβ
What it does: Makes decisions based on rules you define. Like a traffic light β it checks a condition and sends the flow down different paths.
Example: "If the customer's order total is over $100, apply a discount. Otherwise, proceed normally."
8. π€ Condition Agent Nodeβ
What it does: Like the Condition Node, but uses AI to make the decision instead of fixed rules. The AI reads the input and decides which path to take.
Example: "Read this customer message and decide if it's about sales, support, or a general question."
9. π Iteration Nodeβ
What it does: Runs a set of steps for each item in a list. Like a "for each" loop.
Example: "For each research task in this list, spawn an agent to investigate it."
10. β©οΈ Loop Nodeβ
What it does: Sends the flow back to a previous step. This creates a retry or improvement cycle.
Example: "If the generated SQL query has errors, go back and regenerate it."
11. β Human Input Nodeβ
What it does: Pauses the flow and waits for a human to approve, reject, or provide feedback.
Example: "Show the draft email to a human. If they approve, send it. If they reject, go back and revise."
12. π¬ Direct Reply Nodeβ
What it does: Sends a message to the user and ends that branch of the flow.
13. β‘ Custom Function Nodeβ
What it does: Runs custom JavaScript code. For when you need to do something that no other node can do.
14. π Execute Flow Nodeβ
What it does: Runs another CiniterFlow flow from within your current flow. Great for reusing flows you've already built.
Building Your First Agentflowβ
Let's build a simple but powerful agent that can answer questions and search the web:
Step 1: Add the Start Nodeβ
- Go to Agentflows in the sidebar and click "+ Add New"
- You'll see a Start node already on the canvas
- Click on it and set:
- Input Type: Chat Input
- Leave everything else as default
Step 2: Add an Agent Nodeβ
- From the node panel, drag an Agent node onto the canvas
- Connect the Start node to the Agent node (drag from the output dot to the input dot)
- Click on the Agent node and configure:
- Model: Select ChatOpenAI with your credential, model
gpt-4o-mini - Messages: Add a System message: "You are a helpful research assistant. Answer questions thoroughly and cite your sources when possible."
- Model: Select ChatOpenAI with your credential, model
Step 3: Add a Toolβ
- In the Agent node's configuration, scroll to Tools
- Click "+ Add Tool"
- Select a web search tool (like "Google Custom Search" or "Serper")
- Configure the tool with its required credentials
Step 4: Save and Testβ
- Click Save
- Open the chat panel and ask: "What are the latest developments in renewable energy?"
- Watch as the agent decides to search the web and then summarizes the findings!
Understanding Flow Stateβ
Flow State is like a shared notebook that all nodes in your flow can read from and write to. It's incredibly useful for passing data between steps.
How to Use Flow Stateβ
Step 1: Declare variables in the Start node
Key: "summary" Value: ""
Key: "approved" Value: "false"
Step 2: Update variables in other nodes In any LLM, Agent, or Tool node, use the "Update Flow State" setting:
Key: "summary" Value: {{ output }}
Step 3: Read variables anywhere In any node's text field, use:
{{ $flow.state.summary }}
Referencing Data Between Nodesβ
You can reference the output of any previous node using the {{ }} syntax. When you type {{, a dropdown will appear showing all available variables:
{{ question }}β The user's original message{{ $flow.state.myVariable }}β A flow state variable{{ llmAgentflow_0 }}β Output from a specific LLM node{{ agentAgentflow_0 }}β Output from a specific Agent node{{ $form.fieldName }}β A form input value{{ current_date_time }}β The current date and time
Common Agentflow Patternsβ
Pattern 1: Route and Respondβ
Start β Condition Agent β Agent A (sales)
β Agent B (support)
β Agent C (general)
The Condition Agent reads the user's message and routes it to the right specialist.
Pattern 2: Generate and Validateβ
Start β LLM (generate) β Condition Agent (validate) β Output (if good)
β Loop back (if bad)
Generate something, check if it's good, and retry if it's not.
Pattern 3: Research and Synthesizeβ
Start β LLM (plan) β Iteration (research tasks) β Agent (research each)
β LLM (write report)
Break a big question into smaller tasks, research each one, then combine the findings.
Pattern 4: Human Approvalβ
Start β Agent (draft) β Human Input β Tool (send) if approved
β Loop back if rejected
Generate something, get human approval, then take action.
Tips for Building Great Agentflowsβ
- Start with a sketch: Before building, draw out your flow on paper. What are the steps? What decisions need to be made?
- Keep it simple first: Build the simplest version that works, then add complexity
- Use Flow State wisely: Only create state variables you actually need
- Set loop limits: Always set a max loop count (default is 5) to prevent infinite loops
- Test each branch: Make sure every possible path through your flow works correctly
- Use descriptive names: Name your nodes clearly so you can understand the flow at a glance
What's Next?β
Now that you understand Agentflow, let's learn how to give your agents knowledge by uploading and managing documents.