AutomationMart
Home/Browse/PostgreSQL conversational agent with Claude & DeepSeek (Multi-KPI, Secure)
n8n

PostgreSQL conversational agent with Claude & DeepSeek (Multi-KPI, Secure)

n8nn8n18 modulesv1.0
SlackNotionGoogle SheetsOpenAIGemini

Conversational PostgreSQL Agent Enable AI-driven conversations with your PostgreSQL database using a secure and visual-free agent powered by n8n’s Model Context Protocol (MCP). This template allows users to ask multiple KPIs in a single message, returning consolidated insights β€” more efficient than the original Conversing with Data template. --- πŸš€ Why This Template Unlike the Conversing with Data workflow, which handles one KPI per message, this version: - βœ… Supports multi-KPI questions - βœ… Re

At a glance

PostgreSQL conversational agent with Claude & DeepSeek (Multi-KPI, Secure) is a ready-made n8n workflow you import as a workflow JSON file β€” no build required. It connects Slack, Notion, Google Sheets, OpenAI. It's free to download. Follow the 5-step import below to go live in minutes.

Platform
n8n
Connects
Slack, Notion, Google Sheets, OpenAI, Gemini
Modules
18
Price
Free
Version
v1.0
PostgreSQL conversational agent with Claude & DeepSeek (Multi-KPI, Secure) workflow diagram

About this workflow

Conversational PostgreSQL Agent Enable AI-driven conversations with your PostgreSQL database using a secure and visual-free agent powered by n8n’s Model Context Protocol (MCP). This template allows users to ask multiple KPIs in a single message, returning consolidated insights β€” more efficient than the original Conversing with Data template. --- πŸš€ Why This Template Unlike the Conversing with Data workflow, which handles one KPI per message, this version: - βœ… Supports multi-KPI questions - βœ… Returns structured, human-readable reports - βœ… Uses fewer AI calls, making it faster and cheaper - βœ… Avoids raw SQL execution for enhanced security πŸ’² Estimated cost per full multi-request run: $0.01 This template is optimized for efficiency. Each message can return 2–4 KPIs (You can change the MaxIteration of the Agent to make it more, it is currently set up at 30 iterations) using a single Claude 3.5 Haiku session and DeepSeek-based SQL generation β€” balancing speed, reasoning, and affordability. --- πŸ’¬ Sample Use Case User: β€œCan you show product performance, revenue trends, and top 5 customers?” Agent: - Uses ListTables and GetTableSchema - Generates three SQL queries using getqueryanddata - Returns: πŸ“Š Product Performance 1. High-Waist Jeans β€” 10 units, $1,027 revenue 2. Denim Jacket β€” 10 units, $783 revenue πŸ“ˆ Sales Trends - Peak Month: January 2024 β€” 32 units, $2,378 - Average Monthly Units: 10–16 🧍 Customer Insights 1. Bob Brown β€” $1,520 spent 2. Diana Wilson β€” $925 spent All from one natural prompt. --- πŸ–ΌοΈ Real-World Interaction Screenshot --- 🧰 What’s Inside | Node | Purpose | |----------------------------|-----------------------------------------------------------| | MCP Server Trigger | Receives user queries via /mcp/... | | AI Agent + Memory | Understands and plans multi-step queries | | Think Tool | Breaks down the user’s question into structured goals | | getqueryanddata | Generates SQL securely from natural language | | ListTables, GetSchema | AI tools to explore DB safely | | Read/Insert/Update Tools | Execute structured operations (never raw SQL) | | checkdatabase Subflow | Validates SQL, formats response as clean text | --- πŸ€– Model Selection Recommendations This template uses two types of models, selected for cost-performance balance and role alignment: 1. Claude 3.5 Haiku (Anthropic) – for the MCP Agent The main conversational agent uses Claude 3.5 Haiku, ideal for MCP because it was built by Anthropic β€” the creators of the MCP standard. It’s fast, affordable, and performs excellently in tool-calling and reasoning tasks. 2. DeepSeek – for the SQL subworkflow The subworkflow that turns natural language into SQL uses DeepSeek. It’s one of the most affordable and performant models available today for structured outputs like SQL, making it a perfect fit for utility logic. βœ… This setup provides top-tier reasoning + low-cost execution. --- πŸ” Security Benefits - No raw SQL accepted from the user or LLM - All queries are parameterized - Schema is dynamically retrieved - Final output is clean, safe, and human-readable --- πŸ§ͺ Try a Prompt > β€œShow me the top 5 products by units sold and revenue, total monthly sales trend, and top 5 customers by spending.” In one message, the agent will: - Generate and run multiple queries - Use the schema to validate logic - Return a single, comprehensive answer --- πŸ›  How to Use 1. πŸ“₯ Upload both workflow files into your n8n instance: - BuildyourownPostgreSQLMCPserverNovisuals.json - checkdatabase.json 2. πŸ” Set up PostgreSQL credentials (e.g. β€œPostgres account 3”) 3. 🧠 Confirm model setup: - Claude 3.5 Haiku for the main agent - DeepSeek for the subflow 4. 🌐 Use the /mcp/... URL from the MCP Server Trigger to connect your frontend or chatbot 5. πŸ—£ Ask questions naturally β€” the agent takes care of planning, querying, and formatting --- πŸ”„ Customization Ideas - Swap Claude or DeepSeek for OpenAI, Mistral, Gemini, etc. - Export insights to Slack, Notion, or Google Sheets - Add Switch nodes to control access to specific tables - Integrate with any front-end app, internal dashboard, or bot --- πŸ“¦ What's Included - BuildyourownPostgreSQLMCPserverNovisuals.json – MCP agent logic - checkdatabase.json – SQL generation and formatting utility workflow πŸ“ These must be uploaded into your n8n workspace for the template to function. --- πŸ“Š Comparison: Conversing with Data vs This Workflow | Feature | Conversing with Data | This Workflow | |------------------------------|---------------------------|---------------------------------| | Handles multi-KPI questions | ❌ No | βœ… Yes | | Secure query execution | βœ… Yes | βœ… Yes | | Structured response | ⚠️ JSON / raw | βœ… Clean natural language | | Cost-efficiency | ⚠️ More calls | βœ… Optimized with fewer calls | | Endpoint support | ❌ Manual interaction | βœ… MCP-ready (/mcp/...) | πŸ”— Prefer something more lightweight and cost-sensitive? Try the original Conversing with Data template (single KPI + chart support): Conversing with Data: Transforming Text into SQL Queries and Visual Curves > I used this version for over 3 months and only spent $0.80 total, making it a great entry point if you're just getting started or on a limited budget. --- πŸ“š More from the Same Creator Looking for a different kind of AI reporting workflow? Explore: Customer Feedback Analysis with AI, QuickChart & HTML Report Generator β†’ Automatically analyze customer input and generate full reports with insights and charts. Customer Feedback Analysis with AI, QuickChart & HTML Report Generator

