Whenever the LLM calls a tool there is some nondeterminism in whether the LLM will format the tool call response correctly. If the response is slightly different than the format we expect, we will fail to parse the input to the call and provide the error response to the LLM. In this case, you should see the agent “retry” the tool with corrected formatting. Does the agent always fail to parse the Object Query Tool?
If so, could you paste an example of what the raw response was from the LLM for that iteration in the chain of thought? You can grab this information from the “view reasoning” button for the message, scrolling to the tool call in the reasoning, and clicking on the “show raw” button.
It should look something like this:
Thought:
- I need to query the NYCBuildings object type to find the tallest building.
- To find the tallest building, I should order the buildings by their heightroof property in descending order.
- I should limit the result to 1 to get the tallest building.
Tool Name: Object Query Tool
Tool Input:
OBJECT_TYPE NYCBuildings
ORDER BY heightroof DESC
LIMIT 1
If you notice that there is some piece where the agent is consistently failing to format correctly, you can provide additional prompting in the instructions to reduce these cases.
I am also confused to where the plaintext is coming from as I have not seen that before. Is the tool input piece wrapped in backticks ` or quotations "? What model are you using?
Can you try adding some additional prompting like “when using the Object Query Tool, DO NOT wrap anything in backticks (```)”?
How frequently does this LLM include these backticks? We may be able to add some additional parsing to remove backticks from the input block when they are present. I’ll flag internally for us.
Glad to hear it! After this discussion we noticed one piece of our compiled prompt was contributing to this backtick issue so we pushed a fix EOD yesterday. You will hopefully notice less issues in a few days.