Who is this template for?

This workflow template is designed for any professionals seeking relevant data from a database using natural language.

How it works

Each time a user asks a question using the n8n chat interface, the workflow runs.

Then the message is processed by the AI Agent using relevant tools – Execute SQL Query, Get DB Schema and Tables List, and Get Table Definition, if required. The agent uses these tools to form and run SQL queries that are necessary to answer the questions.

Once the AI Agent has the data, it uses it to form an answer and returns it to the user.

Set up instructions

Complete the Set up credentials step when you first open the workflow. You’ll need PostgreSQL credentials and an OpenAI API key.