The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Agentic Router (QA vs Strategy)",
"nodes": [
{
"parameters": {
"path": "forecast",
"options": {}
},
"name": "Webhook Trigger",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
240,
300
]
},
{
"parameters": {
"responseBody": "{\"accepted\":true}"
},
"name": "Respond Immediately",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
510,
220
]
},
{
"parameters": {
"functionCode": "// Initialize / validate input\n// items[0].json holds the state\nreturn items;"
},
"name": "Init",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
510,
380
]
},
{
"parameters": {
"functionCode": "// Decide mode: qa | strategy\nconst s = items[0].json;\nlet mode = (s.mode || s.task || 'auto');\nif (mode === 'auto') {\n if (Array.isArray(s.symbols) && s.symbols.length > 0) mode = 'strategy';\n else if ((s.doc_text && s.doc_text.length > 100) || s.prompt) mode = 'qa';\n else mode = 'qa';\n}\nitems[0].json.mode = mode;\nreturn items;"
},
"name": "Router",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
760,
380
]
},
{
"parameters": {
"propertyName": "={{$json[\"mode\"]}}"
},
"name": "Switch Mode",
"type": "n8n-nodes-base.switch",
"typeVersion": 3,
"position": [
1000,
380
]
},
{
"parameters": {
"url": "={{$json[\"callback_url\"]}}",
"jsonParameters": true,
"options": {
"bodyContentType": "json"
},
"sendBody": true,
"jsonBody": "{\"type\": \"completed\", \"result\": {\"mode\": \"qa\", \"metrics\": {\"qa\": {\"exact_match\": 0.7, \"f1\": 0.78}}, \"qa\": {\"question\": \"Demo Q\", \"answer\": \"Demo A\", \"confidence\": 0.9, \"support\": [{\"source\": \"doc.txt\", \"snippet\": \"...\"}]}, \"input\": {\"prompt\": \"Demo Q\", \"doc_name\": \"doc.txt\", \"symbols\": [], \"horizon_days\": 5, \"task\": \"qa\"}}}"
},
"name": "QA Completed",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
1240,
280
]
},
{
"parameters": {
"url": "={{$json[\"callback_url\"]}}",
"jsonParameters": true,
"options": {
"bodyContentType": "json"
},
"sendBody": true,
"jsonBody": "{\"type\": \"progress\", \"value\": 0.5}"
},
"name": "Strategy Progress",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
1240,
460
]
},
{
"parameters": {
"url": "={{$json[\"callback_url\"]}}",
"jsonParameters": true,
"options": {
"bodyContentType": "json"
},
"sendBody": true,
"jsonBody": "{\"type\": \"completed\", \"result\": {\"mode\": \"strategy\", \"metrics\": {\"accuracy\": {\"rmse\": 1.2, \"mape\": 0.06, \"directional_accuracy\": 0.61}, \"strategy\": {\"sharpe\": 1.1, \"max_drawdown\": -0.12, \"win_rate\": 0.55}}, \"series\": {\"dates\": [], \"actual\": [], \"forecast\": [], \"lower\": [], \"upper\": []}, \"signals\": [{\"symbol\": \"SYMB1\", \"weight\": 0.3, \"reason\": \"demo\"}], \"equity_curve\": {\"dates\": [], \"equity\": []}, \"input\": {\"prompt\": null, \"doc_name\": null, \"symbols\": [\"SYMB1\"], \"horizon_days\": 5, \"task\": \"strategy\"}}}"
},
"name": "Strategy Completed",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
1480,
460
]
}
],
"connections": {
"Webhook Trigger": {
"main": [
[
{
"node": "Respond Immediately",
"type": "main",
"index": 0
},
{
"node": "Init",
"type": "main",
"index": 0
}
]
]
},
"Init": {
"main": [
[
{
"node": "Router",
"type": "main",
"index": 0
}
]
]
},
"Router": {
"main": [
[
{
"node": "Switch Mode",
"type": "main",
"index": 0
}
]
]
},
"Switch Mode": {
"main": [
[
{
"node": "QA Completed",
"type": "main",
"index": 0
}
],
[
{
"node": "Strategy Progress",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Agentic Router (QA vs Strategy). Uses httpRequest. Webhook trigger; 8 nodes.
Source: https://github.com/teahsea/agentic-forecast-mvp/blob/e024b1a4dd3af08943681e18c8f6c4f6ecee6dc8/n8n/router.example.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Jigsaw API key for image processing, I use this as a gatekeeper/second pair of eyes. LINK to their website https://jigsawstack.com/ SECOND A postgress DATABASE (I use Supabase) LlamaCloud for the pars
Onsite Photos to Jobs (SMS Agent). Uses dataTable, twilio, httpRequest, airtable. Webhook trigger; 62 nodes.
W1 - IN WhatsApp Adapter (Secure + Fast ACK). Uses postgres, redis, httpRequest. Webhook trigger; 50 nodes.
W1 - IN WhatsApp Adapter (Secure + Fast ACK). Uses postgres, redis, httpRequest. Webhook trigger; 48 nodes.