AI Help

Why does my n8n AI sub-node use the first input item for every record?

AI sub-node expressions can resolve against the first input item. Process records individually when the sub-node needs per-record values.

Steps to follow

  1. Inspect the input items and the expression used by the affected sub-node. Compare its value for two deliberately different records.
  2. Restructure the workflow so one intended record reaches the agent or sub-node at a time, using a suitable loop or sub-workflow.
  3. Run the two-record test again and inspect actual prompts, IDs and outputs. Check the documentation for your node and version.

Example in practice

Illustrative example. Two products named Alpha and Beta must produce separate embeddings or prompts instead of both using Alpha's fields.

Related AI help

Official guidance

n8n documentation