Natural language database queries with dual-agent AI & PostgreSQL integration
Ready for 3.0What this workflow does
This AI workflow has 17 nodes and runs on Telegram events (message) (plus 1 other trigger). Along the way it connects OpenRouter Chat Model, Postgres Chat Memory, Telegram and OpenAI and 1 more.
How it runs
Trigger: On Telegram events (message) (plus 1 other trigger).
- Voice or Text (Switch): routes items into 2 branches
- Query agent (AI Agent): runs an AI agent, with model: OpenRouter Chat Model; 1 tool (Think)
- Download File (Telegram): work with file
- Text (Edit Fields (Set)): sets 1 field: text
- ACCES DATABASE WITH DYNAMIC QUERYS (Postgres): run a query
- Transcribe (OpenAI): transcribe (audio)
- Merge: merges the data from its input branches
- Main agent (AI Agent): runs an AI agent, with model: OpenRouter Chat Model; 2 tools (Think, CALL QUERY AGENT); memory: Postgres Chat Memory
- SEND MESSAGE (Telegram): uses Telegram
Services it uses
Other Telegram + OpenAI templates (807) · Other OpenAI + PostgreSQL templates (191) · Other Telegram + OpenRouter templates (136)
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (13)
- Execute Workflow Trigger
n8n-nodes-base.executeWorkflowTrigger - AI Agent
@n8n/n8n-nodes-langchain.agent - Think Tool
@n8n/n8n-nodes-langchain.toolThink - OpenRouter Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenRouter - Postgres Chat Memory
@n8n/n8n-nodes-langchain.memoryPostgresChat - Telegram
n8n-nodes-base.telegram - OpenAI
@n8n/n8n-nodes-langchain.openAi - Telegram Trigger
n8n-nodes-base.telegramTrigger - Switch
n8n-nodes-base.switch - Edit Fields (Set)
n8n-nodes-base.set - Merge
n8n-nodes-base.merge - Call n8n Workflow Tool
@n8n/n8n-nodes-langchain.toolWorkflow - Postgres
n8n-nodes-base.postgres
From the author
AI Database Assistant with Smart Query's & PostgreSQL Integration Description: 🚀 Transform Your Database into an Intelligent AI Assistant This workflow creates a smart database assistant that safely handles natural language queries without crashing your…