Skip to content

Fix local model tool-call loops#1714

Open
TerminallyLazy wants to merge 3 commits into
agent0ai:readyfrom
TerminallyLazy:codex/qwen-local-tool-loop-fix
Open

Fix local model tool-call loops#1714
TerminallyLazy wants to merge 3 commits into
agent0ai:readyfrom
TerminallyLazy:codex/qwen-local-tool-loop-fix

Conversation

@TerminallyLazy

Copy link
Copy Markdown
Contributor

Summary

  • Add a small-local-model system prompt extension for local/Ollama-sized models such as Qwen 9B.
  • Repair common malformed local-model tool JSON into canonical Agent Zero tool requests, including root-level tool args and response-intent fallbacks.
  • Route explicit chat-completions tool-capable local model turns through native chat tool calls and parse returned tool calls into Agent Zero's existing execution path.
  • Record successful tool calls, finalize canvas-opening text-editor writes/patches locally, and block semantic duplicate tool executions before they run again.
  • Sanitize invalid Unicode surrogates in extracted tool args and text-editor file writes.

Testing

  • git diff --cached --check
  • docker exec charming_villani /opt/venv-a0/bin/python -m py_compile /a0/agent.py /a0/extensions/python/system_prompt/_10_small_local_model_prompt.py /a0/helpers/extract_tools.py /a0/helpers/litellm_transport.py /a0/models.py /a0/plugins/_text_editor/helpers/file_ops.py /a0/tests/test_small_local_model_prompt.py /a0/tests/test_stream_tool_early_stop.py /a0/tests/test_text_editor_context_patch.py /a0/tests/test_tool_request_normalization.py
  • Direct container smoke for helpers.extract_tools.extract_tool_request malformed/local-model shapes.
  • Direct container smoke for Agent duplicate-completed text-editor write detection and canvas completion finalization.
  • Restarted local agent0ai/agent-zero:ready container and confirmed UI returned HTTP 200.

Note: full pytest was not runnable in this checkout because the container framework runtime does not include pytest, and the host Python environment is missing project dependencies such as litellm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant