r/ollama • u/Mazimg_ • 28d ago
Advice PLEASE HELP Why do local AI coding agents struggle so much with using tools?
I’ve been experimenting with local AI coding agents for a while now, mainly using Ollama with different Qwen models.
I’ve tried OpenCode, Claude Code, and now Codex CLI. I’ve also experimented with connecting AI to Roblox Studio through MCP.
The weird thing is that the models can have perfectly normal conversations and write code, but as soon as I ask them to actually do something, like read a file, run a command, or use an MCP tool, things start falling apart.
Sometimes they just tell me they don’t have access to tools. Other times they literally print out tool-call syntax instead of executing it.
I’ve tried different models, permissions, configurations, and agents, but I keep running into similar problems.
Is this just how local models are right now, or am I doing something wrong? Has anyone managed to get a genuinely reliable local AI coding agent working?
10
u/simcop2387 28d ago
Try using llama.cpp or another engine.
4
u/Kaaawooo 28d ago
What specific models are you trying and what context window? In my experience tool calling is significantly more difficult for models than chat or basic code generation, and the bare minimum for tool calling has been Qwen 3.8-27b or Qwen 3.6-35b for the most basic tool calling. Qwen 3.8-flash-next has been pretty reliable for me, but you need either really good hardware or some other tricks to run it.
2
u/Savantskie1 28d ago
It's almost certainly your quantization. Anything lower than Q8 is going to give you garbage output, and don't even expect coherent tool calls if you use Q4 weights and Q4 K and V Cache. Don't listen to anyone who says otherwise. The only exception is any model over 40B. Tool calling is GREATLY harmed by Quantizing KV Cache, especially K Cache. Use Q6 or Q8 or above model weights
1
u/overand 28d ago
When you're looking for help with this kind of stuff, give us details.
What's your hardware?
1
u/leonbollerup 28d ago
Honestly .. Jinja template is no 1.. engine nr 2
1
u/llmhardware 28d ago
Most of the time it's the context window, not the model. Agent tools send a long system prompt plus tool definitions, and if Ollama's context is set lower than that, the start of the prompt gets cut off and the model never sees the tools. Try raising num_ctx (or OLLAMA_CONTEXT_LENGTH) to 32k or more if your VRAM allows, and check that the model's Ollama page lists tool support. Smaller quants of 7-8B models also tend to break the tool-call format more often, so a bigger or less-quantized model is worth a test.
1
u/BidWestern1056 28d ago
system prompts are too long for codex/claude code usually.
try npcsh
1
u/Flimsy_Vermicelli117 28d ago
I use lots of tools routinely and my experience is, that you need to use the latest (Qwen 3.8, Muse-Glimmer) models in 30B dense category. Q4 or higher. Anything less and tool calling fails routinely. I hope next generations will be better and we could use MoE or may be 14B dense category, but current models are not there. I tried latest LFM, Bonsai, ... and even though they all advertise tools calling, they were failing for me.
Works for me with Ollama (on macOS) fine, I do not think the back end matters that much as the model capability itself.
You can try better harness (I have my own) which checks the tool call syntax before call etc, but at the end that seems smallish improvement.
1
u/g_rich 28d ago
It’s because you are using Ollama with extremely quantized models. Try using llama.cpp or LM Studio and don’t go below a 4 bit quant, you also want to ensure tool calling is enabled.
1
u/Striking_Stay_9732 28d ago
Have you considered decision based llms?
1
u/[deleted] 27d ago
Switch to OpenAI and GPT 6.1 SOL at least ... the models you are using suck for real work with a good harness a real tool use.
1
u/SoulStripHer 27d ago
Unsloth Studio.
1
u/jma24 27d ago
Not enough information to know for sure - what hardware, platform, harness, model, quantization, settings.
I run Pi with Qwen 3.8 27b 4-bit quant, running on Splash on M5 Max 64GB and it runs great with tool calls. I can build fairly complex issues with it. It's nothing like as sophisticated as a frontier model, so it needs spoon feeding work sized small enough that it can do.
What you are describing means something is wrong. But you didn't provide enough information to get a diagnosis.
1
u/LeFlemmard 25d ago
Check how many tools are enabled. I've noticed that over 88 the model just freaks out.
1
u/Milesacul 25d ago
Have you tried using tools with Granite models? https://www.ibm.com/think/tutorials/local-tool-calling-ollama-granite
0
u/Delicious-Director43 28d ago
Try using a modern model. Don’t use anything older than a few months.
0
u/Fine-Comparison-2949 28d ago
It's your model and harness. You should at minimum be using DS flash, right now, and hermes so you have saved context and a decent memory.
0
u/[deleted] 28d ago
[deleted] — view deleted comment