GPT-5.2 fails to call tools properly

Hey,
We’ve recently switched to gpt-5.2 in our agent solution. During tests we observed that sometimes agent is not producing tool calls but includes tool input json as part of preamble message. Does anyone experienced similar issue?

You can see it on the trace screenshot below. Here is the schema of the tool:

{
“name”: “contact_agent”,
“description”: “Communicate with recipient (sub-agent) by sending a message.”,
“strict”: true,
“parameters”: {
“properties”: {
“recipient”: {
“description”: “The recipient of the message.”,
“title”: “Recipient”,
“type”: “string”
},
“content”: {
“description”: “The message to send to recipient.”,
“title”: “Content”,
“type”: “string”
}
},
“required”: [
“recipient”,
“content”
],
“title”: “contact_agent_args”,
“type”: “object”,
“additionalProperties”: false
}
}

1 Like

In the Discourse software, you can enclose text in three backtick characters on their own lines:

```json
your copied code or string
```

And then receive a code fence presentation of the original text without alteration except for syntax highlighting:

{
  "name": "contact_agent",
  "description": "Communicate with recipient (sub-agent) by sending a message.",
  "strict": true,
  "parameters": {
    "properties": {
      "recipient": {
        "description": "The recipient of the message.",
        "title": "Recipient",
        "type": "string"
      },
      "content": {
        "description": "The message to send to recipient.",
        "title": "Content",
        "type": "string"
      }
    },
    "required": [
      "recipient",
      "content"
    ],
    "title": "contact_agent_args",
    "type": "object",
    "additionalProperties": false
  }
}

The suggestion I would have is that in a developer-provided function, you avoid the use of “recipient”, as that is already an internal name. Then that the function be wholly described within in description fields, saying what it will do and what it is good for, when it shall be called, and what action will result and what will be returned. This one tells the AI nothing.

Then eliminate field like “title” that do not match the tool name itself.

Also, do not refer to “preamble” in any prompting. In your main tool description field, if you want announcement first, simply indicate, “the user must be informed of your intention to invoke this function tool method before you then automatically send to it in the same response”.

See if the AI model calls tools properly when they describe their usefulness fully in a self-contained manner that is not otherwise referred to in prompting.

Hey @_j
The recipient is string alias of agent that should be contacted - the supervisor have list of allowed agents + their descriptions in the prompt.

This issue is not about this specific tool (I’ve just used it as example). The issue is that the agent didn’t generate a tool call, but instead it included tool call input in intermediate message that is being generated between tool calls. This issue is not present in gpt-5.1, therefore I ‘m wondering if anyone else experienced similar case and if this is something acknowledged.

3 Likes

@podkova103 Yeah exactly, we are having the same issue on gpt-5.2. Tool calls are outputted in text-delta events in random xml or json like strucutres instead of proper tool call event.

Just wanted to say that we are experiencing the same thing. It will output the function arguments as content instead of proper tool calls. This happens maybe 30% of the time on a very simple tool call.

We are observing the same issue with gpt-5.2, in particular gpt-5.2-chat-latest. It seems to fail to parse harmony response format and returning it as an unparsed text
[some text] <commentary to=functions.end_conversation 彩神争霸如何 不中反json 全民彩票json="{}" 天天中彩票appjson>