agent-zero icon indicating copy to clipboard operation
agent-zero copied to clipboard

Tool request CRIT FAIL in extension.py?

Open edhooksjr-ai opened this issue 8 months ago • 6 comments

This Critical Error is causing Endless Looping Condition on my Chat. I AM using a qwen3-coder:30b hosted locally in Ollam, with a 24000 context window. Agent-Zero WRN warning is the I have sent the Same Message Again, (i need to change something) and then continues on in the infinite loop.

Can we Break The Chain somehow from extension.py?

I attempted to make a two strikes were out behavior change, through the prompt which has not proved to be effective. (Agent-zero qwen3-coder hallucinated that it had put a solution in place which is not effective.

I LOVE the Platform and Look forward to a solution on this AND the Clear Chat item apparent NO-OP.

  • Adaugeo

ValueError: Tool request must have a tool_name (type string) field

Traceback (most recent call last): Traceback (most recent call last): File "/a0/helpers/extension.py", line 176, in _run_async data["result"] = await data["result"]

edhooksjr-ai avatar Mar 27 '26 23:03 edhooksjr-ai

I have the same issue with qwen3-coder:30b and Qwen3.5-35B-A3B-FP8, running on two Nvidia Sparks in vLLM. Both advertise tools using: --enable-auto-tool-choice --tool-call-parser qwen3_coder

I did not experience this error with the previous version of Agent Zero.

ValueError: Tool request must be a dictionary Traceback (... ValueError: Tool request must be a dictionary

Traceback (most recent call last): Traceback (most recent call last): File "/a0/helpers/extension.py", line 176, in _run_async data["result"] = await data["result"] ^^^^^^^^^^^^^^^^^^^^ File "/a0/agent.py", line 572, in handle_exception @extension.extensible ^^^^^^^^^^^^^^ File "/a0/agent.py", line 485, in monologue log_item = self.loop_data.params_temporary.get("log_item_generating") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/a0/helpers/extension.py", line 183, in _run_async result = _process_result(data) ^^^^^^^^^^^^^^^^^^^^^ File "/a0/helpers/extension.py", line 143, in _process_result raise exc File "/a0/helpers/extension.py", line 176, in _run_async data["result"] = await data["result"] ^^^^^^^^^^^^^^^^^^^^ File "/a0/agent.py", line 852, in process_tools tool_request = extract_tools.json_parse_dirty(msg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/a0/helpers/extension.py", line 183, in _run_async result = _process_result(data) ^^^^^^^^^^^^^^^^^^^^^ File "/a0/helpers/extension.py", line 143, in _process_result raise exc File "/a0/helpers/extension.py", line 176, in _run_async data["result"] = await data["result"] ^^^^^^^^^^^^^^^^^^^^ File "/a0/agent.py", line 952, in validate_tool_request id=wmsg.id,

I have even had another chat session attempt to inject its own handling of errors and JSON tool requests, but it keeps throwing the error, even though it believes that it "fixed itself". Just as a side note, I rolled back to 1.0 and the error persists. It's in a perpetual loop now, trying to fix itself, in between constant nudges... v0.9.8.3 did not seem to have this error. Unfortunately, I cannot easily roll back to this version.

EDIT: I DID find a PR for this - and to be honest, I had to ChatGPT this to figure out How the F to do this lol... In this example, 2a0d1f081d1c is my container id, so, replace that with your own. FULL credit to @gdeyoung for figuring out a fix for this : https://github.com/agent0ai/agent-zero/pull/1363

Agent Zero Fix (PR #1363) — Step-by-Step Verified the correct container docker ps --no-trunc

Used container: 2a0d1f081d1c.

Identified runtime code path Checked running process and confirmed UI runs from /a0 (not /git/agent-zero): (I had down-leveled to v1.0, in attempts to figure this out - and my agent had already fiddled around with fixing this themselves, so I wasn't positive where the proper files were. docker exec -it 2a0d1f081d1c sh -lc "ps aux | grep -E 'run_ui.py|agent.py' | grep -v grep"

Checked git state in runtime repo docker exec -it 2a0d1f081d1c bash -lc "cd /a0 && git status && git branch --show-current && git remote -v"

Stashed local changes docker exec -it 2a0d1f081d1c bash -lc "cd /a0 && git stash push -u -m pre-pr1363-runtime"

Fetched and checked out PR #1363 docker exec -it 2a0d1f081d1c bash -lc "cd /a0 && git fetch origin pull/1363/head:pr-1363 && git checkout pr-1363"

Verified branch/commit docker exec -it 2a0d1f081d1c bash -lc "cd /a0 && git branch --show-current && git log --oneline -n 5"

Restarted container docker restart 2a0d1f081d1c

Confirmed healthy startup docker logs --tail 200 -f 2a0d1f081d1c

Mine came back up and I ran it through a litany of tests that were previously breaking it and it seems pretty dang stable. I hope this helps someone!

matrices-zz avatar Mar 28 '26 12:03 matrices-zz

I'm encountering the same type of error messages while trying to use a custom plugin to generate images on xai. It halts the conversation, but it picks up again when I ask it to explain the error. It doesn't explain though, it just rolls back to some earlier prompt. It seems to be happening, for me at least, while I was trying to generate images using a custom plugin. I'm having trouble reproducing it now. So I can't zero in on the exact cause.

ValueError: Tool request must be a dictionary Traceback (most recent call last): Traceback (most recent call last): File "/a0/helpers/extension.py", line 176, in _run_async data["result"] = await data["result"] ^^^^^^^^^^^^^^^^^^^^ File "/a0/agent.py", line 572, in handle_exception raise exception # exception handling is done by extensions ^^^^^^^^^^^^^^^ File "/a0/agent.py", line 485, in monologue tools_result = await self.process_tools(agent_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/a0/helpers/extension.py", line 183, in _run_async result = _process_result(data) ^^^^^^^^^^^^^^^^^^^^^ File "/a0/helpers/extension.py", line 143, in _process_result raise exc File "/a0/helpers/extension.py", line 176, in _run_async data["result"] = await data["result"] ^^^^^^^^^^^^^^^^^^^^ File "/a0/agent.py", line 852, in process_tools await self.validate_tool_request(tool_request) File "/a0/helpers/extension.py", line 183, in _run_async result = _process_result(data) ^^^^^^^^^^^^^^^^^^^^^ File "/a0/helpers/extension.py", line 143, in _process_result raise exc File "/a0/helpers/extension.py", line 176, in _run_async data["result"] = await data["result"] ^^^^^^^^^^^^^^^^^^^^ File "/a0/agent.py", line 952, in validate_tool_request raise ValueError("Tool request must be a dictionary")

Mustard5 avatar Mar 28 '26 15:03 Mustard5

When Using OLLAMA Models it is important to set Num_CTX parameters above 36000. The default parameter count (4096) in Ollama is too low for Tool Calling. Watch Your Resources. Do simple taks and compact frquently to save a lot of Momey on Tokens ☝️

I finally have running chat threads w/ qwen3-coder:30b by Run/Set parameter 49152,Save in Ollama cli.

edhooksjr-ai avatar Mar 28 '26 17:03 edhooksjr-ai

same here, using Ollama .. gemma4 and llama3.2 ,

ValueError: Tool request must have a tool_name (type string) field ValueError: Tool request must have a tool_name (type string) field

Traceback (most recent call last): Traceback (most recent call last): File "/a0/helpers/extension.py", line 176, in _run_async data["result"] = await data["result"] ^^^^^^^^^^^^^^^^^^^^ File "/a0/agent.py", line 596, in handle_exception raise exception # exception handling is done by extensions ^^^^^^^^^^^^^^^ File "/a0/agent.py", line 509, in monologue tools_result = await self.process_tools(agent_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/a0/helpers/extension.py", line 183, in _run_async result = _process_result(data) ^^^^^^^^^^^^^^^^^^^^^ File "/a0/helpers/extension.py", line 143, in _process_result raise exc File "/a0/helpers/extension.py", line 176, in _run_async data["result"] = await data["result"] ^^^^^^^^^^^^^^^^^^^^ File "/a0/agent.py", line 878, in process_tools await self.validate_tool_request(tool_request) File "/a0/helpers/extension.py", line 183, in _run_async result = _process_result(data) ^^^^^^^^^^^^^^^^^^^^^ File "/a0/helpers/extension.py", line 143, in _process_result raise exc File "/a0/helpers/extension.py", line 176, in _run_async data["result"] = await data["result"] ^^^^^^^^^^^^^^^^^^^^ File "/a0/agent.py", line 980, in validate_tool_request raise ValueError("Tool request must have a tool_name (type string) field")

elhakimz avatar Apr 13 '26 19:04 elhakimz

Ollama run /set parameter num_ctx 48000 /save -48k /bye

Use the new that used 48m not the Ollama default 4k num_ctx parameter and the LLM calls will begin working.

This is Ollama caused, so you will use their paid cloud models maybe. No Settimgs in AgentZero are working either, only recode model in Ollama. Good Luck Have Fun.

edhooksjr-ai avatar Apr 13 '26 22:04 edhooksjr-ai

Closing due to inactivity of 90 days.

github-actions[bot] avatar Jul 13 '26 04:07 github-actions[bot]