Structure Snowflake Output

Hi,
n8n newbie here :sweat_smile:

I have trouble understanding how I can parse the information sent back by the “Snowflake - Execute Query” node.

The workflow I’ve built gets an order reference through the chat {{ $fromAI(“ORDER_ID”) }} and retrieves the corresponding information in a Snowflake table.

The output is displayed in “Schema” and “Table” format.

I know I can query these elements through {{ $fromAI(“CUSTOMER_NAME”) }}, etc., but I’d like to use a more deterministic option, like {{ $json.response.response[0].CUSTOMER_NAME }}.

What would be the best way to parse the response I get?

I wouldn’t say best way… but since n8n uses array with objects as the output the:

Split Out node
Use the Split Out node to split the array into individual items. Set the “Field To Split Out” to response.response. This will create a separate item for each object in the array, allowing you to reference fields like {{ $json.CUSTOMER_NAME }} in subsequent nodes. This is the recommended no-code approach.

Or you can use the Code node.

Thanks for your help @Parintele_Damaskin.

The thing is that the only place where I can add a “Split Out” node is as an output of the Agent:

But it only allows me to parse the AI or Chat info, not the one obtained through Snowflake tool :sad_but_relieved_face:

Is there a way to connect the “Split Out” node to the Snowflake tools so that I can get a structured output?

Can I see the system prompt of the ai agent?

If not, I suggest to give clear instructions on how to handle the data, even toggle “format output”(or similar since I don’t remember at moment).

Hope this helps:

#Context:

You are a claims manager assistant.Your aim is to understand Customer’s claim and launch remediation actions (internal investigations, possible product replacement, etc.).

#STEP 1 - Getting ORDER_ID:#First, make sure to obtain the client order reference in the form of an 8-digit reference (ex.: 10123456).Do not hesitate to guide the client until you get it.

#STEP 2 - Confirming Order’s details:#Once you get the client order reference, check if the order exists in the SAP_ORDERS table and revert to the Client by providing the corresponding details:

ORDER_ID
CUSTOMER_NAME
DEPARTURE_COUNTRY_NAME
DESTINATION_COUNTRY_NAME
MATERIAL_NAME
NET_VALUE_IN_EUR
ORDER_QTY_IN_TONS

Ask the customer to confirm they are correct.

#STEP 3 - Understand, check, and acknowledge Customer’s claim:if the customer confirms details, ask for information regarding the claim and acknowledge it.Check with the “Check for Known Defects & Remediation” tool if this is a known defect and how you should proceed.

#STEP 4 - Launch remediation:#Based on the guidelines provided for the claim, typical resolution folds into 2 parts:

Check if our responsibility is at stake2-a) If our responsibility is at stake,

inform the Customer that you will escalate the issue to the corresponding departments (Quality, Supply-Chain, Customer Care, etc.) and use the corresponding tool to warn departements.

Evaluate was the product loss is and if you should propose an immediate product replacement while investigations are on-going.

Start by informing the Customer’s of your actions (departement escalation and possible product replacement). Ask for his approval of a prod.

If you need to create a replacement order and our responsability is at stake, use the “Create Replacement Order” tool to do so and confirm the replacement to the Customer. Inform the Customer that he will receive the new reference shortly.

Use the tool “Send Replacement Order Confirmation” to send a confirmation.fdfdfd

What you ask directly is :

But it seems is not yet possible?

And yes, the Agent node in n8n does have a **“Require Specific Output Format”** (not format output as i i mentioned earlier)toggle. When you enable this option, n8n prompts you to connect an output parser node, such as the **Structured Output Parser**, **Auto-fixing Output Parser**, or **Item List Output Parser**. This allows you to enforce a specific output format (like JSON) for the Agent’s response, making it easier to process the output in downstream nodes like Split Out. However, this formatting applies to the overall output of the Agent node, not directly to the raw output of individual tools used by the agent. You would need to ensure that the agent includes the tool’s output in its final structured response for further processing [Tools Agent node parameters]( Tools AI Agent node documentation | n8n Docs ) [Structured Output Parser common issues]( Structured Output Parser node common issues | n8n Docs ).

So, while the toggle helps you get structured output from the Agent, it does not give you direct access to the tool’s raw output—only what the Agent includes in its final response.

1 Like

Thanks @Parintele_Damaskin ! So no actual solution so far :slight_smile:

1 Like

Sometimes “the” solution is an workaround. :slight_smile:

Glad that I could help! Have a nice day!

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