{
    "name": "AgentBrains - Customer Support Assistant (RAG Agent)",
    "flow": [
        {
            "id": 1,
            "module": "gateway:CustomWebHook",
            "version": 1,
            "parameters": {
                "hook": 3270664,
                "maxResults": 1
            },
            "mapper": {},
            "metadata": {
                "designer": {
                    "x": 0,
                    "y": 0
                },
                "restore": {
                    "parameters": {
                        "hook": {
                            "data": {
                                "editable": "true"
                            },
                            "label": "Customer support example flow"
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "hook",
                        "type": "hook:gateway-webhook",
                        "label": "Webhook",
                        "required": true
                    },
                    {
                        "name": "maxResults",
                        "type": "number",
                        "label": "Maximum number of results"
                    }
                ],
                "interface": [
                    {
                        "name": "message",
                        "type": "text"
                    },
                    {
                        "name": "conversation_id",
                        "type": "text"
                    },
                    {
                        "name": "customer_name",
                        "type": "text"
                    }
                ]
            }
        },
        {
            "id": 2,
            "module": "app#agentbrains-pulssc:getCompanyData",
            "version": 1,
            "parameters": {
                "__IMTCONN__": 7785706
            },
            "mapper": {},
            "metadata": {
                "designer": {
                    "x": 300,
                    "y": 0
                },
                "restore": {
                    "parameters": {
                        "__IMTCONN__": {
                            "data": {
                                "scoped": "true",
                                "connection": "app#agentbrains-pulssc"
                            },
                            "label": "ATN Stage"
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "__IMTCONN__",
                        "type": "account:app#agentbrains-pulssc",
                        "label": "Connection",
                        "required": true
                    }
                ]
            }
        },
        {
            "id": 3,
            "module": "ai-local-agent:RunLocalAIAgent",
            "version": 0,
            "parameters": {
                "makeConnectionId": 5454725
            },
            "mapper": {
                "files": [],
                "message": "{{1.message}}",
                "timeout": "",
                "threadId": "",
                "outputType": "make-schema",
                "modelConfig": {
                    "recursionLimit": 300,
                    "iterationsFromHistoryCount": "10"
                },
                "defaultModel": "large",
                "outputSchema": [
                    {
                        "help": "",
                        "name": "answer",
                        "type": "text",
                        "label": "Answer",
                        "default": "",
                        "required": false,
                        "multiline": false
                    },
                    {
                        "help": "",
                        "name": "imageId",
                        "type": "text",
                        "label": "Image ID",
                        "default": "",
                        "required": false,
                        "multiline": false
                    }
                ],
                "systemPrompt": "You are a customer support agent for {{2.companyInfo}}. Always ground your answers in the AgentBrains knowledge base: use the 'Retrieve Text from RAG' tool to find accurate context before answering, and use 'Retrieve Images from RAG' whenever a diagram or product photo would help the customer. Respond ONLY with a single minified JSON object, no markdown, no extra text, in exactly this shape: {\"answer\": \"<your reply to the customer>\", \"imageId\": \"<the id from \"sourceId\" field of the single best image from Retrieve Images from RAG, or null if no image is relevant>\"}."
            },
            "metadata": {
                "designer": {
                    "x": 600,
                    "y": 0
                },
                "restore": {
                    "expect": {
                        "files": {
                            "mode": "chose"
                        },
                        "outputType": {
                            "label": "Data structure"
                        },
                        "defaultModel": {
                            "mode": "chose",
                            "label": "LargeModel: gpt-5-mini. Reasoning: low. Powerful model built for complex logic puzzles and high-level reasoning tasks"
                        },
                        "outputSchema": {
                            "items": [
                                null,
                                null
                            ]
                        }
                    },
                    "parameters": {
                        "makeConnectionId": {
                            "data": {
                                "scoped": "true",
                                "connection": "ai-provider"
                            },
                            "label": "OpenAI"
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "makeConnectionId",
                        "type": "account:ai-provider,openai-gpt-3,anthropic-claude,gemini-ai-q9zyjp,ai-agent-foundry-openai,ai-agent-foundry-non-openai,mistral-ai,cohere,groq,ai-agent-xai,amazon-bedrock,ai-agent-openai-compatible",
                        "label": "Connection",
                        "required": true
                    }
                ],
                "expect": [
                    {
                        "name": "defaultModel",
                        "type": "select",
                        "label": "Model",
                        "required": true
                    },
                    {
                        "name": "systemPrompt",
                        "type": "text",
                        "label": "Instructions"
                    },
                    {
                        "name": "message",
                        "type": "text",
                        "label": "Input",
                        "required": true
                    },
                    {
                        "name": "files",
                        "spec": [
                            {
                                "name": "fileName",
                                "type": "filename",
                                "label": "File name",
                                "semantic": "file:name"
                            },
                            {
                                "name": "data",
                                "type": "buffer",
                                "label": "Data",
                                "semantic": "file:data"
                            }
                        ],
                        "type": "array",
                        "label": "Input files"
                    },
                    {
                        "name": "threadId",
                        "type": "text",
                        "label": "Conversation ID"
                    },
                    {
                        "name": "modelConfig",
                        "spec": [
                            {
                                "name": "tokenLimit",
                                "type": "hidden",
                                "label": "Max output tokens"
                            },
                            {
                                "name": "recursionLimit",
                                "type": "hidden",
                                "label": "Steps per agent call"
                            },
                            {
                                "name": "iterationsFromHistoryCount",
                                "type": "number",
                                "label": "Maximum conversation history"
                            }
                        ],
                        "type": "collection",
                        "label": "Model configuration"
                    },
                    {
                        "name": "timeout",
                        "type": "number",
                        "label": "Step timeout",
                        "validate": {
                            "max": 600,
                            "min": 120
                        }
                    },
                    {
                        "name": "outputType",
                        "type": "select",
                        "label": "Response format",
                        "required": true,
                        "validate": {
                            "enum": [
                                "text",
                                "make-schema",
                                "udt-schema"
                            ]
                        }
                    },
                    {
                        "name": "outputSchema",
                        "spec": [
                            {
                                "name": "name",
                                "type": "text",
                                "label": "Name",
                                "required": true,
                                "placeholder": "Enter name"
                            },
                            {
                                "name": "label",
                                "type": "text",
                                "label": "Label"
                            },
                            {
                                "name": "help",
                                "type": "text",
                                "label": "Description",
                                "placeholder": "Enter description"
                            },
                            {
                                "name": "type",
                                "type": "udttype",
                                "label": "Type",
                                "required": true
                            }
                        ],
                        "type": "udtspec",
                        "label": "Response structure",
                        "required": true
                    }
                ],
                "advanced": true
            },
            "tools": [
                {
                    "name": "Retrieve Images from RAG",
                    "description": "Semantic search for relevant images (diagrams, product photos) in the knowledge base. Returns candidate image IDs.",
                    "flow": [
                        {
                            "id": 11,
                            "module": "app#agentbrains-pulssc:retrieveImages",
                            "version": 1,
                            "parameters": {
                                "__IMTCONN__": 7785706
                            },
                            "mapper": {
                                "topK": "5",
                                "query": "{{3.query}}"
                            },
                            "metadata": {
                                "designer": {
                                    "x": 447,
                                    "y": 324
                                },
                                "restore": {
                                    "expect": {
                                        "query": {
                                            "extra": {
                                                "aiHelp": "The natural language image search phrase to retrieve relevant images from the knowledge base."
                                            }
                                        }
                                    },
                                    "parameters": {
                                        "__IMTCONN__": {
                                            "data": {
                                                "scoped": "true",
                                                "connection": "app#agentbrains-pulssc"
                                            },
                                            "label": "ATN Stage"
                                        }
                                    }
                                },
                                "parameters": [
                                    {
                                        "name": "__IMTCONN__",
                                        "type": "account:app#agentbrains-pulssc",
                                        "label": "Connection",
                                        "required": true
                                    }
                                ],
                                "expect": [
                                    {
                                        "name": "query",
                                        "type": "text",
                                        "label": "Query",
                                        "required": true
                                    },
                                    {
                                        "name": "topK",
                                        "type": "integer",
                                        "label": "Top K",
                                        "required": true
                                    }
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Retrieve Text from RAG",
                    "description": "Semantic search over the AgentBrains knowledge base for text context relevant to the customer's question.",
                    "flow": [
                        {
                            "id": 16,
                            "module": "app#agentbrains-pulssc:retrieveText",
                            "version": 1,
                            "parameters": {
                                "__IMTCONN__": 7785706
                            },
                            "mapper": {
                                "topK": "5",
                                "index": "6a1ffd3bf8891c9885878131",
                                "query": "{{3.query}}"
                            },
                            "metadata": {
                                "designer": {
                                    "x": 835,
                                    "y": 308
                                },
                                "restore": {
                                    "expect": {
                                        "index": {
                                            "mode": "chose",
                                            "label": "Core Text Index (All Documents)"
                                        },
                                        "query": {
                                            "extra": {
                                                "aiHelp": "The natural language question or search phrase to retrieve relevant knowledge base context for."
                                            }
                                        }
                                    },
                                    "parameters": {
                                        "__IMTCONN__": {
                                            "data": {
                                                "scoped": "true",
                                                "connection": "app#agentbrains-pulssc"
                                            },
                                            "label": "ATN Stage"
                                        }
                                    }
                                },
                                "parameters": [
                                    {
                                        "name": "__IMTCONN__",
                                        "type": "account:app#agentbrains-pulssc",
                                        "label": "Connection",
                                        "required": true
                                    }
                                ],
                                "expect": [
                                    {
                                        "name": "index",
                                        "type": "select",
                                        "label": "Index"
                                    },
                                    {
                                        "name": "query",
                                        "type": "text",
                                        "label": "Query",
                                        "required": true
                                    },
                                    {
                                        "name": "topK",
                                        "type": "integer",
                                        "label": "Top K",
                                        "required": true
                                    },
                                    {
                                        "name": "metadata",
                                        "type": "text",
                                        "label": "Metadata JSON"
                                    }
                                ]
                            }
                        }
                    ]
                }
            ]
        },
        {
            "id": 4,
            "module": "builtin:BasicRouter",
            "version": 1,
            "mapper": null,
            "metadata": {
                "designer": {
                    "x": 900,
                    "y": 0
                }
            },
            "routes": [
                {
                    "flow": [
                        {
                            "id": 12,
                            "module": "app#agentbrains-pulssc:getAttachment",
                            "version": 1,
                            "parameters": {
                                "__IMTCONN__": 7785706
                            },
                            "filter": {
                                "name": "Has image",
                                "conditions": [
                                    [
                                        {
                                            "a": "{{3.jsonResponse.imageId}}",
                                            "b": "",
                                            "o": "text:notequal"
                                        }
                                    ]
                                ]
                            },
                            "mapper": {
                                "id": "{{3.jsonResponse.imageId}}"
                            },
                            "metadata": {
                                "designer": {
                                    "x": 1224,
                                    "y": -133
                                },
                                "restore": {
                                    "parameters": {
                                        "__IMTCONN__": {
                                            "data": {
                                                "scoped": "true",
                                                "connection": "app#agentbrains-pulssc"
                                            },
                                            "label": "ATN Stage"
                                        }
                                    }
                                },
                                "parameters": [
                                    {
                                        "name": "__IMTCONN__",
                                        "type": "account:app#agentbrains-pulssc",
                                        "label": "Connection",
                                        "required": true
                                    }
                                ],
                                "expect": [
                                    {
                                        "name": "id",
                                        "type": "text",
                                        "label": "Attachment ID",
                                        "required": true
                                    }
                                ]
                            }
                        },
                        {
                            "id": 13,
                            "module": "gateway:WebhookRespond",
                            "version": 1,
                            "parameters": {},
                            "mapper": {
                                "body": "{\n  \"message\": \"{{3.jsonResponse.answer}}\",\n  \"image_url\": \"{{12.url}}\",\n  \"conversation_id\": \"{{1.conversation_id}}\"\n}",
                                "status": "200",
                                "headers": [
                                    {
                                        "key": "Content-Type",
                                        "value": "application/json"
                                    }
                                ]
                            },
                            "metadata": {
                                "designer": {
                                    "x": 1544,
                                    "y": -186
                                },
                                "restore": {
                                    "expect": {
                                        "headers": {
                                            "mode": "chose",
                                            "items": [
                                                null
                                            ]
                                        }
                                    }
                                },
                                "expect": [
                                    {
                                        "name": "status",
                                        "type": "uinteger",
                                        "label": "Status",
                                        "required": true,
                                        "validate": {
                                            "min": 100
                                        }
                                    },
                                    {
                                        "name": "body",
                                        "type": "any",
                                        "label": "Body"
                                    },
                                    {
                                        "name": "headers",
                                        "spec": [
                                            {
                                                "name": "key",
                                                "type": "text",
                                                "label": "Key",
                                                "required": true,
                                                "validate": {
                                                    "max": 256
                                                }
                                            },
                                            {
                                                "name": "value",
                                                "type": "text",
                                                "label": "Value",
                                                "required": true,
                                                "validate": {
                                                    "max": 4096
                                                }
                                            }
                                        ],
                                        "type": "array",
                                        "label": "Custom headers",
                                        "validate": {
                                            "maxItems": 16
                                        }
                                    }
                                ],
                                "advanced": true
                            }
                        }
                    ]
                },
                {
                    "flow": [
                        {
                            "id": 14,
                            "module": "gateway:WebhookRespond",
                            "version": 1,
                            "parameters": {},
                            "filter": {
                                "name": "No image",
                                "conditions": [
                                    [
                                        {
                                            "a": "{{3.jsonResponse.imageId}}",
                                            "b": "",
                                            "o": "text:equal"
                                        }
                                    ]
                                ]
                            },
                            "mapper": {
                                "body": "{\n  \"message\": \"{{3.jsonResponse.answer}}\",\n  \"conversation_id\": \"{{1.conversation_id}}\"\n}",
                                "status": "200",
                                "headers": [
                                    {
                                        "key": "Content-Type",
                                        "value": "application/json"
                                    }
                                ]
                            },
                            "metadata": {
                                "designer": {
                                    "x": 1236,
                                    "y": 158
                                },
                                "restore": {
                                    "expect": {
                                        "headers": {
                                            "mode": "chose",
                                            "items": [
                                                null
                                            ]
                                        }
                                    }
                                },
                                "expect": [
                                    {
                                        "name": "status",
                                        "type": "uinteger",
                                        "label": "Status",
                                        "required": true,
                                        "validate": {
                                            "min": 100
                                        }
                                    },
                                    {
                                        "name": "body",
                                        "type": "any",
                                        "label": "Body"
                                    },
                                    {
                                        "name": "headers",
                                        "spec": [
                                            {
                                                "name": "key",
                                                "type": "text",
                                                "label": "Key",
                                                "required": true,
                                                "validate": {
                                                    "max": 256
                                                }
                                            },
                                            {
                                                "name": "value",
                                                "type": "text",
                                                "label": "Value",
                                                "required": true,
                                                "validate": {
                                                    "max": 4096
                                                }
                                            }
                                        ],
                                        "type": "array",
                                        "label": "Custom headers",
                                        "validate": {
                                            "maxItems": 16
                                        }
                                    }
                                ],
                                "advanced": true
                            }
                        }
                    ]
                }
            ]
        }
    ],
    "metadata": {
        "instant": true,
        "version": 1,
        "scenario": {
            "roundtrips": 1,
            "maxErrors": 3,
            "autoCommit": true,
            "autoCommitTriggerLast": true,
            "sequential": false,
            "slots": null,
            "confidential": false,
            "dataloss": false,
            "dlq": false,
            "freshVariables": false
        },
        "designer": {
            "orphans": []
        },
        "zone": "eu1.make.com",
        "notes": []
    }
}