# Conversational PostgreSQL agent with Claude: n8n workflow

> Started by someone opening a chat with it, and works across Postgres. It puts Claude behind a retrieval step, so answers are drawn from documents you supply...

Source: https://millionrounds.com/workflow/conversational-postgresql-agent-with-claude (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Content](https://millionrounds.com/workflows?category=Content#library)

# Conversational PostgreSQL agent with Claude

Started by someone opening a chat with it, and works across Postgres. It puts Claude behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 19 steps, 1 branch: a working afternoon to understand properly.

Medium Calls a model: Claude Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fconversational-postgresql-agent-with-claude)

**19 steps** Medium: a working afternoon

**1** Branch: places the flow splits

**0** Loops or waits

**1** Service it connects to

## The flow

Starts it 3 Model 10 Logic 1 Service 5

The steps in the order they run, from what starts it.

- 1 **GetTableSchema** Postgres Tool *Service*
- 2 **ListTables** Postgres Tool *Service*
- 3 **When Executed by Another Workflow** Execute Workflow trigger *Starts it*
- 4 **CreateTableRecords** Tool Workflow *Model*
- 5 **UpdateTableRecords** Tool Workflow *Model*
- 6 **MCP Client** Mcp Client Tool *Model*
- 7 **Anthropic Chat Model** Lm Chat Anthropic *Model*
- 8 **Think** Tool Think *Model*
- 9 **get table details** Tool Workflow *Model*
- 10 **ReadTableRows** Tool Workflow *Model*
- 11 **Plot tool** Tool Workflow *Model*
- 12 **Simple Memory** Memory Buffer Window *Model*
- 13 **When chat message received** Chat trigger *Starts it*
- 14 **PostgreSQL MCP Server** Mcp trigger *Starts it*
- 15 **Operation** Switch *Logic*
- 16 **AI Agent** Agent *Model*
- 17 **ReadTableRecord** Postgres *Service*
- 18 **CreateTableRecord** Postgres *Service*
- 19 **UpdateTableRecord** Postgres *Service*

## How it's built

- **Starts on:** Someone opening a chat with it
- **Steps:** 19, with 1 branch
- **Size:** Medium: a working afternoon
- **Connects to:** Postgres
- **Model:** Claude
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Postgres account, and a key for Claude. You connect your own accounts after importing it; none are included.

What starts it?

It starts on someone opening a chat with it.

Does it use AI?

Yes. It calls Claude. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Plan an afternoon. 19 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 19 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fconversational-postgresql-agent-with-claude)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Postgres](https://millionrounds.com/workflows?service=Postgres#library)

## Workflows like it

Also content, with the same services where possible, closest in size first.

- [**Publish LinkedIn posts from RSS with Ollama and PostgreSQL** 19 steps · calls a model · LinkedIn, Postgres](https://millionrounds.com/workflow/publish-linkedin-posts-from-rss-with-ollama-and-postgresql)
- [**Generate visual diagrams and content assets from ideas** 19 steps · Email, Postgres](https://millionrounds.com/workflow/generate-visual-diagrams-and-content-assets-from-ideas)
- [**Sync Gmail emails to PostgreSQL with S3** 19 steps · Gmail, Postgres](https://millionrounds.com/workflow/sync-gmail-emails-to-postgresql-with-s3)
- [**YouTube outlier detector** 19 steps · Postgres, YouTube](https://millionrounds.com/workflow/youtube-outlier-detector)
- [**PostgreSQL conversational agent with Claude** 18 steps · calls a model · Postgres](https://millionrounds.com/workflow/postgresql-conversational-agent-with-claude)
- [**Query Google Sheets/CSV data with PostgreSQL** 20 steps · calls a model · Google Sheets, Postgres](https://millionrounds.com/workflow/query-google-sheets-csv-data-with-postgresql)
