Ai agent output format not working

Describe the problem/error/question

Dear all,
As a learning step I am using n8n to build a Service Desk ticketig from a simmple slack message. For that I need to collect all information about user issue and then when AI agent estimate with a good ratio that it has all info, it should then call the Jira MCP tool available as a node to Ai Agent.

For that , in order to get a final structure for creating jira issue, I am using an ouput formater node which is as below

{
“action”: “string”,
“message”: “string”,
“fields”: {
“project”: { “key”: “string” },
“summary”: “string”,
“description”: “string”,
“issuetype”: { “name”: “string” },
“priority”: { “name”: “string” }
}
}

In the prompt, I am specifing to my AI agent to all time use this format to send message by following this sample for greetings and data collection conversation

You are an IT Support Assistant.

Your role is to help users report IT problems and prepare the information required to create a Jira issue.

All responses must be a single JSON object in this exact structure:

{
“action”: string,
“message”: string,
“fields”: {
“project”: { “key”: string },
“summary”: string,
“description”: string,
“issuetype”: { “name”: string },
“priority”: { “name”: string }
}
}

##FLOW LOGIC

1- Initial greeting:
Always respond with JSON, action: “asking”, and empty fields.
Example:
{
“action”: “asking”,
“message”: “Hello! To help report your IT issue, can you tell me which system or application is affected?”,
“fields”: {
“project”: { “key”: “” },
“summary”: “”,
“description”: “”,
“issuetype”: { “name”: “” },
“priority”: { “name”: “” }
}
}

The problem I have is that when a user send from chat the simple word “Hi there”, Ai Agent receive it as chatinput and should format is as output which sample above, but instead I get the error below

What is the error message (if any)?

[
{
“error”: “Model output doesn’t fit required format”
}
]

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

As output for greeting and all data collection should be as example below :
{
“action”: “asking”,
“message”: “Hello! To help report your IT issue, can you tell me which system or application is affected?”,
“fields”: {
“project”: { “key”: “” },
“summary”: “”,
“description”: “”,
“issuetype”: { “name”: “” },
“priority”: { “name”: “” }
}
}

When need for information on the issue
{
“action”: “asking”,
“message”: “We need more information. Can you tell which application is causing your issue ?, does it repeats all time ?”,
“fields”: {
“project”: { “key”: “” },
“summary”: “”,
“description”: “”,
“issuetype”: { “name”: “” },
“priority”: { “name”: “” }
}
}

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
1 Like

Hi @scal Understood your issue, just use a auto fixing output parser:

So that even if AI agent makes some mistake the other AI would handle it.

Hi @Anshul_Namdev , thnaks for your reply.
I do not understand why do you mean by the link you provide me and how to use

Can you please explain or if you have exemple ?

Actually my workflow is :

chat inout→ Ai Agent (open router free) → Output formatter → Chat send message

Regards

1 Like

@scal what i mean is that, currently you use a static output parser as an AI agent tool right? So instead of that plain output parser, use auto fixing output parser that would fix itself if the AI did something wrong, although AI most of the times do not make this mistake and this only happens when using less capable models first consider using OpenAI models as they are the best for tool calling and agentic flows and they perform better, also even if the AI agent does some mistake that auto fixing output parser can save you from an error, read that official documentation , as your output parser flow would look like this:

Consider using models like GPT-4o for better performance and tool calling abilities.

Why do you have a second chat model connect in your sample. ‘

In my case I have the current workflow, I really do not see how should I place what you mention and what to connect to it

Sorry I am beginers in this

regards

1 Like

HI @Anshul_Namdev , for you information when I am trying to use the fixing output parser, it says it is depracted and must user Structure Output Parser instead :frowning:

1 Like

Hi @scal Open that output parser there you will see this option:

This will allow an option for you to attach an AI agent something like this:

So what this will do is that it will fix the AI agent’s output using its own AI node.

@scal Understood you can use what i have just described instead of using that tool directly, also this is needed because you are using a weak model else models like GPT-4o does not need any assistance like this they follow the structured output parser.