Output format

Agent Output formatting

Describe the problem/error/question

Hey I am a newbie, I am building an agent and so far the logic works well. But I am having issues with the format of the output. without formatting it gives me a basic table(which I want) but it is unreadable without lines or control of the size of text etc. I wanted to know what I can use and do to get better control of the text/table…

1 Like

Welcome @kryten4b! I’m assuming you’re referring to the table that displays output within n8n (other options of viewing within the tool are schema and json which are more key-value oriented). Generally the display within the tool is used for quick-and-dirty viewing and debugging; usually this output would get directed into a node that is better at presentation such as e-mail/Telegram/Discord, maybe to a doc or a slide - these are only a few options - there’s lots of choices - depends on target/purpose.

1 Like

Hello @kryten4b . As @John_Rager explained, you might be seeing something like the following:

this is the representation in the n8n UI. but if you check the JSON option (marked on the image), you will be able to see the actual structure:

If the table is showing something like the following:

Then you can use the Split Out node or code to separate it.
I would recommend checking the Courses lvl 1 and 2. They explain those concepts very nicely!
Link to courses:
https://docs.n8n.io/courses/
Let me know if this helps.

Hi @kryten4b Welcome to the community!

What you are facing is the uncontrolled output of the AI agent, for controlling or giving a specific output instructions to the AI agent you probably need to check this option in the AI Agent:

image

And once this is checked you would see another field for a specific output in the AI Agent:

As you can see fourth option you can now click on the Output Parse and select these options:

I recommend using Structured Output Parser as you can provide a JSON format that the AI agent would follow, And there you can add your specific required output and AI would follow that, just in case if this breaks in prodution you can use Auto-Fixing Output Parser which connects an AI model to always check before giving the output.

Welcome to the community! @kryten4b

The advice above about Output Parsers is definitely the right ‘architectural’ way to handle data. However, if your main issue is just making the output visually readable (with lines and headers) for a human, the easiest fix is often in the System Prompt of your Agent.

AI Agents are excellent at formatting. You can add this to your ‘Instructions’ or ‘System Prompt’ field:

‘When providing data in a table, always use Markdown formatting. Ensure the table has clear headers and uses pipes (|) and dashes (-) to create visible borders so it is readable in a standard text viewer.’

This will transform a messy block of text into a clean, structured table that most interfaces (including n8n’s chat and most messaging apps) will render perfectly.

If you are sending this to an email, you can even wrap the output in a simple HTML table tag in the following node. Let me know where you are sending the output, and I can give you the specific formatting logic for that tool

Thank you all for your input

I finally got this up and going as a table…. I think I have to play with the data now as it is too wide for the browser to display well… But I appreciate all the information. thanks