Skip to content

[Bug]: Tool calls return incorrect/weird syntax with Synthetic Provider #4540

Description

@firmanjml

Operating System

Linux

Installation Method

Docker (ghcr.io/openhands/agent-canvas)

Agent Canvas Version

1.14.0

Bug Description

I'm using the Synthetic provider and noticed that whenever a model attempts to make a tool call, it sometimes returns the tool call as strange/raw syntax instead of actually invoking the tool.

I've observed this behavior with both:

GLM 5.2
Kimi K3

Normal text responses work correctly. The issue appears specifically when tool/function calling is involved.

Steps to Reproduce

  1. Use llm from synthetic provider
  2. Get weird syntax when tool call involved

Actual Behavior

Calling the SDK converter on main leaves the raw wrapper as text and produces no tool call:

from openhands.sdk.llm.mixins.fn_call_converter import (
    convert_non_fncall_messages_to_fncall_messages,
)

tools = [{"type": "function", "function": {"name": "terminal", "parameters": {"type": "object", "properties": {"command": {"type": "string"}}}}}]
messages = [
    {"role": "user", "content": "run ls"},
    {"role": "assistant", "content": "<tool_call>terminal\n<parameter=command>ls</parameter>\n</tool_call>"},
]
result = convert_non_fncall_messages_to_fncall_messages(messages, tools)
# Expected: a structured tool_call for `terminal`.
# Observed on main: no tool call; raw <tool_call> syntax stays in the text.

Expected Behavior

The model should return a properly formatted tool call that the client can recognize and execute.

Relevant Logs

Acceptance Criteria

  • A <tool_call>-wrapped model response is converted into a structured tool call rather than leaking into the assistant text.
  • Plain prose mentioning <tool_call> is not converted into a call.

Screenshots

Image

Additional Context

Somehow it's working fine with the free kimi k3 from openhand.
Tested with native toolcall both enabled and disabled with same issue.
API Mode is using /chat

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingllmAbout LLMs.priority:mediumFor bugs, a serious source of annoyance, but not blocking a large number of users.ready-for-devIssue meets development readiness criteria

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions