Data Sync & ETL
Route LLM requests with Anthropic, OpenAI, Gemini, Postgres, and Slack
When you run it, it moves and syncs data with Claude and OpenAI / ChatGPT using Postgres, Slack.
What it does
## 🔀 LLM Fallback Chain Sends one prompt through an ordered chain of LLM providers (Anthropic → OpenAI → Gemini). Every response is validated in code. On failure the workflow retries, switches provider, or falls back to a stale cached answer / static degraded message. Every attempt is logged to Postgres. ### Pipeline Request → Config → Normalize → Circuit breaker → Provider loop → Call → Validate → Log + update health → valid? → success | retry / switch / degrade → Save result → Slack (only on fallback) → Respond ### Resilience features 1. Ordered provider chain + optional preferredProvider 2. Circuit breaker (skip after N failures, cooldown, half-open probe) 3. Error classification (429 / 5xx / timeout = retryable; 4xx = switch) 4. Deterministic response validation (empty, truncation, safety, refusal, length, keywords, JSON schema) 5. Repair retry (invalid output → validation issues added to prompt) 6. Degraded modes: stale cache → static 503 message 7. Full audit trail in Postgres ### Setup checklist 1. Import workflow 2. Run llm_fallback_schema.sql 3. Create 3 Header Auth credentials and attach to the matching HTTP nodes: - Anthropic (x-api-key) - OpenAI (Authorization: Bearer …) - Gemini (x-goog-api-key) 4. Attach Postgres + Slack credentials 5. Edit Set - Fallback Config (order, models, limits, channel) 6. Test with Manual Trigger, then activate for the webhook ### Webhook payload (all optional) json { "requestId": "…", "prompt": "…", "systemPrompt": "…", "expectJson": true, "schema": { "key": "string|number|boolean|array|object|enum:a|b" }, "maxTokens": 1024, "temperature": 0.2, "preferredProvider": "anthropic", "minChars": 2, "maxChars": 8000, "mustContain": [], "mustNotContain": [] } ### Response shape json { "requestId": "…", "status": "success | success_after_fallback | degraded_cached | degraded_static", "provider": "…", "model": "…", "text": "…", "parsed": {}, "stale": false, "fallbackUsed": false, "attemptCount": 1, "totalLatencyMs": 0, "skippedProviders": [], "trace": [] }
The steps
- Manual Trigger - Start Request
- Webhook - LLM Request
- Set - Fallback Config
- JS - Normalize Request
- Postgres - Read Provider Health
- JS - Build Provider Chain
- JS - Select Provider
- Switch - Provider Router
- HTTP Request - Anthropic
- HTTP Request - OpenAI
- HTTP Request - Gemini
- JS - Normalize & Validate
- Postgres - Log Attempt & Health
- JS - Restore Attempt State
27 steps in total.
Similar automations
Monitoring, Ops & IncidentsRoute LLM tasks to the cheapest capable Claude models with Anthropic21 stepsData Sync & ETLRun multi-agent procurement approvals with Anthropic Claude, Slack and Postgres29 stepsAI Agents & AssistantsReview ad copy variants with Claude and route results to HubSpot and Slack34 stepsMonitoring, Ops & IncidentsArbitrate LLM answers using an Anthropic Claude panel and WhatsApp alerts20 steps