Common AI Agent Flow Patterns
The definition of "AI agent" varies widely. Some clients believe that AI agents are fully autonomous systems capable of running independently for long periods, using various tools to complete complex tasks. Others think of AI agents as systems that execute according to predefined workflows.
At Gendial, we categorize these systems as AI agent systems, but we focus on differentiating between workflow-based and fully autonomous architectures:
Workflow-based AI Agent: Large language models and tools are orchestrated through predefined node paths.
Fully Autonomous AI Agent: The large language model dynamically guides its own flow and tool usage, autonomously deciding how to complete tasks.
Practice shows that when developing applications using large language models, the simpler, the better! Complexity should only be added when necessary. This means you may not even need fully autonomous AI agents. Fully autonomous systems often trade off with delays and costs for better task performance. Moreover, the performance of fully autonomous agents heavily depends on the capabilities of the large language model and cannot guarantee strong consistency. In enterprise/school environments, we recommend the workflow-based AI agent model.
Specifically:
Workflow-based AI Agent: Suitable for handling well-defined tasks, providing predictability and consistency.
Fully Autonomous AI Agent: Better suited for scenarios requiring flexibility and model-driven decision-making.
Here are several common AI agent flow patterns:
Workflow: Single-point Loop Q&A
This pattern represents the simplest AI AI agent flow and can be considered the "Hello World" of AI-native AI agents. The entire flow is a loop of an output node.
This process is simple but practical. By setting the corresponding AI agent persona and output node prompts, you can easily create a Q&A system based on the model's native capabilities. By configuring the appropriate knowledge base, you can even implement AI Q&A based on the knowledge base.
Tip: If you've created an AI agent and a knowledge base, but the AI agent makes up answers to questions it doesn't understand or that are outside the knowledge base’s scope, how can you make it answer only from the knowledge base?
The trick is to limit its answer range within the AI agent settings and specify that the answers must come from the provided context. Here's an example:
You only answer questions related to [product usage, after-sales service, order inquiries]. Answers must come from the provided product manual and customer service script library. If the question is beyond this scope, answer: "Sorry, I can only assist with product usage and order-related issues!"
Key Points in Designing Prompts
- Scope Lockdown: Use "only answer questions about XXX" to clearly define boundaries.
- Source Limitation: Emphasize "answers must come from the context/provided materials."
- Refusal Script: Design friendly but firm refusal templates (e.g., "Can't answer at the moment" or "Please contact XX").
- Hallucination Defense: It's safer to say "I don't know" than to fabricate an answer.
Typical Scenarios:
- Enterprise customer service assistant
- Sales inquiry chatbot
- Internal knowledge base Q&A
- Domain-specific experts (e.g., wine experts)
Workflow: Information Gathering by Process
By using the Get Information node, we can configure the AI agent to gather necessary information in a specific process, such as an after-sales repair scenario. The AI agent will proactively ask the user for required information and store it in a custom output variable. The gathered information can be sent to an existing business/order system through an API or code node, enabling truly AI customer service repairs.
Typical Scenarios:
1. AI After-sales RepairProcess:Product fault report → Guide the user to take photos of the fault → Automatically record device serial number → Call API to create a work order
Information to Gather:
① Product model ② Fault description ③ On-site photo/video ④ Contact information
System Integration: Integrate with Zendesk/ServiceNow work order system through code node
Application Scenario: Automated repair services for home appliances, smart hardware manufacturers
2. Medical Appointment ServicesProcess:Symptom description → AI triage → Recommended department → Sync available appointment slots
Information to Gather:
① Main symptoms ② Medical history ③ Preferred appointment time ④ Medical insurance type
System Integration: Integrate with hospital HIS system's appointment interface via code node
Application Scenario: Smart appointment platform for online hospitals or private clinics
3. Custom Order Processing
Process:Product selection → Confirm size/color → Collect special requirements → Automatically generate order PDF
Information to Gather:
① Product SKU ② Customization parameters ③ Shipping address ④ Invoice information
System Integration: Call ERP system’s order creation API
Application Scenario: Clothing customization, B2B client procurement, etc.
4. IT Fault Response
Process:Error code identification → System log retrieval → Impact assessment → Automatically upgrade work order
Information to Gather:
① Error screenshot ② Device IP/MAC address ③ Recent operation log ④ Urgency level
System Integration: Integrate with Jira/Slack for alert notifications
Application Scenario: Enterprise IT service L1 fault handling
5. Insurance Claim Preliminary Review
Process:Accident type identification → Material list generation → Upload image data → Preliminary damage assessment
Information to Gather:
① Policy number ② On-site photos ③ Police report number ④ Hospital diagnosis report
System Integration: Interface with insurance core system’s claims module
Application Scenario: Fast claim channels for car insurance and health insurance
Key Points in Process Design
- Progressive Information Collection: Design a 5-7 step interaction loop, asking one key piece of information at a time.
- Input Validation Mechanism: Add code nodes to validate fields like ID numbers or dates using regular expressions.
- Checkpoint Resume Function: Allow users to exit and later resume from the last step.
- Multimodal Input: Support various input methods like image uploads and speech-to-text.
Such process-based AI agents can reduce business tasks that typically take 2-3 days to complete to under 10 minutes, making them especially suited for business scenarios that require structured data collection.
Workflow: Determine User Intent and Match Different Branches
Using the large language model's natural language intent recognition capabilities, we can easily determine the user’s desired service and flow from the semantics of their input, and match different process branches. Different branches can be subsequent processing nodes or different AI agents working together to fulfill the user's needs.
Typical Scenarios:
1. Government Service Hall / School Service HallIntent Recognition: Automatically parse over 700+ government services such as "reapply for social security card", "maternity subsidy application", "business registration"
Flow Branches:
- Material list generation → Pre-screening form → Appointment for handling window
- Automatically jump to the corresponding department's AI agent (e.g., Human Resources Bureau, Market Supervision Bureau)
Efficiency Improvement: Reduces 80% of manual window consultation requests
2. E-commerce/Supermarket Customer ServiceIntent Recognition: Accurately interpret high-frequency inquiries like "order status check", "return/exchange request", "promotion rules inquiry", "stock out follow-up", "payment failure handling"
Flow Distribution:
- Order Issues (e.g., delayed logistics) → Call order system API → Embed real-time logistics map → Generate automatic compensation plan for abnormal orders
- Return/Exchange Process → Guide user to upload product photos → OCR to recognize invoice info → Call ERP to generate RMA number → Integrate with SF Express for pickup API
- Promotion Inquiry → Link to user’s historical shopping cart data → Calculate real-time coupon/discount rules → Generate personalized recommendation pop-ups
- Out of Stock Alert → Automatically trigger back-in-stock notification subscription → Recommend competing products (whitelist required) → Notify procurement department via WeChat Work
3. Airline Customer Service Multimodal RoutingIntent Recognition: Understand queries such as "flight reschedule/cancellation", "lost luggage", "special meal booking"
Flow Branches:
- Reschedule/Cancellation → Policy explanation → Refund amount calculation API
- Luggage Issues → Integrate with work order system and airport ground services
Workflow: Automated Process Handling
By using loops and concurrent processes, AI workflow automation for various documents/data can be achieved.
Typical Scenarios:
1. Legal Contract Bulk Processing
Scenario:
Bulk review of 500+ cross-border merger agreements for compliance, risk clause extraction, and multi-language version generation
- Loop Process: Automatically loop through contract library → Flag dispute clauses → Generate revision suggestions → Export revised annotated versions
- Concurrent Processing: Run multiple AI agents in parallel to handle different contract sections (e.g., confidentiality clauses, payment clauses, breach of contract)
Efficiency Improvement: Significantly shortens the contract review cycle, reducing costs and increasing efficiency
2. Scientific Paper Pre-Review
Scenario:
Process 300 preprint papers daily for domain classification, innovation point extraction, and draft review comments
- Loop Review: Parse PDFs → Evaluate methodology → Check reproducibility → Generate review template
- Concurrent Analysis: Multiple AI agents process chart data extraction, reference verification, and plagiarism detection
Fully Autonomous: Deciding Which Tools to Use
On the Gendial platform, we can also create fully autonomous AI agents. The core of such an AI agent is a judgment node, which requires carefully designed prompt words to determine which tools to use, how to handle the results of each tool, etc.
This is the basic flow of a fully autonomous AI agent. Note that only two tools are demonstrated here. If more tools need to be added, they can be incorporated as needed.
This is the prompt for the judgment node. If you need to add more tools or require more complex judgment logic, you can modify it as needed.
Based on the current tool call results, determine whether a corresponding tool is needed to answer the question or if it can be answered directly without using any tools.
Question
---------------
{{q}}
Available Tools
---------------
Internet Search: Used to find the latest news or professional information
Weather Inquiry: Can query real-time weather in specific cities
Tool Call Results
---------------
Internet search result:{{result1}}
Weather result: {{result}}
Note: After calling the tool and obtaining results, a new judgment is made based on the results, so please think step by step to avoid repeatedly calling the same tool.