Chat Agent intermittently returns raw chart JSON instead of rendering the visual

I’m using a Chat Agent backed by a QuickSight dataset. In the agent’s Instructions / system prompt, I’ve asked it to respond with a visual when the question is analytical (ranking, trend, breakdown, comparison).

It works inconsistently:

  • For some questions, it renders the chart beautifully inside the chat.
  • For others, the exact same kind of question, it returns the raw chart spec as JSON instead of rendering it - so the user sees code, not a visual.

The data and the answer are correct in both cases; only the rendering differs.

Questions:

  1. Is this a known issue with the Chat Agent’s chart rendering?
  2. Is there a supported, reliable way to make it consistently render the visual - e.g. a required instruction, or a setting on the agent or dataset?

Any guidance on making the visual output deterministic would be appreciated. Thanks!

Hi @Shishir_Shetty,

Welcome to the Quick Community! To my knowledge, I do not believe there are any known issues with chart rendering. Based on your description, it is definitely possible that it could simply be the generative nature of the chat agent, or it could be hallucinating as well. In either case, I would definitely keep testing it and further specify your instructions by saying something like “render the chart for me in the chat.” Feel free to update if you are still encountering similar behavior.

Thank you!

Thanks @WLS-Luis for looking into this.

I have been trying and testing multiple things to get this working - including the one you suggested. However, I am still encountering this issue.
Is there a native way of including visualization in Chat Agent?

I am aware that adding dataset as a topic gives QuickSight visual in Chat Agent - but the Explanation option goes away in this case.

Hi @Shishir_Shetty,

Thanks for letting me know. After looking into some documentation, I believe you might find this article beneficial, as it goes over embedding Q within Quick (which should output both the explanations and visuals). Other than that, there is indeed no Quick native workaround to obtain both the explanation and visual. Please let me know if this solution works for you and/or makes sense for your use case.

Thank you!