Help with Configuring a Reliable Database Agent in n8n

Hi.

**Describe the problem/error/question
I have an agent connected to Postgres in Supabase, but I’m experiencing inconsistent behavior. Sometimes it correctly executes SQL queries based on user requests, but other times it ignores the database and gives generic responses.

Please, I need help with:

Ensuring my agent consistently executes the correct predefined SQL queries
Configuring the agent to select specific tools based on user intent
Passing dynamic parameters from user queries to SQL statements
Implementing parameter collection where the agent asks for missing information before executing queries

Unfortunately, I cannot share the workflow’s code as I’ve signed a confidentiality agreement.

**What is the error message (if any)?
No specific error message, but the agent frequently fails to use the database connection when it should, resulting in inaccurate responses.

Any examples or best practices would be appreciated!

Thanks!

Information on your n8n setup

  • n8n version:1.85.4
  • Database: Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Windows 11

Hi,

Without workflow it’s hard.

Just create a minimum viable generic example to test something

Do you use memory of any kind?

Regards
J.

Hi, can you please post it inside of a code section so it becomes interactive/displays correctly?

thank you.

Thank you.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.