{
    "name": "AgentBrains - Sales Agent Context Flow",
    "flow": [
        {
            "id": 1,
            "module": "gateway:CustomWebHook",
            "version": 1,
            "parameters": {
                "hook": 3270831,
                "maxResults": 1
            },
            "mapper": {},
            "metadata": {
                "designer": {
                    "x": 0,
                    "y": 0
                },
                "restore": {
                    "parameters": {
                        "hook": {
                            "data": {
                                "editable": "true"
                            },
                            "label": "Sales context example flow"
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "hook",
                        "type": "hook:gateway-webhook",
                        "label": "Webhook",
                        "required": true
                    },
                    {
                        "name": "maxResults",
                        "type": "number",
                        "label": "Maximum number of results"
                    }
                ],
                "interface": [
                    {
                        "name": "employeeId",
                        "type": "text"
                    },
                    {
                        "name": "lead_question",
                        "type": "text"
                    },
                    {
                        "name": "lead_name",
                        "type": "text"
                    }
                ]
            }
        },
        {
            "id": 2,
            "module": "builtin:BasicRouter",
            "version": 1,
            "mapper": null,
            "metadata": {
                "designer": {
                    "x": 300,
                    "y": 0
                }
            },
            "routes": [
                {
                    "flow": [
                        {
                            "id": 3,
                            "module": "app#agentbrains-pulssc:getAnEmployeeConfiguration",
                            "version": 1,
                            "parameters": {
                                "__IMTCONN__": 7785706
                            },
                            "filter": {
                                "name": "Required fields present",
                                "conditions": [
                                    [
                                        {
                                            "a": "{{1.employeeId}}",
                                            "o": "exist"
                                        },
                                        {
                                            "a": "{{1.lead_question}}",
                                            "o": "exist"
                                        }
                                    ]
                                ]
                            },
                            "mapper": {
                                "employeeId": "{{1.employeeId}}"
                            },
                            "metadata": {
                                "designer": {
                                    "x": 600,
                                    "y": -150
                                },
                                "restore": {
                                    "expect": {
                                        "employeeId": {
                                            "mode": "edit"
                                        }
                                    },
                                    "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": "employeeId",
                                        "type": "select",
                                        "label": "Employee Name or ID",
                                        "required": true
                                    }
                                ]
                            }
                        },
                        {
                            "id": 4,
                            "module": "app#agentbrains-pulssc:getCompanyData",
                            "version": 1,
                            "parameters": {
                                "__IMTCONN__": 7785706
                            },
                            "mapper": {},
                            "metadata": {
                                "designer": {
                                    "x": 900,
                                    "y": -150
                                },
                                "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": 5,
                            "module": "ai-local-agent:RunLocalAIAgent",
                            "version": 0,
                            "parameters": {
                                "makeConnectionId": 5454725
                            },
                            "mapper": {
                                "files": [],
                                "message": "Lead name: {{1.lead_name}}\nQuestion: {{1.lead_question}}",
                                "timeout": "",
                                "threadId": "",
                                "outputType": "text",
                                "modelConfig": {
                                    "recursionLimit": 300,
                                    "iterationsFromHistoryCount": "10"
                                },
                                "defaultModel": "large",
                                "systemPrompt": "You are acting as the AgentBrains employee configured here: {{3.description}} . You represent {{4.companyInfo}}. Stay strictly within the role, tone, and behavior defined by that employee configuration. Use 'Retrieve Text from RAG' to ground any product or policy claims in the actual knowledge base. Never invent product details."
                            },
                            "metadata": {
                                "designer": {
                                    "x": 1200,
                                    "y": -150
                                },
                                "restore": {
                                    "expect": {
                                        "files": {
                                            "mode": "chose"
                                        },
                                        "outputType": {
                                            "label": "Text"
                                        },
                                        "defaultModel": {
                                            "mode": "chose",
                                            "label": "LargeModel: gpt-5-mini. Reasoning: low. Powerful model built for complex logic puzzles and high-level reasoning tasks"
                                        }
                                    },
                                    "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"
                                            ]
                                        }
                                    }
                                ]
                            },
                            "tools": [
                                {
                                    "name": "Retrieve Text from RAG",
                                    "description": "Semantic search over the AgentBrains knowledge base for context relevant to the lead's question.",
                                    "flow": [
                                        {
                                            "id": 22,
                                            "module": "app#agentbrains-pulssc:retrieveText",
                                            "version": 1,
                                            "parameters": {
                                                "__IMTCONN__": 7785706
                                            },
                                            "mapper": {
                                                "topK": "5",
                                                "index": "6a1ffd3bf8891c9885878131",
                                                "query": "{{5.query}}"
                                            },
                                            "metadata": {
                                                "designer": {
                                                    "x": 1500,
                                                    "y": 100
                                                },
                                                "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": 6,
                            "module": "gateway:WebhookRespond",
                            "version": 1,
                            "parameters": {},
                            "mapper": {
                                "body": "{\n  \"reply\": \"{{5.response}}\"\n}",
                                "status": "200",
                                "headers": [
                                    {
                                        "key": "Content-Type",
                                        "value": "application/json"
                                    }
                                ]
                            },
                            "metadata": {
                                "designer": {
                                    "x": 1500,
                                    "y": -150
                                },
                                "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": 7,
                            "module": "gateway:WebhookRespond",
                            "version": 1,
                            "parameters": {},
                            "filter": {
                                "name": "Missing required fields",
                                "conditions": [
                                    [
                                        {
                                            "a": "{{1.employeeId}}",
                                            "o": "notexist"
                                        }
                                    ],
                                    [
                                        {
                                            "a": "{{1.lead_question}}",
                                            "o": "notexist"
                                        }
                                    ]
                                ]
                            },
                            "mapper": {
                                "body": "{\n  \"error\": \"employeeId and lead_question are required\"\n}",
                                "status": "400",
                                "headers": [
                                    {
                                        "key": "Content-Type",
                                        "value": "application/json"
                                    }
                                ]
                            },
                            "metadata": {
                                "designer": {
                                    "x": 600,
                                    "y": 150
                                },
                                "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": []
    }
}