Assistants & Knowledge

Chat with Your Postgres Database

Ask questions about your Postgres data in plain language and let an AI agent write and run the SQL.

The Problem

Business users wait on engineers or analysts for answers to simple database questions.

How This Template Solves It

An operations lead opens the chat and asks which customers ordered most last month. The agent reads the schema, inspects the table definitions, writes a query, runs it and replies with the answer.

How It Works

  1. 1A chat trigger receives the question.
  2. 2The agent lists schemas and tables and reads table definitions.
  3. 3It writes and runs a SQL query with the Postgres tool.
  4. 4It answers in the chat and remembers recent messages.

What You Need

  • A Postgres database
  • An OpenAI API key

What Stays Under Your Control

  • Connect with a read-only database user so the agent cannot change data.

Watch Out For

  • The agent can run any query the database user allows. Never connect it with write access.
  • Do not make the chat public if the data is private, even though the template allows it.

Adapted from a community workflow template. Before publishing we removed credentials, account and file IDs, email addresses and sample data. The original author's setup notes are kept inside the workflow file.

More Assistants & Knowledge Templates

Assistants & Knowledge

Company Documents Chatbot for Employee Questions

An employee chatbot that answers questions from company documents in Google Drive, updated as files are added or changed.

Starts on: Chat message, New Google Drive file

Google DriveGoogle GeminiPinecone