[GH-ISSUE #1828] [BUG]: agent sql issue #1189

Closed
opened 2026-02-22 18:23:37 -05:00 by yindo · 3 comments
Owner

Originally created by @esaic on GitHub (Jul 8, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1828

How are you running AnythingLLM?

Docker (local)

What happened?

the following log:
[backend] info: [AgentHandler] Start db44aded-1eca-4015-acd8-f66e00d1a25e::ollama:llama3:8b-instruct-fp16
[backend] info: [TELEMETRY SENT]
[backend] info: [AgentHandler] Attached websocket plugin to Agent cluster
[backend] info: [AgentHandler] Attached chat-history plugin to Agent cluster
[backend] info: [AgentHandler] Attaching user and default agent to Agent cluster.
[backend] info: [AgentHandler] Attached rag-memory plugin to Agent cluster
[backend] info: [AgentHandler] Attached document-summarizer plugin to Agent cluster
[backend] info: [AgentHandler] Attached web-scraping plugin to Agent cluster
[backend] info: [AgentHandler] Attached sql-agent:sql-list-databases plugin to Agent cluster
[backend] info: [AgentHandler] Attached sql-agent:sql-list-tables plugin to Agent cluster
[backend] info: [AgentHandler] Attached sql-agent:sql-get-table-schema plugin to Agent cluster
[backend] info: [AgentHandler] Attached sql-agent:sql-query plugin to Agent cluster
[backend] info: [AgentLLM - llama3:8b-instruct-fp16] Valid tool call found - running sql-list-tables.
[backend] info: [AgentHandler] [debug]: @agent is attempting to call sql-list-tables tool
[backend] info: [AgentHandler] Using the sql-list-tables tool.
[backend] info: [AgentLLM - llama3:8b-instruct-fp16] Function tool with exact arguments has already been called this stack.
[backend] info: [AgentLLM - llama3:8b-instruct-fp16] Will assume chat completion without tool call inputs.
from within anythingllm container, I can connect to database and get response:

Password for user postgres:
psql (14.12 (Ubuntu 14.12-0ubuntu0.22.04.1), server 16.2)
WARNING: psql major version 14, server major version 16.
Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.

database_name=> select * from company;
id | name | age | address
----+-------+-----+----------------------------------------------------
5 | Paul | 32 | California
6 | John | 28 | New York
7 | Alice | 45 | Texas
8 | Bob | 36 | Florida
(4 rows)

Any ideas what problem may be? I have

Are there known steps to reproduce?

No response

Originally created by @esaic on GitHub (Jul 8, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1828 ### How are you running AnythingLLM? Docker (local) ### What happened? the following log: [backend] info: [AgentHandler] Start db44aded-1eca-4015-acd8-f66e00d1a25e::ollama:llama3:8b-instruct-fp16 [backend] info: [TELEMETRY SENT] [backend] info: [AgentHandler] Attached websocket plugin to Agent cluster [backend] info: [AgentHandler] Attached chat-history plugin to Agent cluster [backend] info: [AgentHandler] Attaching user and default agent to Agent cluster. [backend] info: [AgentHandler] Attached rag-memory plugin to Agent cluster [backend] info: [AgentHandler] Attached document-summarizer plugin to Agent cluster [backend] info: [AgentHandler] Attached web-scraping plugin to Agent cluster [backend] info: [AgentHandler] Attached sql-agent:sql-list-databases plugin to Agent cluster [backend] info: [AgentHandler] Attached sql-agent:sql-list-tables plugin to Agent cluster [backend] info: [AgentHandler] Attached sql-agent:sql-get-table-schema plugin to Agent cluster [backend] info: [AgentHandler] Attached sql-agent:sql-query plugin to Agent cluster [backend] info: [AgentLLM - llama3:8b-instruct-fp16] Valid tool call found - running sql-list-tables. [backend] info: [AgentHandler] [debug]: @agent is attempting to call `sql-list-tables` tool [backend] info: [AgentHandler] Using the sql-list-tables tool. [backend] info: [AgentLLM - llama3:8b-instruct-fp16] Function tool with exact arguments has already been called this stack. [backend] info: [AgentLLM - llama3:8b-instruct-fp16] Will assume chat completion without tool call inputs. from within anythingllm container, I can connect to database and get response: Password for user postgres: psql (14.12 (Ubuntu 14.12-0ubuntu0.22.04.1), server 16.2) WARNING: psql major version 14, server major version 16. Some psql features might not work. SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off) Type "help" for help. database_name=> select * from company; id | name | age | address ----+-------+-----+---------------------------------------------------- 5 | Paul | 32 | California 6 | John | 28 | New York 7 | Alice | 45 | Texas 8 | Bob | 36 | Florida (4 rows) Any ideas what problem may be? I have ### Are there known steps to reproduce? _No response_
yindo added the possible bug label 2026-02-22 18:23:37 -05:00
yindo closed this issue 2026-02-22 18:23:37 -05:00
Author
Owner

@timothycarambat commented on GitHub (Jul 8, 2024):

Looks like the LLM either not using the output from the table or the LLM hallunicating the JSON to call the next step of the SQL-connector. This is not a bug as you can see

[backend] info: [AgentLLM - llama3:8b-instruct-fp16] Valid tool call found - running sql-list-tables.
[backend] info: [AgentHandler] [debug]: https://github.com/agent is attempting to call sql-list-tables tool
[backend] info: [AgentHandler] Using the sql-list-tables tool.

The sql-list-tables tool was called and from the logs it looks like it was attempted to call again - to prevent spam-calling the same function in an infinite loop we exit early on these kinds of conditions because agents will infinitely call the same function over and over and never stop.

https://docs.useanything.com/agent-not-using-tools

@timothycarambat commented on GitHub (Jul 8, 2024): Looks like the LLM either not using the output from the table or the LLM hallunicating the JSON to call the next step of the SQL-connector. This is not a bug as you can see ``` [backend] info: [AgentLLM - llama3:8b-instruct-fp16] Valid tool call found - running sql-list-tables. [backend] info: [AgentHandler] [debug]: https://github.com/agent is attempting to call sql-list-tables tool [backend] info: [AgentHandler] Using the sql-list-tables tool. ``` The sql-list-tables tool was called and from the logs it looks like it was attempted to call again - to prevent spam-calling the same function in an infinite loop we exit early on these kinds of conditions because agents _will_ infinitely call the same function over and over and never stop. https://docs.useanything.com/agent-not-using-tools
Author
Owner

@esaic commented on GitHub (Jul 9, 2024):

In @agent mode, does the workspace vector DB information got appended to the prompt? I think having sample correct queries would be helpful, but I don't know if this is part of the flow in anythingllm while in agent mode.

@esaic commented on GitHub (Jul 9, 2024): In @agent mode, does the workspace vector DB information got appended to the prompt? I think having sample correct queries would be helpful, but I don't know if this is part of the flow in anythingllm while in agent mode.
Author
Owner

@timothycarambat commented on GitHub (Jul 9, 2024):

The vector db with its content is RAG-searchable like it would be in a regular chat, yes

@timothycarambat commented on GitHub (Jul 9, 2024): The vector db with its content is RAG-searchable like it would be in a regular chat, yes
yindo changed title from [BUG]: agent sql issue to [GH-ISSUE #1828] [BUG]: agent sql issue 2026-06-05 14:39:26 -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#1189