n8n

How to import this n8n workflow

  1. 1

    Download the workflow JSON file after purchase.

  2. 2

    Open n8n β†’ click the menu β†’ Import from File.

  3. 3

    Select the downloaded JSON and import.

  4. 4

    Set up credentials for each node that requires them.

  5. 5

    Click Execute Workflow to test, then activate.

Setup guide

Setup guide included

Purchase to unlock the full step-by-step guide

Related N8n workflows

Send new TextIt flow responses to new rows on Google Sheets

Every time a new response is received in Textit, Make will automatically add selected data from the Textit to a new row in a Google Sheets spreadsheet. The template uses this [example spreadsheet](https://docs.google.com/spreadsheets/d/1V0XA3DMCOspL-cWBT1Edn7gF7KHeSobNwyn0n4cnBQI/edit?usp=sharing)

Free

Track Calendly invitees and add them to Google Sheets automatically

Automatically track Calendly invitees and log their details into Google Sheets. Keep your records updated every time someone schedules an event via Calendly.

Free

Import Memberstack members to Google Sheets spreadsheet

List all members in Memberstack and send them to Google Sheets spreadsheet.

Free

Effortless email management with AI-powered summarization & review

How it Works This workflow automates the handling of incoming emails, summarizes their content, generates appropriate responses using a retrieval-augmented generation (RAG) approach, and obtains approval or suggestions before sending replies. Below is an explanation of its functionality divided into two main sections: 1. Email Handling and Summarization: - The process begins with the Email Trigger (IMAP) node which listens for new emails in a specified inbox. - Once an email is received, the M

Free

Create a new Google Sheets row for every new email received using ChatGPT to summarize the content

Automatically summarize new emails with ChatGPT and add them as new rows in Google Sheets. Streamline email management and data organization effortlessly.

Free

Monitor Furusato Nozei market trends with Google News, AI analysis and Slack reporting

Analyze Furusato Nozei trends from Google News to Slack This workflow acts as a specialized market analyst for Japan's "Furusato Nozei" (Hometown Tax) system. It automates the process of monitoring related news, validating keyword popularity via search trends, and delivering a concise, strategic report to Slack. By combining RSS feeds, AI agents, and real-time search data, this template helps marketers and municipal researchers stay on top of the highly competitive Hometown Tax market withou

Free

Automate sales for digital products & SaaS with AI (GPT-4o)

Skyrocket Your Sales Outreach with AI-Powered Automation! Tired of manually finding leads, collecting emails, and sending messages that get ignored? Let AI do the heavy lifting. Introducing AI-Powered Cold Outreach Engine, an n8n workflow that automates prospecting, email discovery, and personalized outreach, designed for digital products, SaaS, and online services. πŸš€ How It Works 1️⃣ Smart Prospecting - Enter your product name, description, and link. - The AI searches Google Maps for busin

Free

Extract passport data with OpenAI OCR and generate QR codes

Overview This workflow processes passport images submitted through a form, extracts structured data using OpenAI OCR, and generates QR codes with the extracted information. Results are displayed on the form completion page and sent via email. The workflow reduces manual data entry and speeds up document processing workflows where passport information needs to be captured consistently. It works best with clear, front-facing passport images. How it works 1. User submits a form with one o

Free

Reviews

No reviews yet

Be the first to buy and share your experience.

Leave a review

Sign in to share your experience with this workflow.

Log in to review
Free
No ratings yet

Create a free account to purchase workflows.

  • JSON blueprint β€” instant download
  • Setup guide PDF included
  • 5 downloads Β· valid 30 days
  • Works with n8n

Need help setting this up?

Book a 3-hour live setup session with an Agility consultant.

β‚Ή2,499/ session
3 hrs Β· video call
  • Configure live on Google Meet / Zoom
  • Free follow-up if workflow has defects
  • Platform expert assigned to you
Book installation session
Free