[GH-ISSUE #4801] Agent can’t communicate with SQL database #3019

Closed
opened 2026-02-22 18:32:17 -05:00 by yindo · 1 comment
Owner

Originally created by @ronstone2000 on GitHub (Dec 21, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4801

I’ve tried several times to use the agent SQL connection to query a Postgres db running on localhost (MacBook Pro).

{"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m Attached sql-agent:sql-get-table-schema plugin to Agent cluster","service":"backend"}
{"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m Attached sql-agent:sql-query plugin to Agent cluster","service":"backend"}
{"level":"info","message":"\u001b[36m[AgentLLM - phi3:3.8b]\u001b[0m Valid tool call found - running sql-list-tables.","service":"backend"}
{"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m [debug]: @agent is attempting to call sql-list-tables tool {\n "database_id": "gnucash_db"\n}","service":"backend"}
{"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m Using the sql-list-tables tool.","service":"backend"}
{"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m sql-list-tables failed to find config! gnucash_db","service":"backend"}
{"level":"info","message":"\u001b[36m[AgentLLM - phi3:3.8b]\u001b[0m Valid tool call found - running sql-list-databases.","service":"backend"}
{"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m [debug]: @agent is attempting to call sql-list-databases tool {}","service":"backend"}
{"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m Using the sql-list-databases tool.","service":"backend"}
{"level":"info","message":"\u001b[36m[AgentLLM - phi3:3.8b]\u001b[0m Cannot call sql-list-tables again because an exact duplicate of previous run of sql-list-tables.","service":"backend"}
{"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m Attached sql-agent:sql

Googling “ sql-list-tables failed to find config! ” suggests a problem with the connection settings, but I’ve confirmed that I can use them from psql.

I’ve deleted and recreated the agent config several times, even giving it the same name as the db it is trying to reach.

Any suggestions?

Originally created by @ronstone2000 on GitHub (Dec 21, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4801 I’ve tried several times to use the agent SQL connection to query a Postgres db running on localhost (MacBook Pro). {"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m Attached sql-agent:sql-get-table-schema plugin to Agent cluster","service":"backend"} {"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m Attached sql-agent:sql-query plugin to Agent cluster","service":"backend"} {"level":"info","message":"\u001b[36m[AgentLLM - phi3:3.8b]\u001b[0m Valid tool call found - running sql-list-tables.","service":"backend"} {"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m [debug]: @agent is attempting to call `sql-list-tables` tool {\n \"database_id\": \"gnucash_db\"\n}","service":"backend"} {"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m Using the sql-list-tables tool.","service":"backend"} {"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m sql-list-tables failed to find config! gnucash_db","service":"backend"} {"level":"info","message":"\u001b[36m[AgentLLM - phi3:3.8b]\u001b[0m Valid tool call found - running sql-list-databases.","service":"backend"} {"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m [debug]: @agent is attempting to call `sql-list-databases` tool {}","service":"backend"} {"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m Using the sql-list-databases tool.","service":"backend"} {"level":"info","message":"\u001b[36m[AgentLLM - phi3:3.8b]\u001b[0m Cannot call sql-list-tables again because an exact duplicate of previous run of sql-list-tables.","service":"backend"} {"level":"info","message":"\u001b[36m[AgentHandler]\u001b[0m Attached sql-agent:sql Googling “ sql-list-tables failed to find config! ” suggests a problem with the connection settings, but I’ve confirmed that I can use them from psql. I’ve deleted and recreated the agent config several times, even giving it the same name as the db it is trying to reach. Any suggestions?
yindo closed this issue 2026-02-22 18:32:17 -05:00
Author
Owner

@shatfield4 commented on GitHub (Dec 22, 2025):

The error you're receiving here means that no config for the SQL agent skill was found at all.

First, ensure that your configs are actually saving properly to the agent skill. We validate configs for SQL connections by trying to connect to the DB so if the provided info in the new SQL connection form is invalid it does not save that config and will show an error message that says "Unable to connect to postgresql. Please verify your connection details."

This can happen if you enter in invalid config data when creating the SQL agent skill config.

If the config is saving properly the one last thing I can suggest is trying to use another model for agent calling. I see that you are using Phi3:3.8b and this model may be hallucinating too much to fill in the correct parameters for calling the SQL tools. I'd suggest testing Llama 3.2 3B or other public models like Claude Sonnet 4.5 or OpenAI gpt-4o to test this out. Closing for now since it appears that this is either invalid configuration or model hallucination.

@shatfield4 commented on GitHub (Dec 22, 2025): The error you're receiving here means that no config for the SQL agent skill was found at all. First, ensure that your configs are actually saving properly to the agent skill. We validate configs for SQL connections by trying to connect to the DB so if the provided info in the new SQL connection form is invalid it does not save that config and will show an error message that says "Unable to connect to postgresql. Please verify your connection details." This can happen if you enter in invalid config data when creating the SQL agent skill config. If the config is saving properly the one last thing I can suggest is trying to use another model for agent calling. I see that you are using Phi3:3.8b and this model may be hallucinating too much to fill in the correct parameters for calling the SQL tools. I'd suggest testing Llama 3.2 3B or other public models like Claude Sonnet 4.5 or OpenAI gpt-4o to test this out. Closing for now since it appears that this is either invalid configuration or model hallucination.
yindo changed title from Agent can’t communicate with SQL database to [GH-ISSUE #4801] Agent can’t communicate with SQL database 2026-06-05 14:49:52 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#3019