eca icon indicating copy to clipboard operation
eca copied to clipboard

[BUG] Tool calls trottling LLM

Open ChetanKoneru opened this issue 10 months ago • 7 comments

Tool calls(same command) trottling LLM with eventual RATE LIMIT error-

Image

Here is the log, let me know I can help debug this issue, have been seeing this quite frequently.

Using ECA 0.89.0 on emacs. This has been a issue for a while, I have noticed this in previous versions of ECA as well. LLM being used is Mistral Devstral-2-small, although this issue occurs with other LLMs as well

[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos", "pattern" "PathInjector\\.new.*inject_path"}'
[TOOLS] Calling tool 'eca__read_file' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "line_offset" 1910, "limit" 30}'
[TOOLS] Calling tool 'eca__read_file' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "line_offset" 1940, "limit" 30}'
[TOOLS] Calling tool 'eca__read_file' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "line_offset" 1970, "limit" 30}'
[TOOLS] Calling tool 'eca__read_file' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "line_offset" 2000, "limit" 100}'
[TOOLS] Calling tool 'eca__read_file' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "line_offset" 2100, "limit" 100}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[TOOLS] Calling tool 'eca__grep' with args '{"path" "/home/mypc/git-repos/build-emacs-for-macos/build-emacs-for-macos", "pattern" "inject_path.*true", "max_results" 5}'
[OPENAI-CHAT] 7403 Unexpected response status: %s body: %s 429 {"object":"error","message":"Rate limit exceeded","type":"rate_limited","param":null,"code":"1300"}
{:message LLM response status: 429 body: {"object":"error","message":"Rate limit exceeded","type":"rate_limited","param":null,"code":"1300"}}
:db/upsert-cache 7ms

ChetanKoneru avatar Jan 06 '26 22:01 ChetanKoneru

@CsBigDataHub Unfortunately I don't think there is much to do as this seems to be LLM's fault, byt maybe we could add some check if the same tool is being called with same args for 5-10 times in a row, but even so, not sure what we would do. c/c @zikajk

ericdallo avatar Jan 06 '26 23:01 ericdallo

maybe we could add some check if the same tool is being called with same args for 5-10 times in a row.

Yes that would make sense but I have not experienced this issue when using the same LLM and provider in GPTEL or Mistral's vibe cli.

ChetanKoneru avatar Jan 07 '26 00:01 ChetanKoneru

Also I have only noticed this with grep tool, may be we can tweak the prompt?

This is the GREP prompt from GPTEL-AGENT

https://github.com/karthink/gptel-agent/blob/99a8b940271fbe68cdfb7c2329d090dc4ef04b99/agents/gptel-agent.md?plain=1#L235

<tool name="Grep">
**When to use `Grep`:**
- Finding ONE specific, well-defined string/pattern in the codebase
- You know what you're looking for and where it likely is
- Verifying presence/absence of specific text
- Quick, focused searches with expected results <20 matches

**When NOT to use `Grep`:**
- **Building code understanding or exploring unfamiliar code** → DELEGATE to `researcher`
- **Expected to get many results (20+ matches)** → DELEGATE to `researcher`
- **Will need follow-up searches based on results** → DELEGATE to `researcher`
- Searching for files by name → use `Glob`
- Reading known file contents → use `Read`

**How to use `Grep`:**
- Supports full regex syntax (ripgrep-based)
- Can specify directory path and glob pattern to narrow scope
- Use `context_lines` parameter to see surrounding lines
- Can perform multiple focused grep searches in parallel
- **If you find yourself doing a second grep based on first results, you should have used `researcher`**
</tool>

vibe cli grep prompt is dry

https://github.com/mistralai/mistral-vibe/blob/main/vibe/core/tools/builtins/prompts/grep.md?plain=1

ChetanKoneru avatar Jan 07 '26 00:01 ChetanKoneru

Yeah maybe, the hard thing is know what to tweak exactly without afecting the tool or results or even other models that already work

ericdallo avatar Jan 07 '26 02:01 ericdallo

Yeah I get it, dense model vs smart model.

ChetanKoneru avatar Jan 07 '26 02:01 ChetanKoneru

I agree that it might be a prompt/tool problem. I'm using local qwen3-coder-next, works wonderfully but does not like the read file command. Sometimes it works around it by calling head+tail. It surely knows where to read ("Let me try a different approach and read the file at offset 285:", but then always call the function with limit=X instead of offset=X), while all other commands works perfectly, but never had problems with grep, so probably the fix is model-based => each user using "small" models should tweak the tools instructions maybe

nico202 avatar Feb 13 '26 17:02 nico202

Yeah, I wonder if the problem is that those models are trying to mimic Claude Code. We can always just translate some invalid params to valid ones but we would have to create a dictionary.

zikajk avatar Feb 13 '26 17:02 zikajk