AI Agent returns an error | Agentic workflow

Hey folks. I’m working on building rate negotiator agent
but sometimes I got an error below

Failed to parse. Text: "```json {{ "action": "Final Answer", "action_input": "Hey Bek, I appreciate your offer but $4,100 is a bit low for this route. How about we meet at $5,300? The load is really time-sensitive with a pickup on 03/10/2025, and involves some added logistics with e-tracks and straps. Let". Error: SyntaxError: Expected property name or '}' in JSON at position 1 Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/OUTPUT_PARSING_FAILURE/

Information on your n8n setup

  • n8n version: 1.73.0
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Selft hosted , gcloud
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker based

Hi, your problem is the word "json " before the real json.

You have this:

json {{ "action": "Final answer"........ }}

but the correct version is

{{ "action": "Final answer"........ }}

M.

how can I fix that?

Try to add this sentence to your prompt:

“Reply only with a correct JSON object. No other words or sentence”

But the picture is the “output” from AI ?

1 Like

Thanks @Michel_Morelli

yep we are getting this from ai agent , I mean in the picture output from ai agent node.

see these pictures please



I added your sentence to my prompt and it is working
but is it the real solution ? I mean how can we prevent such problem in the future ?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.