Skip to content

Lost tools #805

@jisokuor

Description

@jisokuor

BUG REPORT — Agent0AI incorrectly writes tools to wrong directory and loses ability to call tools (gpt-oss-20b / LMStudio)

Title

Agent0AI attempts to write new tools into /a0/tools/ instead of /a0/python/tools/, causing tool loading failures and empty tool_name calls (gpt-oss-20b via LMStudio)


Environment

Component | Version / Notes -- | -- Agent0AI | Latest Docker build (Nov 2025) Local model | gpt-oss-20b running in LMStudio Execution environment | Windows 11 host, Agent0 running in Docker Tools directory | Official: /a0/python/tools/ New tools generated by agent | Incorrectly placed into /a0/tools/

Summary of the issue

When using Agent0AI with gpt-oss-20b, the agent frequently:

  1. Attempts to save newly generated Python tools into an incorrect directory
    /a0/tools/
    even though the official tools path is
    /a0/python/tools/

  2. This results in missing tools, because the agent then tries to import them from the wrong directory.

  3. The model also begins emitting empty tool_name fields such as:

    "tool_name": ""

    which triggers the fallback handler (unknown.py) and breaks tool invocations entirely.

  4. After this happens once, the agent enters a state where:

    • it no longer sees tools in /a0/python/tools/

    • imports fail

    • it repeatedly dumps the “Available tools” list

    • and stops executing the intended tool call.

The behaviour appears systematic when using gpt-oss-20b with agent0’s tool-routing layer.


Steps to reproduce

  1. Run Agent0AI inside Docker (/a0/python/tools/ contains all default tools).

  2. Connect LMStudio model: gpt-oss-20b.

  3. Ask the agent to create a new Python tool, e.g.:

    “Create a tool named internet_check.py that pings 8.8.8.8.”

  4. The model generates a correct Python file, but attempts to write it to:

    /a0/tools/internet_check.py
  5. Ask the agent to use the new tool, or list tools.

  6. Agent responds with:

    Using tool '' Tool not found Available tools: ... <list of real tools in /a0/python/tools/>
  7. Agent can no longer call ANY real tools.


Expected behavior

  • Agent0AI should always write and load tools from:
    /a0/python/tools/

  • Tool calls must always include a valid, non-empty tool_name.

  • Missing tools should not cause the agent to lose visibility of all valid tools.


Actual behavior

  • New tools are written to a non-existent or unofficial directory (/a0/tools/)

  • Tool loader cannot see them

  • Agent begins calling tools with:

    "tool_name": ""
  • unknown.py gets invoked repeatedly

  • Tools become “invisible” even though they exist in the correct path


Observed log snippet

A0: Using tool '' Tool not found. Available tools: a2a_chat browser_agent code_execution_tool ...

Corrected behaviour after manual intervention:

Tool Name: code_execution_tool Runtime: terminal Code: ls -l /a0/python/tools

Severity

High — breaks tool-calling functionality and prevents the agent from functioning as intended.
Agent must be restarted unless behaviour rules are manually patched.


Probable root cause (hypothesis)

  • gpt-oss-20b tends to hallucinate or normalize file paths (“tools”, “python/tools”, “/tools”) differently than other models.

  • The model can generate a tool call block before deciding the tool_name, leaving it empty.

  • Agent0’s tool loader interprets this as “use Unknown tool”, resetting tool context.

  • Misaligned assumptions between LMStudio’s model output and Agent0’s directory layout.


Temporary workaround implemented

I added behaviour rules via behaviour_adjustment:

When invoking any tool, always include a valid 'tool_name'. Never leave it empty or omitted. If the correct tool does not exist, create it first in /a0/python/tools using code_execution_tool. All new tools must be written to /a0/python/tools only. Never write or use /a0/tools.

After this, tool calls behave correctly.


Request to developers

Please consider:

  1. Hard-coding the tools directory to /a0/python/tools/ in tool-loader logic
    → reject any tool written to a different directory.

  2. Adding safety validation:

    • fail early if tool_name is empty

    • validate tool paths on creation

  3. Adding optional directory locking via config.

  4. Documenting recommended prompt patterns for smaller models (20B)
    since these seem significantly more prone to directory hallucination and empty tool_name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions