Describe the problem/error/question
Is there a way to get the AI Agent node to output the raw result? Currently, it outputs the result as a string inside a JSON object, like so:
[
{
"output":
"As of the most recent data, the top 5 most populated countries in the world are:\n\n1. **China** - Approximately 1.41 billion people\n2. **India** - Approximately 1.39 billion people\n3. **United States** - Approximately 332 million people\n4. **Indonesia** - Approximately 276 million people\n5. **Pakistan** - Approximately 225 million people\n\nKeep in mind these numbers are continually changing due to births, deaths, and other factors."
}
]
The issue with this is that connecting a structured output parser that structures the response (if the response is JSON) fails because it’s a string.
Here’s an example of the response with a JSON answer:
[
{
"output":
"{\n "countries": [\n {\n "name": "China",\n "population": 1411778724\n },\n {\n "name": "India",\n "population": 1387297452\n },\n {\n "name": "United States",\n "population": 331893745\n },\n {\n "name": "Indonesia",\n "population": 276362965\n },\n {\n "name": "Pakistan",\n "population": 225199937\n }\n ]\n}"
}
]
Given this, is there a way to get the AI Agent node to only output the raw result, so that it can work with the Structured Output Parser?
Please share your workflow
Information on your n8n setup
- n8n version: 1.47.0
- Database (default: SQLite): N/A
- n8n EXECUTIONS_PROCESS setting (default: own, main): unchanged
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Ubuntu