[Error - Langchain Integration - AI Tool Agent] Received tool input did not match expected schema at DynamicStructuredTool.call

Hey ria!
Tks for reaching out.
Unfortunately the fix you sent won’t be helpfull since I am using mostly VertexAI and Anthopic as LLM Providers. By the way, we’ve this week updated to the version 1.64.1 and the bug keeps happening.

Watching the log I have realized a behaviour pattern even when JSON Schemas and LLMs vary. And the behaviour is that on the first run, the Agent nail the job defining a correct json schema with the property data structured, but the agent runs the LLM one more time and then come the error. The autofixing output parser also hasn’t beem able to fix. I’ll provide as much data as possible in the examples and if you need something more I can DM.

Here is the workflow:

Here is the json the agent structured on the first run:
{
“action”: “Final Answer”,
“action_input”: “{\n "__structured__output": {\n "__structured__output__array": [\n {\n "name": "João da Silva",\n "role": "Titular",\n "maritalstatus": "Casado",\n "healthplan": "ALICE CONFORTO",\n "dentalplan": "",\n "coparticipation": "false",\n "phone": "1199709875",\n "email": "joaosilva.96@hotmail.com",\n "companyrole": "",\n "dependent_of": "",\n "relationship": ""\n },\n {\n "name": "Maria fatima",\n "role": "Dependente",\n "maritalstatus": "Casado",\n "healthplan": "ALICE CONFORTO",\n "dentalplan": "",\n "coparticipation": "false",\n "phone": "",\n "email": "",\n "companyrole": "",\n "dependent_of": "João da Silva",\n "relationship": ""\n }\n ]\n }\n}”
}

Here is the result after the secund run and using the autofix output parser. Btw, I’ve already tried not using the autofix.
[
{
“output”: [
{
},
{
}
]
}
]

The unwanted behavior is either a empty json as above or this generic error message that I got in the log of the second run on the LLM:
"". Error: SyntaxError: Unexpected token '`', "json
{
“… is not valid JSON”

Could you please help us asap? This error is making out application very unstable and as I’ve researched it looks like that is an instruction on how the AI Agent is parsing the json that seems native to the n8n.